Mind the Gap: towards generalizable autonomous penetration testing via domain randomization and meta-reinforcement learning
Shicheng ZHOU , Jingju LIU , Yuliang LU , Jiahai YANG , Yue ZHANG , Jie CHEN
Eng Inform Technol Electron Eng ›› 2025, Vol. 26 ›› Issue (12) : 2511 -2528.
Mind the Gap: towards generalizable autonomous penetration testing via domain randomization and meta-reinforcement learning
With the increasing number of vulnerabilities exposed on the Internet, autonomous penetration testing (pentesting) has emerged as a promising research area. Reinforcement learning (RL) is a natural fit for studying this topic. However, two key challenges limit the applicability of RL-based autonomous pentesting in real-world scenarios: the training environment dilemma—training agents in simulated environments is sample-efficient while ensuring that their realism remains challenging; poor generalization ability—agents' policies often perform poorly when transferred to unseen scenarios, with even slight changes potentially causing a significant generalization gap. To address both challenges, we propose a generalizable autonomous pentesting framework termed GAP, which aims to achieve efficient policy training in realistic environments and train generalizable agents capable of drawing inferences about other cases from one instance. GAP introduces a real-to-sim-to-real pipeline that enables end-to-end policy learning in unknown real environments while constructing realistic simulations and improves agents' generalization ability by leveraging domain randomization and meta-RL learning. We are among the first to apply domain randomization in autonomous pentesting and propose a large language model-powered domain randomization method for synthetic environment generation. We further apply meta-RL to improve agents' generalization ability in unseen environments by leveraging synthetic environments. Combining the two methods effectively bridges the generalization gap and improves agents' policy adaptation performance. Simulations are conducted on various vulnerable virtual machines, with results showing that GAP can enable policy learning in various realistic environments, achieve zero-shot policy transfer in similar environments, and achieve rapid policy adaptation in dissimilar environments.
Cybersecurity / Penetration testing / Reinforcement learning / Domain randomization / Meta-reinforcement learning / Large language model
Zhejiang University Press
/
| 〈 |
|
〉 |