[Paper Review] Evaluation of Reinforcement Learning for Autonomous Penetration Testing using A3C, Q-learning and DQN
This paper evaluates deep reinforcement learning (DRL) agents—Q-learning, DQN, and A3C—for autonomous penetration testing using an enhanced NASim environment with three attack scenarios: exploitation, post-exploitation, and wiretapping. A3C outperformed other algorithms by solving all scenarios with fewer actions and better generalization, demonstrating the feasibility of DRL in automated security testing despite limitations in state/action space and overfitting risks.
Penetration testing is the process of searching for security weaknesses by simulating an attack. It is usually performed by experienced professionals, where scanning and attack tools are applied. By automating the execution of such tools, the need for human interaction and decision-making could be reduced. In this work, a Network Attack Simulator (NASim) was used as an environment to train reinforcement learning agents to solve three predefined security scenarios. These scenarios cover techniques of exploitation, post-exploitation and wiretapping. A large hyperparameter grid search was performed to find the best hyperparameter combinations. The algorithms Q-learning, DQN and A3C were used, whereby A3C was able to solve all scenarios and achieve generalization. In addition, A3C could solve these scenarios with fewer actions than the baseline automated penetration testing. Although the training was performed on rather small scenarios and with small state and action spaces for the agents, the results show that a penetration test can successfully be performed by the RL agent.
Motivation & Objective
- To develop and evaluate reinforcement learning agents for autonomous penetration testing in a simulated network environment.
- To extend NASim with new actions (vulnerability scanning, wiretapping, post-exploitation) and define three realistic attack scenarios.
- To perform a large-scale hyperparameter grid search to identify optimal agent configurations.
- To assess generalization performance across unseen network permutations and compare against a decision tree-based baseline.
- To evaluate whether DRL can outperform traditional automated tools in action efficiency and success rate.
Proposed method
- Enhanced NASim environment to support vulnerability scanning, wiretapping, and post-exploitation actions.
- Defined three distinct penetration testing scenarios requiring different action sequences for successful compromise.
- Trained three DRL algorithms—Q-learning, DQN, and A3C—on progressively complex training stages: single scenario (24 permutations), multi-scenario (72 permutations), and generalization on unseen permutations.
- Conducted a hyperparameter grid search across over 4,000 agent configurations to identify optimal settings.
- Used a decision tree-based baseline (Penbox) for comparison, measuring success rate and number of actions taken.
- Evaluated generalization by testing trained agents on unseen permutations of the scenarios.
Experimental results
Research questions
- RQ1Can A3C, DQN, and Q-learning agents successfully learn to perform autonomous penetration testing across multiple predefined attack scenarios?
- RQ2How does the performance of DRL agents compare to a baseline decision tree-based automated penetration testing tool in terms of action efficiency and success rate?
- RQ3To what extent can the agents generalize to unseen network topologies and attack permutations?
- RQ4Which DRL algorithm demonstrates the best balance of performance, generalization, and robustness across varying training complexity levels?
- RQ5What hyperparameter configurations yield optimal performance for each DRL algorithm in the context of penetration testing?
Key findings
- A3C successfully solved all three attack scenarios across all training and generalization stages, demonstrating robust performance and generalization.
- A3C required fewer average actions to achieve compromise than the decision tree-based baseline, indicating higher efficiency.
- Q-learning solved only one scenario in Stage 1, while DQN failed in all stages, indicating poor scalability and generalization.
- Overfitting was observed in Stage 3, particularly for DQN and Q-learning, highlighting the need for more diverse training environments.
- The hyperparameter grid search identified optimal configurations, but performance remained highly sensitive to hyperparameter choice, especially for DQN and Q-learning.
- Despite limited state and action spaces, the results show that RL agents can learn complex attack dependencies, suggesting feasibility for automated penetration testing.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.