Skip to main content
QUICK REVIEW

[Paper Review] NASimEmu: Network Attack Simulator & Emulator for Training Agents Generalizing to Novel Scenarios

Jaromír Janisch, Tomáš Pevný|arXiv (Cornell University)|May 26, 2023
Network Security and Intrusion DetectionComputer Science3 citations
TL;DR

NASimEmu is a novel reinforcement learning framework that unifies simulation and emulation for training generalizable penetration testing agents. By aligning a realistic simulator (enhanced NASim) with an industry-grade emulator (using Vagrant, VirtualBox, and Metasploit), it enables agents trained in simulation to successfully transfer and perform in realistic emulation environments, demonstrating the validity of the abstraction and promoting generalization to unseen network scenarios.

ABSTRACT

Current frameworks for training offensive penetration testing agents with deep reinforcement learning struggle to produce agents that perform well in real-world scenarios, due to the reality gap in simulation-based frameworks and the lack of scalability in emulation-based frameworks. Additionally, existing frameworks often use an unrealistic metric that measures the agents' performance on the training data. NASimEmu, a new framework introduced in this paper, addresses these issues by providing both a simulator and an emulator with a shared interface. This approach allows agents to be trained in simulation and deployed in the emulator, thus verifying the realism of the used abstraction. Our framework promotes the development of general agents that can transfer to novel scenarios unseen during their training. For the simulation part, we adopt an existing simulator NASim and enhance its realism. The emulator is implemented with industry-level tools, such as Vagrant, VirtualBox, and Metasploit. Experiments demonstrate that a simulation-trained agent can be deployed in emulation, and we show how to use the framework to train a general agent that transfers into novel, structurally different scenarios. NASimEmu is available as open-source.

Motivation & Objective

  • Address the reality gap in simulation-based RL training for penetration testing by integrating a high-fidelity emulator with a simulator.
  • Overcome the scalability limitations of emulation-based frameworks by enabling efficient training in simulation while preserving realism for deployment.
  • Promote the development of generalizable agents that can transfer to structurally different, unseen network scenarios.
  • Provide a shared OpenAI Gym interface between simulation and emulation to ensure consistency and seamless deployment.
  • Challenge the common practice of evaluating agents on training-specific networks by enabling evaluation on novel, structurally different scenarios.

Proposed method

  • Enhance the existing NASim simulator with improved realism and abstraction fidelity to align with the emulator's behavior.
  • Implement a full-featured emulator using Vagrant, VirtualBox, and Metasploit to emulate real-world network conditions with actual OS services and vulnerabilities.
  • Design a shared interface between simulator and emulator, translating agent actions (e.g., scan, exploit) into Metasploit commands and reconstructing observations from logs.
  • Introduce a scenario generator that produces random variations in network size, topology, and host configurations to support generalization training.
  • Enable simultaneous training across multiple structurally different scenarios and testing in a separate, unseen scenario set.
  • Support agent deployment from simulation to emulation with a single command, validating the realism of the simulation abstraction.

Experimental results

Research questions

  • RQ1Can an agent trained in simulation successfully transfer to and perform reliably in a realistic emulation environment?
  • RQ2How effective is the framework in training agents that generalize to novel, structurally different network scenarios not seen during training?
  • RQ3To what extent does the shared interface between simulation and emulation preserve behavioral consistency and enable seamless deployment?
  • RQ4How do discrepancies between simulation and emulation (e.g., network instability, exploit failures) affect agent performance, and can agents recover autonomously?
  • RQ5What architectural inductive biases are necessary for agents to learn generalizable penetration strategies across diverse network configurations?

Key findings

  • An agent trained in simulation successfully deployed and performed credibly in the emulator, gaining access to a sensitive host in 17 steps, validating the realism of the simulation abstraction.
  • The agent demonstrated robustness to minor discrepancies between simulation and emulation, such as intermittent network failures and exploit instability, by automatically recovering through repeated actions due to its deterministic policy.
  • The framework successfully enabled training on multiple structurally different scenarios, with the agent learning to infer network structure (e.g., identifying user subnets) and prioritize targets based on service fingerprints (e.g., MySQL indicating sensitive data).
  • The agent correctly identified and exploited a Drupal vulnerability on a Linux host with MySQL, escalated privileges via a kernel exploit, and recovered sensitive information in the emulation environment.
  • The framework’s scenario generator produced diverse network variations in size and configuration, supporting the training of generalizable agents without leaking unrealistic information (e.g., host count) in observations.
  • The shared interface between simulator and emulator allowed seamless translation of any scenario from simulation to emulation with a single command, enabling end-to-end validation of agent behavior.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.