Evasion attack

On this page 7

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.

ElementMeaningExample
Attack goalTargeted or untargeted misclassificationStop sign read as speed limit
Perturbation budgetMaximum allowed input changeL-infinity norm of 8/255
Attacker knowledgeWhite-box, gray-box or black-box accessOnly API scores available
Domain constraintsChanges must stay valid and functionalMalware still runs after edits
Core elements of an evasion attack

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.

MethodAccess requiredCostNotes
Fast gradient sign methodWhite-box gradientsOne stepQuick but relatively weak
Projected gradient descent attackWhite-box gradientsTens of stepsStandard strong benchmark
Carlini–Wagner attackWhite-box gradientsMany iterationsFinds minimal perturbations
Score-based black-box attacksProbability outputsThousands of queriesEstimates gradients numerically
Decision-based black-box attacksLabels onlyMany thousands of queriesWalks along the boundary
Transfer attacksSimilar substitute modelNo queries to targetRelies on adversarial transferability
Evasion attack families by attacker access

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.

ThreatLife cycle stageWhat the attacker changes
Evasion attackInferenceIndividual inputs
Data poisoningTrainingTraining samples or labels
Model poisoningTraining or supply chainWeights or update contributions
Prompt injectionInference in LLM systemsInstructions hidden in content
Model extractionInferenceNothing; copies behavior via queries
Where evasion sits among attacks on machine learning

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.

DefenseHow it worksMain limitation
Adversarial trainingTrains on PGD-style examplesCostly; often lowers clean accuracy
Randomized smoothingAverages predictions over noisy copiesGuarantees only small radii
Input preprocessingCompresses or denoises inputsAdaptive attacks usually bypass it
Ensembles and diversityCombines differently trained modelsTransfer attacks still succeed often
Monitoring and rate limitsDetects heavy query patternsDoes not stop transfer attacks
Main defenses against evasion 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.