Automated penetration testing (pentesting) aims to identify network vulnerabilities by simulating attacks. However, most existing tools rely on "classical planning," which assumes the attacker has perfect knowledge of the target network—including OS versions and open ports. In reality, hackers operate under a "fog of war," where information is incomplete and gathering it carries a cost. This paper presents 4AL, a novel decomposition algorithm that uses Partially Observable Markov Decision Processes (POMDPs) to model this uncertainty and automate strategic decision-making.
The Challenge of Uncertainty and Scalability
Real-world hacking involves reasoning about what is not known. A human expert uses scans strategically rather than scanning everything upfront. While POMDPs are the standard mathematical framework for decision-making under uncertainty, they are computationally expensive. As the number of machines in a network grows, the complexity of a global POMDP explodes exponentially, making it unusable for enterprise-scale environments.
The 4AL Algorithm: Hierarchical Decomposition
The core contribution of this research is the 4AL (4 Abstraction Levels) algorithm. It breaks a massive network-wide problem into manageable pieces by exploiting the natural structure of modern networks (e.g., zones separated by firewalls).
- Level 1 (Network Decomposition): The logical network is decomposed into a tree of biconnected components.
- Level 2 (Component Attack): The algorithm identifies paths through these specific components.
- Level 3 (Subnetwork Attack): It determines the optimal machine to target within a subnetwork.
- Level 4 (Individual Machine Attack): At this level, the system models each machine as a small POMDP. The "state" includes hidden variables like whether a specific patch is installed or if Data Execution Prevention (DEP) is active.
By solving POMDPs only at the machine level and using a conservative approximation to propagate results upward, 4AL transforms an exponential problem into a polynomial one.
Modeling System Evolution
To ensure the simulation remains realistic, the researchers used Markov chains to model how software configurations change over time. This allows the system to maintain an "initial belief" about the state of the network, such as the probability that a user has installed a security patch or enabled a specific defense since the last test.
This modeling enables "intelligent failure analysis." If an exploit fails, the POMDP updates its belief. For instance, if an exploit targeting a buffer overflow fails, the system may conclude that DEP is likely active and will automatically pivot to exploits that are not blocked by DEP.
Key Results and Performance
The 4AL approach was evaluated using industrial test scenarios provided by Core Security, featuring realistic topologies with exposed and sensitive zones. The results demonstrate significant improvements over traditional methods:
- Scalability: 4AL can generate an attack plan for a network with 100 machines and 100 potential exploits in under 37 seconds.
- Accuracy: Compared to a global (optimal but slow) POMDP on smaller networks, 4AL’s approximation resulted in a quality loss of only about 2%.
- Strategic Efficiency: The system treats scanning as an action with a cost. It only performs a port scan if the information gained is worth more than the cost of the scan itself, resulting in "hacker-like" behavior that reaches targets faster and with less noise than "scan-then-plan" tools.
Conclusion
By accounting for uncertainty and leveraging network structure, 4AL provides a scalable path for automated pentesting. Future work will focus on expanding the scope of actions to include local privilege escalation and conducting direct comparisons with industry-standard classical planners to further quantify the efficiency gains of the POMDP approach.
Summary updated