DiffuPac: Contextual Mimicry in Adversarial Packets Generation via Diffusion Model

Abdullah Bin Jasni, Akiko Manada, Kohei Watabe

Introduction

Network Intrusion Detection Systems (NIDS) have become increasingly sophisticated, often leveraging deep learning to spot anomalies in network traffic. To stay ahead, attackers develop "adversarial packets"—malicious data modified just enough to slip past these filters.

However, most current generation models suffer from a significant "knowledge gap." They often assume the attacker has access to the NIDS's internal configurations or can build a perfect surrogate model to test against. In the real world, attackers usually operate in a black-box scenario. Furthermore, many existing methods generate "broken" packets that might fool a classifier but fail to execute the intended attack because they corrupt essential data like the payload or IP headers.

To address these challenges, researchers have introduced DiffuPac, a novel framework that combines the contextual intelligence of BERT with the generative power of Diffusion Models to create stealthy, functional adversarial network packets. By mimicking the patterns of legitimate traffic without requiring prior knowledge of the target detection system, DiffuPac outperforms existing methods while ensuring the malicious packets remain fully executable.

Methodology

DiffuPac operates through a sophisticated three-phase architecture designed to understand and manipulate network traffic at a fundamental level:

  1. Pcap Pre-processing: Raw network traffic (Pcap files) is converted into hexadecimal representations and tokenized using WordPiece, similar to how Natural Language Processing (NLP) models process text.
  2. BERT Pre-training: A BERT model is trained to understand the "grammar" of network traffic. It utilizes two primary tasks: Masked Unidirectional Flow Modeling (predicting missing bytes in a stream) and Same Sequence-origin Prediction (determining if two packets belong to the same directional flow).
  3. Diffusion Fine-tuning: This is the core innovation of DiffuPac. Diffusion models typically work by adding noise to data and then learning to reverse that process. DiffuPac employs:
  4. Contextual Mimicry: It pairs a malicious packet with a contextually relevant benign packet.
  5. Targeted Noising: Instead of noising the entire sequence, noise is applied exclusively to the malicious packet. The model learns to "denoise" this packet so that it blends seamlessly into the context of the benign one.
  6. Model Dictionary: To ensure the attack remains functional, the system uses a dictionary to separate mutable fields (like TTL or window size) from immutable fields (like the payload and 5-tuple info). Only the mutable fields are adjusted to evade detection.
DiffuPac Architecture Overview

Key Insights

  • Context is King: Most adversarial attacks try to modify a packet in isolation. DiffuPac’s breakthrough is realizing that detection systems analyze sequences. By concatenating malicious packets with similar benign ones, the model learns to hide the attack in plain sight.
  • Classifier-Free Evasion: Because the diffusion model learns the distribution of "normalcy" so thoroughly, it doesn't need to "see" the specific NIDS it is trying to fool. It simply generates traffic that looks statistically indistinguishable from legitimate data.
  • The Fragility of DNNs: Evaluations suggest that Deep Neural Networks (DNNs), despite their complexity, are actually more susceptible to these nuanced, context-aware modifications than simpler models like Decision Trees, which possess more rigid, interpretable boundaries.
  • Functionality over Form: By using a Model Dictionary to lock critical fields, the authors solve a major hurdle in adversarial machine learning: the validity problem. The generated outputs are not just mathematical abstractions; they are real, routable packets.

Performance and Results

The researchers evaluated DiffuPac using two gold-standard cybersecurity datasets: the Kitsune Dataset and the CICIDS-2017 Dataset. They tested the generated packets against six different types of classifiers, ranging from traditional Machine Learning (Decision Trees, SVM) to Deep Learning (Multi-Layer Perceptrons).

DiffuPac demonstrated significant improvements in the Malicious traffic Evasion Rate (MER):

  • Superior Performance: It outperformed leading baselines (GAN+PSO and LSTM-based TANTRA) by an average of 6.69 percentage points.
  • Attack-Specific Success: It was particularly effective against sophisticated NIDS. For example, in Botnet attack scenarios using the CICFlowMeter feature extractor, DiffuPac achieved evasion rates roughly 10-15% higher than traditional GAN-based methods.
  • Real-World Validation: Using tools like Wireshark and Metasploit, the authors confirmed that the modified packets for Port Scans and Brute Force attacks successfully reached their targets and executed their malicious intent.
Evasion Rate Performance Comparison

Limitations and Future Work

While highly effective, DiffuPac does face certain limitations:

  • Complexity Variability: The model struggles more with high-volume, highly repetitive attacks like DDoS or Brute Force. These attacks possess distinct, "loud" patterns that even intelligent noising cannot always obscure.
  • Computational Cost: Training BERT and Diffusion models is resource-intensive. Pre-training took approximately 23 hours, and fine-tuning took another 10 hours on an NVIDIA RTX 4090.
  • Ethical Considerations: The authors acknowledge the "dual-use" nature of this research. While it helps defenders build better NIDS, it could be misused by malicious actors. Consequently, the model checkpoints have not been released publicly.

Looking ahead, the team is exploring "Adversarial Purification"—using the same diffusion reverse-process to clean incoming traffic of adversarial perturbations before it reaches the NIDS, turning the attacker's weapon into a defensive shield.

Summary updated

BibTeX
@inproceedings{jasni2024diffupac,
  author = {Abdullah Bin Jasni and Akiko Manada and Kohei Watabe},
  title = {{DiffuPac: Contextual Mimicry in Adversarial Packets Generation via Diffusion Model}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=KYHVBsEHuC},
}
Figure