MEng thesis · Cybersecurity
Adversarial Attacks to Evade ML-based Network Intrusion Detection Systems
Machine-learning intrusion detectors score near-perfectly on benchmark traffic. I attacked two of them with white-, gray- and black-box evasion techniques to see how much of that accuracy holds up against an attacker, and how much survives once the attacker is limited to changes a real network would accept.
- Author
- Pantelis Karabetsos
- Degree
- Integrated Master’s (MEng)
- Institution
- University of West Attica
- Date
- Sep 2026
>99%
clean detection
57.8–100%
evasion, unconstrained
45.5–78.6%
evasion, realistic
100%
transfer MLP → RF
01Motivation
Benchmarks don’t fight back
ML-based network intrusion detection systems are usually judged on benchmark datasets, where they routinely report accuracy above 99%. Those numbers assume the traffic is what it is: the attacker doesn't know, or care, that a model is watching.
A real attacker can shape their traffic to look benign. The thesis measures how far that gets them, and whether it still works when the changes have to be ones a real network would carry.
- RQ1How easily can a detector that scores over 99% on clean traffic be evaded?
- RQ2Does evasion survive when the attacker is limited to changes real traffic allows?
- RQ3Do adversarial examples crafted against one model fool a different one?
02Threat model
What the attacker knows
White-box
Full access to the model, including its gradients.
- FGSM
- PGD
Gray-box
Knows the features and data, but not the target model. Crafts examples on a substitute and transfers them.
- MLP → RF
- RF → MLP
Black-box
Can only query the deployed model, seeing either confidence scores or just the final label.
- ZOO
- HopSkipJump
more attacker knowledge
03Setup
Two detectors, four attacks
- Dataset
- CICIDS2017
- Models
- Multilayer Perceptron (MLP), Random Forest
- Clean detection
- Over 99% for both models
- Tooling
- Python, PyTorch, scikit-learn, Adversarial Robustness Toolbox
1 Input
Malicious flow
Labelled attack traffic from CICIDS2017
2 Attack
FGSM · PGD · ZOO · HSJ
Searches for a small change that flips the prediction
3 Perturbed
Adversarial flow
Realistic case: only timing & packet size change
4 Detector
MLP / Random Forest
Same models that score >99% on clean traffic
Result
“benign”
FGSM
White-box, gradient
Fast Gradient Sign Method: a single-step perturbation along the loss gradient.
PGD
White-box, gradient
Projected Gradient Descent: iterative FGSM, projected back into the allowed perturbation set.
ZOO
Black-box, score-based
Zeroth-Order Optimization: estimates gradients from model confidence scores alone.
HopSkipJump
Black-box, decision-based
Walks the decision boundary using only the final label, no scores or gradients.
04Constraints
Feature space vs. the real network
Feature-space attack
Any feature, any value
The attack edits the model's input vector directly. It finds the easiest path across the decision boundary, even if the resulting values describe traffic that could never exist.
Realistic constraints
Timing and packet size only
Perturbations are limited to features an attacker can actually influence on the wire, such as when packets are sent and how large they are, and evaluated through network traffic simulations.
Constraining the attacker removes the easy paths, so each flow needs a larger change to cross the boundary. Try it below: raise the attack budget, then switch to the realistic setting.
Evaded
28%
10 of 36 malicious flows
05Results
How often the attacks got through
Evasion rate by scenario
Share of malicious flows classified as benign. Bars span the lowest to highest rate across attacks.
| Scenario | Condition | Evasion rate |
|---|---|---|
| Unconstrained attacks | Any feature may be perturbed | 57.8–100% |
| Realistic constraints | Only timing and packet-size features | 45.5–78.6% |
| Transfer · MLP → RF | Unconstrained MLP-crafted examples | 100% |
| Transfer · RF → MLP | Reverse direction | 0–39% |
Transferability between models
Adversarial examples crafted against one model (unconstrained), replayed against the other.
MLP
neural network
RF
tree ensemble
Examples built on the neural network carried over completely; examples built on the tree ensemble mostly did not. A defender can't assume one model's robustness says anything about another's.
06Findings
What it means for defenders
- RQ1
Both detectors reached over 99% detection on clean traffic, yet unconstrained attacks evaded them in 57.8–100% of cases.
- RQ2
Restricting the attacker to realistic timing and packet-size changes lowered evasion, but did not eliminate it.
- RQ3
Transferability was strongly asymmetric: examples crafted on the MLP fooled the Random Forest every time, while the reverse stayed at 0–39%.
- →
Robustness should be evaluated across models and under realistic attacker constraints, not against a single detector.
07Cite
Reference this work
@mastersthesis{karabetsos2026adversarial,
author = {Karabetsos, Pantelis},
title = {Adversarial Attacks to Evade ML-based Network Intrusion Detection Systems},
school = {University of West Attica},
type = {Integrated Master's (MEng) thesis},
year = {2026}
}Stack
- PyTorch
- scikit-learn
- Adversarial Robustness Toolbox
- NumPy
- pandas