Abstract
Generating synthetic network traffic that accurately reflects real-world user behavior is critical for security testing and network optimization, especially under strict privacy regulations like GDPR. Traditional traffic generators often fail to capture the sequential logic of network activities, producing statistically accurate but behaviorally unrealistic data. This paper presents the Network Traffic Generator (NTG) framework, which treats network flows as a language. By employing clustering and NLP-inspired neural models, NTG successfully generates synthetic traffic that preserves both statistical distributions and the complex sequences of activities inherent in real network captures.
Introduction
In cybersecurity, high-quality network data is essential for validating Intrusion Detection Systems (IDS) and training machine learning models. However, sharing raw packet captures (PCAPs) is often prohibited due to the presence of Personally Identifiable Information (PII). While synthetic traffic generators offer a solution, most current tools focus on packet-level statistics (e.g., size and timing) or specific application protocols, neglecting the sequential nature of user behavior. For instance, an IDS might identify a threat based on a specific order of events—such as a DNS query followed by an encrypted handshake and a large data transfer. If a generator produces these events in a random order, the resulting data is useless for security validation. The NTG framework addresses this by modeling the "behavioral logic" of network traffic.
The NTG Framework
The NTG framework operates through a four-stage pipeline designed to transform raw network data into a generative model of user activity.
- Preprocessing: The system extracts 205 unique features from raw PCAP files, covering layers from basic TCP flags to application-layer details like HTTP cookies and DNS queries.
- Clustering: Using K-means clustering, individual flows are grouped into "activities." This process reduces the vast complexity of raw traffic into a finite "vocabulary" of behaviors. Analysis showed that 100 clusters provide an optimal balance between behavioral precision and model trainability.
- Sequence Modeling: This core stage treats sequences of activities like words in a sentence. The researchers compared traditional Markov Models with Neural Language Models (using embeddings and softmax layers) to predict subsequent activities based on historical context.
- Traffic Generation: The model generates new sequences of activity IDs. To produce a final PCAP, the system samples actual packet data from the corresponding clusters, ensuring realistic timing and structure.
Sequence Modeling Strategies
A key challenge in traffic generation is determining the scope of the sequence. The researchers explored two primary strategies: Global and IP-Based modeling.
As illustrated in the figure above, Global modeling treats the entire network's traffic as a single chronological stream. This approach is highly effective at preserving the overall statistical distribution of features across the network. In contrast, IP-Based modeling extracts sequences for every unique pair of communicating IPs. While this method more accurately captures the specific "conversational" logic between hosts, it introduces more noise and can slightly degrade the global statistical accuracy of the generated traffic.
Evaluation and Key Results
The framework was evaluated using two distinct datasets: the BGU dataset (student lab traffic) and the more complex EMC dataset (enterprise testing lab traffic). Performance was measured using Kolmogorov-Smirnov (KS) tests for feature preservation and n-gram perplexity for sequence accuracy.
- Statistical Fidelity: Depending on the model, 30% to 100% of original statistical features were perfectly preserved. The Global Markov Model was particularly effective, mimicking nearly 100% of features in the BGU dataset.
- Sequence Realism: The Neural Language Model significantly outperformed Markov Models and random sampling. Generated sequences were found to be nearly indistinguishable from original sequences in terms of predictability, proving that NLP techniques can effectively capture network behavioral logic.
Conclusion
The NTG framework demonstrates that treating network traffic as a language allows for the generation of synthetic data that is both privacy-compliant and behaviorally realistic. By preserving the sequence of activities, NTG provides a superior tool for testing security infrastructure. Future work will focus on incorporating more complex neural architectures like LSTMs or Transformers to handle longer-term dependencies and extending the framework to support a wider array of application-layer protocols.
Summary updated