Penetration Testing == POMDP Solving?

Carlos Sarraute, Olivier Buffet, Jörg HoffmannarXiv 2013

Abstract

Penetration Testing is a methodology for assessing network security, by generating and executing possible attacks. Doing so automatically allows for regular and systematic testing without a prohibitive amount of human labor. A key question then is how to generate the attacks. This is naturally formulated as a planning problem. Previous work used classical planning and hence ignores all the incomplete knowledge that characterizes hacking. More recent work makes strong independence assumptions for the sake of scaling, and lacks a clear formal concept of what the attack planning problem actually is. Herein, we model that problem in terms of partially observable Markov decision processes (POMDP). This grounds penetration testing in a well-researched formalism, highlighting important aspects of this problem's nature. POMDPs allow to model information gathering as an integral part of the problem, thus providing for the first time a means to intelligently mix scanning actions with actual exploits.

Introduction

Automated penetration testing (pentesting) is essential for maintaining security at scale. However, most existing tools rely on "classical planning," which assumes the attacker has perfect knowledge of the target network—such as exact OS versions and running services. In reality, hackers operate in a "fog of war." They do not know a machine's configuration until they probe it, but probing takes time and increases the risk of detection. The core challenge is deciding exactly when to gather information and when to strike.

Modeling Pentesting as a POMDP

To address the uncertainty inherent in network security, we model the pentesting process as a Partially Observable Markov Decision Process (POMDP). In this framework, the target's configuration is treated as a hidden state, and the attacker maintains a "belief" about that state based on observations.

  • States ($S$): Represent machine configurations (OS, open ports, services) and the attacker's level of control.
  • Actions ($A$): Categorized into Tests (e.g., port scans) which provide information, and Exploits (e.g., buffer overflows) which attempt to change the state by gaining control.
  • Observations ($O$): The results of scans or the success/failure signals from an exploit attempt.
  • Initial Belief ($b_0$): We utilize a Markov Chain to model how a system’s configuration "drifts" over time—such as users installing updates or changing settings—since the last known audit.
Figure 3: Markov Chain model representing the drift of system configurations over time.

By modeling uncertainty in the state rather than the action, we reflect the reality that exploits fail primarily because the target's configuration was not what the attacker expected. We utilize SARSOP, a state-of-the-art point-based POMDP solver, to compute optimal policies that intelligently balance scanning with exploitation.

Experimental Results and Scaling

We evaluated our approach using a custom problem generator that pulls real-world vulnerability data from a proprietary database provided by Core Security Technologies. Scenarios were scaled across three parameters: the number of machines ($M$), the number of available exploits ($E$), and the time elapsed since the last pentest ($T$).

Figure 4: Solver runtime performance across varying numbers of machines, exploits, and timesteps.

Our analysis revealed an "Easy-Hard-Easy" pattern relative to time ($T$). When $T$ is very small, the attacker is certain of the state (Easy). When $T$ is very large, systems often converge to a stable "latest version," reducing entropy (Easy). The computational peak occurs in the middle ground where many different configurations are equally likely.

While POMDPs are computationally intensive, the solver successfully handled networks of up to 7 machines. For the common scenario of a single target machine, the system scales excellently, handling up to 50 different exploits with realistic time delays. Qualitatively, the resulting policies behave like expert hackers; for instance, the agent may skip a slow OS detection scan if a quick port scan makes a specific exploit statistically likely to succeed.

Conclusion

Modeling penetration testing as a POMDP provides a rigorous foundation for automated hacking that accounts for information gathering. While state-space explosion remains a challenge for enterprise-scale networks, future work may involve a hierarchical approach—using POMDPs for local machine interactions and classical planners for high-level network navigation. Additionally, incorporating active defenders would evolve this model into a more complex adversarial game.

Summary updated

BibTeX
@misc{sarraute2013penetration,
  author = {Carlos Sarraute and Olivier Buffet and Jörg Hoffmann},
  title = {{Penetration Testing == POMDP Solving?}},
  year = {2013},
  eprint = {1306.4714},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1306.4714},
}
Figure