arXiv:2610.40214cs.CROct 2026

Manuscript Offprint

arXiv:2610.40214

DYNAS: A Dynamic Network Penetration Testing Framework Using Deep Hierarchical Reinforcement Learning

Md. Rakibul Hassan, Majedul Islam, Md. Ashraful Alam, Muhammad Iqbal Hossain, Swakkhar Shatabda

Md. Rakibul Hassan 1^{1}, Majedul Islam 1^{1}, Md. Ashraful Alam 1^{1}, Muhammad Iqbal Hossain 1^{1}, and Swakkhar Shatabda 1^{1}

Accepted at the NSS 2026: 20th International Conference on Network and System Security (submission version)

BRAC University, Bangladesh

md.rakibul.hassan@g.bracu.ac.bd, majedul.islam@g.bracu.ac.bd,

md.ashraful.alam1@g.bracu.ac.bd, iqbal.hossain@bracu.ac.bd,

swakkhar.shatabda@bracu.ac.bd

Abstract. As network scale and uncertainty complicate automated penetration testing, reinforcement learning (RL) environments must support controlled evaluation under defensive and non-stationary conditions. We present DYNAS (Dynamic Network Attack Simulator), which combines parameterized large-scale scenario generation with stateful intrusion detection responses, explicit scan false-positive and false-negative noise, temporary service unavailability, and duration-based action timeouts. We further introduce Pen-DHRL, a recurrent manager-worker policy that selects persistent subgoals using IDS-conditioned global context. We compare Pen-DHRL with GNN, Invariant, and Attention baselines across four scenario variants and multiple training regimes. Under IDS-disabled training followed by IDS-enabled evaluation, Pen-DHRL obtains approximately 64% and 24% higher reward per step on Bridge and Dynamic, respectively, and approximately 26% and 30% more captured hosts on VarA and VarB than the next-best baseline. With all defensive dynamics active from the beginning of training, Pen-DHRL achieves positive mean episode returns in all four scenarios, whereas the flat baselines produce negative mean returns in all 12 architecture-scenario combinations; staged curriculum training produces positive mean returns across all 16 evaluated combinations.

Keywords: Automated penetration testing · AI for security · Hierarchical reinforcement learning · IDS-aware attack planning · Network attack simulation · Curriculum learning

1 Introduction

Automated security assessment provides repeatability and broad coverage, but automatically generated findings can require expert validation, whereas fully manual penetration testing is resource-intensive and difficult to scale [22,24]. This complementarity motivates learning-based methods for sequential attack planning, but their evaluation depends strongly on the assumptions represented by the training environment. Established

M. R. Hassan et al.

RL environments such as NASim and NASimEmu provide efficient interaction, partially observable attack planning, and scenario variation, yet their published simulation protocols simplify stateful defensive reactions and several sources of observation and execution uncertainty [25,13]. DYNAS targets this evaluation gap through a controlled, defense-aware simulator for large parameterized network scenarios. 1^{1}

NASimEmu was selected as the implementation base because its variable-size graph observations, parameterized scenario representation, and released RL baselines align directly with our questions concerning structural transfer and hierarchical control. Its common agent interface also permits policies to be evaluated across changing network instances while preserving a comparable action vocabulary. Together, these properties provide a technically suitable and reproducible foundation for DYNAS [13].

Table 1. Abstraction-level and environmental-feature comparison of RL-based pentesting frameworks

FeatureNASimIAPTFWCEDynPenNASimEmuPenGymDYNAS
Simulation-Based Training✓✓Conceptual✓✓✓✓
Structural Scenario VariationLimited-Conceptual✓LimitedLimited✓
Firewall-Aware Reachability✓LimitedConceptual-✓✓✓
IDS Representation/ Response-Limited----✓
Curriculum Scheduling------✓
Explicit Scan FP/FN Noise------✓
Service-State Dynamics---Limited--✓
Duration-Based Action Timeouts------✓

Per NASim [25], IAPTF [11], WCE [6,7], DynPen [15], NASimEmu [13], and PenGym [19]. ✓ denotes explicit support in the cited implementation; Limited denotes related support at a different abstraction or granularity; Conceptual denotes a proposed framework or NASim-based case study; and – indicates that the feature is not documented in the cited protocol.

NASimEmu already supports scenario randomization for evaluating transfer across network sizes and configurations. DYNAS extends this simulation protocol by jointly introducing stateful IDS responses, explicit scan errors, temporary service-state changes, duration-based action timeouts, and curriculum-controlled difficulty. The reviewed systems provide complementary subsets of these capabilities, but their published protocols do not document their joint use within one repeatable attack-focused simulator. PendHRL is designed for this setting by combining recurrent global context, persistent

1^{1} The DYNAS implementation is publicly available at https://github.com/G5-Security/DYNAS.

high-level subgoals, and a goal-conditioned worker policy. Against this background, the primary contributions of this research are as follows:

– Controlled Defense-Dynamics Layer: A configurable simulation layer that jointly represents stateful IDS responses, explicit scan false-positive and false-negative noise, temporary service unavailability and recovery, and duration-based action timeouts under firewall-constrained reachability.

– Parameterized Scenario Generation: A template-based generator that varies subnet sizes, host configurations, sensitive-host placement, and topology while preserving a stable action vocabulary.

– Hierarchical Policy: A recurrent manager uses IDS context to select persistent subgoals that guide attack planning over long horizons.

– Regime-Specific Evaluation: A comparison with flat RL baselines under defense-disabled training, immediate defended training, curriculum training, and transfer from IDS-disabled training to IDS-enabled evaluation.

References (26)