Abstract: In the network security arms race, the defender is significantly disadvantaged as they need to successfully detect and counter every malicious attack. In contrast, the attacker needs to succeed only once. To level the playing field, we investigate the effectiveness of autonomous agents in a realistic network defence scenario. We first outline the problem, provide the background on reinforcement learning and detail our proposed agent design. Using a network environment simulation, with 13 hosts spanning 3 subnets, we train a novel reinforcement learning agent and show that it can reliably defend continual attacks by two advanced persistent threat (APT) red agents: one with complete knowledge of the network layout and another which must discover resources through exploration but is more general.
Introduction
In the high-stakes world of cybersecurity, the "defender’s dilemma" is a brutal reality: a defender must successfully block every single attack, while an attacker only needs to succeed once. Traditional network defense relies heavily on human operators, leading to slow response times and high operational costs. In 2020, attackers spent a median of 24 days undetected inside networks before being caught. While Reinforcement Learning (RL) has mastered complex games like Dota 2 and Atari, its application in the high-fidelity world of network security has been limited. This paper presents a winning approach to the first Cyber Autonomy Gym for Experimentation (CAGE) Challenge, demonstrating how Hierarchical Reinforcement Learning (HRL) can outmaneuver sophisticated digital adversaries.
Network Environment and Adversaries
The study utilizes the CybORG environment, a high-fidelity cyber security simulator that can be run as a Python simulation or emulated using real virtual machines on AWS to ensure realistic state transitions.
As shown in Figure 1, the network structure consists of 13 hosts spanning three subnets: Users, Enterprise, and Operational. The defender must monitor traffic, analyze processes, and restore compromised hosts while minimizing "operational disruption" (penalties for taking services offline). The core difficulty lies in the variety of attackers:
- B_lineAgent: Uses an optimal exploitation trajectory with perfect knowledge of the network.
- RedMeanderAgent: Scans and propagates cautiously to discover vulnerabilities.
- SleepAgent: A baseline agent that takes no action.
Methodology: Hierarchical Reinforcement Learning
The researchers utilized a Hierarchical Reinforcement Learning (HRL) architecture. Instead of training one "jack-of-all-trades" agent, they built a two-tier system:
- Sub-agents: Two specialized agents were trained using Proximal Policy Optimization (PPO). One was optimized specifically to counter the direct
B_lineAgent, and the other to counter the exploratoryRedMeanderAgent. - The Controller: A high-level RL agent acts as a manager. At each time step, it observes the network state, identifies which type of adversary is likely attacking, and selects the appropriate sub-agent to take the low-level defensive action.
A critical addition was the Intrinsic Curiosity Module (ICM). Curiosity-driven learning provides "internal" rewards to agents when they encounter uncertain or new states. This prevents the agents from getting stuck in local optima and helps them develop robust strategies even when the attacker’s actions are unpredictable.
Key Results
The proposed hierarchical agent won the CAGE Challenge 1. In the challenge, a compromised operational server results in a -10 penalty per step. The hierarchical agent maintained an average score of -8.43, meaning the critical operational server was almost never successfully compromised.
As detailed in Figure 2, the Hierarchical agent significantly outperformed a "chance" agent (-37.6) and individual sub-agents when they were forced to face the "wrong" adversary. For instance, the B-line-defence agent performed poorly (-61.05) against the RedMeanderAgent. The hierarchical controller effectively "swaps" tools, allowing the system to outperform any single-strategy agent. Its performance was nearly identical to a "Hierarchical-perfect" agent, proving the controller is highly effective at identifying threats.
Conclusion
This research demonstrates that specialized agents fail to generalize, but a hierarchical controller can effectively function as an automated intent classifier to orchestrate a robust defense. Adding curiosity (ICM) nearly doubled the reward for the b-line-defence agent, making it more resilient to human-like randomness. Future work will focus on adaptive fine-tuning for live attacks and developing sub-agents that cover broader classes of attack behavior rather than specific scripts.
Summary updated