An evasion attack is an attack on a deployed machine learning model in which an adversary modifies inputs at inference time so that the model produces a wrong output, while the training data and model parameters remain untouched. In AI security, evasion is the most studied attack class and the practical setting in which adversarial examples are used against real systems.
Typical goals include getting malware past a classifier, slipping spam through a filter or making a vision system ignore an object. The defining feature is timing: unlike data poisoning, which corrupts learning, evasion exploits a model that is already trained.
How an evasion attack exploits a trained model
An evasion attack searches for a small, constrained change to an input that pushes it across the model’s decision boundary. Machine learning models generalize from finite data, so their boundaries are often close to legitimate inputs in directions humans do not notice. The attacker solves an optimization problem: maximize the model’s error, subject to a limit on how much the input may change.
The limit is usually expressed as a perturbation budget under a norm. For images, an L-infinity budget of 8/255 per pixel is a common benchmark value; for malware, the constraint is that the file must still execute and keep its malicious function. The attack may be untargeted, aiming for any wrong label, or targeted, aiming for a specific label chosen by the attacker.
| Element | Meaning | Example |
|---|---|---|
| Attack goal | Targeted or untargeted misclassification | Stop sign read as speed limit |
| Perturbation budget | Maximum allowed input change | L-infinity norm of 8/255 |
| Attacker knowledge | White-box, gray-box or black-box access | Only API scores available |
| Domain constraints | Changes must stay valid and functional | Malware still runs after edits |
Attack methods and access levels
The method an attacker can use depends mainly on how much access to the model is available. With full access to gradients, the search is fast and precise; with only output labels, the attacker needs many queries or a substitute model. The table compares the main families.
| Method | Access required | Cost | Notes |
|---|---|---|---|
| Fast gradient sign method | White-box gradients | One step | Quick but relatively weak |
| Projected gradient descent attack | White-box gradients | Tens of steps | Standard strong benchmark |
| Carlini–Wagner attack | White-box gradients | Many iterations | Finds minimal perturbations |
| Score-based black-box attacks | Probability outputs | Thousands of queries | Estimates gradients numerically |
| Decision-based black-box attacks | Labels only | Many thousands of queries | Walks along the boundary |
| Transfer attacks | Similar substitute model | No queries to target | Relies on adversarial transferability |
Adversarial transferability is what makes black-box evasion practical: perturbations crafted on one model often fool another model trained for the same task, so an attacker can work offline and submit only the final input.
Evasion compared with other AI security threats
Evasion is defined by when the attacker acts and what is changed. Placing it next to related threats helps defenders choose the right controls, because each threat targets a different stage of the machine learning life cycle.
| Threat | Life cycle stage | What the attacker changes |
|---|---|---|
| Evasion attack | Inference | Individual inputs |
| Data poisoning | Training | Training samples or labels |
| Model poisoning | Training or supply chain | Weights or update contributions |
| Prompt injection | Inference in LLM systems | Instructions hidden in content |
| Model extraction | Inference | Nothing; copies behavior via queries |
Some taxonomies, including NIST AI 100-2 and MITRE ATLAS, treat jailbreaks of language models as a form of evasion, because a crafted prompt bypasses a safety classifier at inference time. The underlying principle is identical: inputs are shaped to land on the wrong side of a learned boundary.
Physical and real-world evasion
Evasion is not limited to digital pixels. A physical adversarial attack places printed patterns, stickers or clothing in the scene so that a camera-based model misreads it from many angles and distances. Researchers have shown adversarial patches that hide people from object detectors and stickers that alter road sign classification.
Outside vision, evasion has a long history in security classifiers. Spammers alter wording to defeat filters, and malware authors add benign code sections or rename imports to lower detection scores. In these domains the attacker faces hard functional constraints, which makes attacks harder to automate but also means many defenses evaluated only on images do not transfer.
Defenses and their limits
No single defense removes evasion risk, and many early defenses were later broken. The most reliable general approach is adversarial training, in which the model learns from attacked examples, while certified robustness methods such as randomized smoothing provide provable guarantees within a fixed budget. The table summarizes common options.
| Defense | How it works | Main limitation |
|---|---|---|
| Adversarial training | Trains on PGD-style examples | Costly; often lowers clean accuracy |
| Randomized smoothing | Averages predictions over noisy copies | Guarantees only small radii |
| Input preprocessing | Compresses or denoises inputs | Adaptive attacks usually bypass it |
| Ensembles and diversity | Combines differently trained models | Transfer attacks still succeed often |
| Monitoring and rate limits | Detects heavy query patterns | Does not stop transfer attacks |
A critical warning concerns gradient masking: defenses that hide or distort gradients make white-box attacks fail in testing while leaving the model just as vulnerable. Robustness claims should be tested with adaptive attacks designed for the specific defense, using tools such as the Adversarial Robustness Toolbox.
In everyday language
An evasion attack tricks an AI system that is already in use. The attacker does not break into the system. Instead, they carefully change what they show it. The change is often too small for a person to notice.
It is like a forged banknote made to pass a vending machine. The machine checks certain features, and the forger copies just those features. People might spot the fake, but the machine accepts it. The core lesson is that AI models can be fooled by inputs built to exploit their blind spots.
Seen in the real world
A security vendor uses a machine learning malware classifier that scores executable files from 0 to 1, blocking anything above 0.7. An attacker group obtains a free version of the product and runs it locally, submitting variants of its ransomware thousands of times.
By appending harmless text strings copied from popular games and adding an unused section full of benign code, the group lowers the score of a fully working sample to 0.31 without changing its behavior. The file passes the classifier on customer machines for several days.
The vendor responds by retraining with adversarially modified samples, adding features that ignore appended data, and combining the model with behavioral detection at runtime. The incident shows why a single learned detector should never be the only barrier against motivated attackers.