The Agent Web Model - Modelling web hacking for reinforcement learning

Laszlo Erdodi, Fabio Massimo ZennaroarXiv 2020

Introduction

As web systems grow increasingly complex, the surface area for vulnerabilities expands proportionally. While human penetration testers (white hat hackers) utilize automated scanners to secure these systems, existing tools are primarily designed for detecting known flaws rather than dynamically exploiting them in multi-step sequences.

Reinforcement Learning (RL)—the branch of AI responsible for mastering complex games like Go and StarCraft—offers a promising path toward autonomous agents capable of sophisticated penetration testing. However, RL algorithms require standardized, mathematically rigorous environments to learn through trial and error. Real-world web hacking is often too unconstrained and lacks the clear reward signals necessary for training. This paper introduces the Agent Web Model, a formal framework that bridges this gap by translating web hacking into structured RL problems.

The Agent Web Model

The authors conceptualize the target web server as a stateful, partially observable environment where an agent takes discrete actions to find a "flag" (the reward). To manage the inherent complexity of web exploitation, they introduce a hierarchical model consisting of seven distinct levels of abstraction.

The seven hierarchical layers of the Agent Web Model, ranging from link crawling to server modification.

These levels range from basic link crawling to advanced server manipulation:

  1. Link layer: Crawling static HTML files and explicit links.
  2. Hidden link layer: Discovering implicit links, such as guessing directories or parsing comments.
  3. Dynamic content layer: Interacting with server-side scripts via basic URL parameters.
  4. Web method layer: Utilizing specific HTTP methods like GET and POST.
  5. HTTP header layer: Manipulating session IDs, cookies, and headers.
  6. Server structure layer: Escaping the webroot to interact with local files (LFI) or databases (SQLi).
  7. Server modification layer: Uploading scripts and achieving Remote Code Execution (RCE).

Methodology and Environment

The research formalizes the transition from offensive security to machine learning through a specific pipeline: Real-world hacking → Capture The Flag (CTF) → Game Theory → RL Problem. Jeopardy-style CTFs are identified as the ideal stepping stone because they offer unambiguous victory conditions and restrict actions to the digital domain.

To facilitate research, the authors built a generative RL environment using the OpenAI Gym framework. They have implemented and open-sourced the first three levels of the model, allowing researchers to procedurally generate a virtually infinite number of randomized CTF web challenges to benchmark RL agents.

Complexity and the Dynamic Content Layer

A key contribution of the paper is the mathematical demonstration of the "combinatorial explosion" inherent in web hacking. While static crawling (Level 1) is relatively simple, the introduction of dynamic content significantly increases the difficulty for an agent.

A representation of the Dynamic Content Layer (Level 3), showing how URL parameters increase environment complexity.

Moving to Level 3, where agents must interact with parameters, causes the state and action spaces to grow exponentially. The authors calculated that an environment with $N$ files, $M$ parameter names, and $O$ parameter values yields $3(N + NMO)$ possible actions and a massive state space cardinality of $2^{3(N+NMO)-1}$. This formalization helps explain why autonomous web hacking remains a frontier challenge for AI.

Key Insights and Results

The Agent Web Model allows for a neat categorization of the OWASP Top 10 vulnerabilities. For instance, Information Disclosure typically occurs at Levels 1-2; Cross-Site Scripting (XSS) and SQL Injection require Level 3 or higher (handling parameters); and Cross-Site Request Forgery (CSRF) requires Level 5 (manipulating HTTP headers and sessions).

As a foundational modeling paper, the primary result is the successful quantification of these spaces and the release of the OpenAI Gym-compatible testbed. This provides the security and ML communities with an out-of-the-box environment to begin training and evaluating autonomous agents.

Limitations and Future Work

Currently, the software implementation covers only the first three levels. The more complex levels (4-7), involving session management, database interaction, and server modification, remain theoretical blueprints. Additionally, the model does not yet account for server response times, meaning time-based vulnerabilities (like blind SQL injection) cannot be simulated.

Future work will focus on implementing the remaining abstraction layers and establishing baseline performance metrics using state-of-the-art RL algorithms. The authors also emphasize the ethical considerations of this research, advocating for its use strictly within preventive, CTF-style environments to mitigate the risk of dual-use for malicious purposes.

Summary updated

BibTeX
@misc{erdodi2020agent,
  author = {Laszlo Erdodi and Fabio Massimo Zennaro},
  title = {{The Agent Web Model - Modelling web hacking for reinforcement learning}},
  year = {2020},
  eprint = {2009.11274},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2009.11274},
}
Figure