JavaScript Path Enumeration for Dark Code Vulnerabilities
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for testing web applications fail to effectively identify and explore 'dark paths' in executable JavaScript code, which can be exploited by malicious actors for vulnerabilities, as these paths are not executed during normal browser operation but can serve as attack points.
Innovation Solution
A system and method for JavaScript path enumeration that includes receiving and analyzing HTML page structures with executable JavaScript code, enumerating branching paths, determining and executing 'dark paths' using artificial conditions, and tracking DOM mutations to identify and analyze potential attack vectors.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If normal browser operation is used to execute JavaScript code, then the application functions correctly, but dark paths (unintended execution paths) are not explored and vulnerabilities remain undetected
Solution Approach 1:
The patent applies preliminary action by performing static analysis of JavaScript code before execution to identify potential dark paths and branching conditions. The system pre-processes the code to create a control flow graph and identifies unreachable or unintended paths that would not be executed during normal browser operation, enabling security testing before actual deployment.
Solution Approach 2:
The patent introduces an intermediary security analysis system that sits between the JavaScript code and the browser execution environment. This intermediary tool (such as a headless browser or static analysis engine) mediates the execution process by injecting artificial conditions, modifying DOM state, and forcing exploration of dark paths without affecting normal user interaction with the application.
2Measurement precision
If static analysis is performed on JavaScript code to identify dark paths, then vulnerability detection capability improves, but the complexity of analyzing large and complex codebases increases
Solution Approach 1:
The patent applies segmentation by dividing the JavaScript codebase into modular units and analyzing them individually through control flow graphs and dependency graphs. The system breaks down large applications into smaller functional segments, allowing precise tracking of data flow and control flow without being overwhelmed by the overall codebase complexity.
Solution Approach 2:
The patent uses parameter changes by dynamically modifying execution parameters such as DOM state, variable values, and control flow conditions to trigger dark paths. The analysis system changes parameters like event listener states, form input values, and navigation conditions to force the JavaScript engine to execute unintended code paths that would otherwise remain hidden.
3Reliability
If artificial conditions are generated and executed to explore dark paths, then security coverage improves, but the time and computational resources required for testing increase
Solution Approach 1:
The patent applies periodic action by systematically cycling through different artificial conditions and execution scenarios in a structured sequence. The testing framework periodically resets the DOM state and re-executes code paths with modified conditions, ensuring comprehensive coverage of dark paths while maintaining a rhythm that prevents resource exhaustion and allows for efficient resource management.
Data Source
AI summary
In one example in accordance with the present disclosure, a method may include receiving code corresponding to an HTML page structure including a plurality of executable JavaScript code and enumerating a branching path in the JavaScript code. The method may include determining a branch of the branching path that would not execute during normal operation of a browser executing the JavaScript code. The method may also include generating an artificial condition for the branch and executing the branch using the artificial condition.


