Introduction
Cross-Site Scripting (XSS) remains a critical threat in web security, consistently appearing in the OWASP Top Ten. For critical infrastructure like power communication networks, XSS vulnerabilities represent more than just software bugs; they are potential entry points for attackers to manipulate grid data or disrupt essential services. Traditional detection methods often fall short: static analysis (white-box) misses runtime triggers, while dynamic testing (black-box) lacks insight into code structure. This paper introduces SMD (Source code cross-site scripting vulnerability Detection), a hybrid approach designed to bridge these gaps by combining static source code analysis with dynamic testing.
The SMD Methodology
The SMD model operates through a unified four-stage workflow designed to identify Reflected, Stored, and DOM-based XSS vulnerabilities with high precision.
1. Preprocessing and Extraction
The tool begins by "cleaning" the source code. This involves normalizing case, decoding URL and Unicode characters, and removing comments to prevent attackers from hiding malicious scripts through obfuscation. Following this, the system extracts critical elements such as <input> tags and JavaScript blocks for further analysis.
2. Static Analysis: The Variable Conversion Method
A standout feature of SMD is its use of "feature expressions" ($F_E$) to track data flow. By tagging variables, functions, and assignment operations, the model identifies if a variable's value eventually reaches a dangerous HTML sink (e.g., the innerHTML property) without undergoing proper filtering or sanitization.
3. Dynamic Testing and Selenium Integration
To confirm potential vulnerabilities identified during static analysis, SMD utilizes the Selenium browser automation tool to simulate real-world attacks. It injects generated attack vectors into the web page and monitors for successful execution, such as the triggering of an Alert object or specific DOM manipulations.
4. Genetic-Inspired Attack Vectors
To bypass modern filters, the researchers developed a method for constructing attack vectors inspired by genetic algorithms. This process combines base elements—tags, attributes, and events—with various "deformation methods," such as case confusion, mark nesting, and special symbol addition.
Experimental Results
The SMD model was evaluated against industry benchmarks, including Google’s "Firing Range," DVWA, and the XSSed archive. When compared to existing research models and commercial tools like Acunetix and ZAP, SMD demonstrated superior performance in several areas:
- High Precision: On the Firing Range project, SMD achieved a 94.20% precision rate, outperforming baseline models.
- Low False Alarms: The model reduced the false alarm rate to just 1.44%, nearly half that of comparable methods.
- Broad Detection Scope: Unlike many tools limited to Reflected XSS, SMD successfully identified all three major types: Reflected, Stored, and DOM-based XSS.
- Efficiency: In real-world testing on the XSSed platform, SMD completed its analysis in approximately 0.45 minutes, significantly faster than commercial scanners like ZAP (2.96 minutes).
Conclusion and Future Work
The SMD model provides a robust, hybrid solution for securing web applications within critical infrastructure. By combining the "scouting" capabilities of static analysis with the confirmation power of dynamic testing, it significantly reduces false positives. However, the researchers noted a limitation in URL Traversal; currently, the tool lacks the deep crawling capabilities of heavy-duty commercial scanners. Future work will focus on improving automated traversal to ensure comprehensive coverage of complex, large-scale web applications.
Summary updated