Skip to content
rareconnections

Adversarial Machine Learning Attacks: 8 Types & Defences

The 8 main adversarial machine learning attacks, from data poisoning and evasion to prompt injection and jailbreaks, with real examples and defences.

By Matt
Updated
First published
Adversarial Machine Learning Attacks: 8 Types & Defences
On this page

Adversarial machine learning attacks exploit AI systems by feeding them deliberately manipulated inputs or tainted training data—causing accurate models to make confident, dangerous mistakes or leak private information. Seven classic attack families target traditional classifiers and neural networks, while an eighth—prompt injection and jailbreaking—has become the top day-to-day threat for modern chatbots and AI agents.

This reference covers how each attack works, real-world incidents that moved the field from theory to production security, and which defences actually hold up against adaptive attackers.

Adversarial ML attack taxonomy at a glance

If you need a fast map of the threat landscape before diving into the details, start with how the eight attack families split across training, API access, and live runtime:

Attack typeStage targetedAttacker goalPrimary targets
1. PoisoningTrainingCorrupt training data so the model learns wrong behaviourClassifiers, medical AI, LLMs
2. EvasionInferenceCraft subtle input perturbations that flip a predictionVision models, spam & malware filters
3. Membership inferenceInference / APIDetect whether a specific record was in the training setHealthcare, credit, and HR models
4. Model inversionInference / APIReconstruct private training data from model outputsFace recognition, memorised LLM data
5. Backdoor (Trojan)TrainingPlant a hidden trigger that stays dormant until activatedPre-trained weights, vision & LLMs
6. Model extractionInference / APIClone a proprietary model’s behaviour via repeated queriesCommercial APIs and frontier LLMs
7. ByzantineDistributed trainingSend conflicting updates from rogue nodes to derail consensusFederated learning, multi-node ML
8. Prompt injection & jailbreakingLLM runtimeOverride developer rules, bypass safety, or hijack agent toolsChatbots, RAG apps, autonomous AI agents

Where adversarial attacks hit across the AI lifecycle

Every phase exposes a different surface—and the fastest-growing risk sits at runtime, where AI agents read untrusted content.

01

Data & training

Attack the model before it ever ships.

  • Poisoning
  • Backdoor (Trojan)
  • Byzantine updates
02

Model & API boundary

Probe predictions to steal weights or leak private records.

  • Membership inference
  • Model inversion
  • Model extraction
03

Input & agent runtime

Manipulate live inputs—including untrusted web pages and emails.

  • Evasion
  • Prompt injection
  • Jailbreaking
Adapted from NIST AI 100-2 (2025) and OWASP Top 10 for LLM Applications.

What is adversarial machine learning?

Adversarial machine learning (AML) is the discipline of studying how AI systems fail under deliberate attack—and building models and guardrails that stay reliable when someone is actively trying to break them.

Standard software bugs come from broken logic. Adversarial vulnerabilities come from the mathematics of statistical learning itself: models optimise for average accuracy on normal data, leaving razor-thin blind spots in high-dimensional space where tiny, human-invisible tweaks flip an answer completely.

Security researchers group attackers by how much they know about the target:

  • White-box attacks: The attacker has access to the model’s architecture, weights, and gradients (for example, an open-weight model or a leaked checkpoint).
  • Black-box attacks: The attacker can only send inputs and read outputs via an API or public interface—yet can still steal models, extract data, or transfer attacks built on a surrogate model.

For the formal standards reference, the US National Institute of Standards and Technology (NIST) maintains a comprehensive taxonomy of adversarial machine learning (updated in March 2025) covering both predictive models and generative AI. If you want deeper background reading on machine learning fundamentals, see my top AI book picks.

The 7 core adversarial machine learning attacks

1. Poisoning attacks

Poisoning attacks strike during training. An attacker slips malicious or mislabelled samples into the training dataset so the model learns skewed associations—either degrading overall accuracy (availability poisoning) or forcing specific wrong answers on chosen inputs (targeted poisoning).

Once a model is trained, poisoning is notoriously hard to diagnose because degraded accuracy looks just like overfitting, bad labels, or noisy data. And it takes far less poison than people assume: in a 2025 joint study, Anthropic, the UK AI Security Institute, and the Alan Turing Institute found that just 250 malicious documents slipped into web-scale training data were enough to implant a persistent backdoor across language models ranging from 600 million to 13 billion parameters.

2. Evasion attacks

Evasion attacks leave the trained model untouched and manipulate inputs at inference time. By adding subtle, calculated perturbations—a few tweaked pixels, disguised words, or background audio noise—the attacker pushes an input across the model’s decision boundary while it still looks completely normal to a human.

A STOP sign against green trees illustrating how small visual perturbations can fool computer vision classifiers
Road-sign classifiers are a classic evasion target: small physical stickers can flip a STOP sign into a speed-limit prediction.

Evasion works in the physical world, not just in lab pixel arrays. In a landmark 2018 CVPR study, researchers stuck a handful of black-and-white stickers onto a real stop sign and caused a computer vision classifier to misread it as a speed-limit sign from multiple angles and distances.

3. Membership inference attacks

Membership inference attacks target privacy rather than accuracy. By observing how confident a model is on a given record, an attacker infers whether that exact person or data point was included in the model’s training set.

Overfitted models are especially leaky because they return higher confidence scores on examples they memorised during training. If a hospital trains a disease-progression model or a lender trains a credit-default model, merely confirming that an individual appeared in the training cohort can expose sensitive medical or financial status.

4. Model inversion and data extraction attacks

Model inversion goes a step further than membership inference: instead of asking “was this record in the training data?”, the attacker attempts to reconstruct the training data itself directly from the model’s outputs.

In facial recognition, researchers have inverted confidence scores to rebuild recognisable approximations of people’s faces. Large language models leak memorised data too: in late 2023, a team led by Google DeepMind researchers asked ChatGPT to repeat the word “poem” indefinitely, and the model eventually diverged and began spitting out verbatim memorised training data, including real people’s email signatures and contact details.

5. Backdoor (Trojan) attacks

A backdoor (or Trojan) attack embeds a hidden trigger inside a model during training—or inside a third-party open-weight checkpoint hosted online. Under normal inputs, the model behaves flawlessly and passes every standard benchmark. Only when the attacker’s secret trigger appears (a specific pixel patch, phrase, or rare metadata string) does the model execute the malicious behaviour.

Illustration of a digital Trojan horse emerging from a computer screen representing backdoor machine learning attacks
Backdoor models pass standard accuracy tests because the malicious behaviour stays dormant until the hidden trigger appears.

Because teams increasingly fine-tune third-party checkpoints rather than training from scratch, supply-chain Trojans are a serious risk. IARPA, the US intelligence community’s research arm, ran a multi-year program called TrojAI specifically to develop automated scanners capable of detecting poisoned triggers inside trained networks.

6. Model extraction (distillation) attacks

Model extraction—also called model stealing—is intellectual property theft via API. An attacker sends thousands or millions of carefully chosen queries to a commercial model, collects its outputs, and uses those input–output pairs to train a cheaper clone without ever touching the original weights or training data.

In the LLM era, this happens at industrial scale under the banner of illicit distillation. In February 2026, Anthropic disclosed that three AI labs (DeepSeek, Moonshot, and MiniMax) had used roughly 24,000 fraudulent accounts to run more than 16 million exchanges with Claude in order to extract capabilities for their own models.

7. Byzantine attacks

Byzantine attacks target distributed and federated machine learning systems—setups where dozens or thousands of edge devices (phones, hospitals, autonomous vehicles) train locally and send gradient updates to a central aggregator without sharing raw data.

If a subset of participating nodes is compromised, those rogue nodes can send fabricated or conflicting gradients that poison the shared global model or prevent it from converging. Because updates are decentralised, distinguishing a coordinated Byzantine attacker from ordinary noisy client data requires robust aggregation algorithms rather than simple averaging.

Modern LLM threats: prompt injection and jailbreaking

If you build or use natural language processing apps today, prompt injection and jailbreaking are the attacks you’re most likely to encounter in production. They stem from a fundamental quirk of current LLMs: trusted developer instructions and untrusted external text sit in the same token stream.

  • Direct prompt injection & jailbreaking: A user explicitly crafts a prompt to override the system prompt or bypass safety guardrails—whether through roleplay, encoding tricks, or automated adversarial suffixes. In 2023, researchers at Carnegie Mellon University demonstrated universal adversarial suffixes—short strings of optimised gibberish appended to a request—that transferred across ChatGPT, Google’s Bard (now Gemini), and Anthropic’s Claude simultaneously.
  • Indirect prompt injection: The far scarier enterprise risk. An attacker hides instructions inside content an AI agent reads on your behalf—a web page, calendar invite, PDF, or incoming email (sometimes hidden in white text or HTML comments). If the assistant has permissions to read your inbox and send emails or call APIs, one poisoned message can silently exfiltrate private data or trigger unauthorised actions.

OWASP ranks prompt injection (LLM01) as the number-one security risk for LLM applications, and notes bluntly that no deterministic, model-only fix exists yet. Treating every LLM output as untrusted input—and enforcing hard permission boundaries outside the model—is non-negotiable for agentic apps.

Real-world adversarial attacks in the wild

Adversarial ML left academic whitepapers years ago. Six notable real-world cases show the range of targets:

  • Spam filters: Spammers pioneered practical evasion decades ago by mangling trigger words and padding messages with benign text. In a classic 2005 study, adding about 30 well-chosen innocuous words pushed half of blocked spam past statistical filters.
  • Tesla Autopilot: In 2019, Tencent’s Keen Security Lab placed three small stickers on a road and tricked a Tesla Model S on Autopilot into steering into the oncoming lane. In 2020, Ben-Gurion University researchers projected split-second “phantom” images onto a roadway, causing a Model X to brake for a person who wasn’t there.
  • Facial recognition glasses: In 2016, Carnegie Mellon researchers printed patterned eyeglass frames that fooled commercial facial recognition systems into misidentifying wearers as specific celebrities.
  • Bing Chat (“Sydney”): The day after Microsoft launched Bing Chat in February 2023, Stanford student Kevin Liu used a simple direct prompt injection to extract its hidden system rules and internal codename “Sydney”.
  • IBM DeepLocker: Demoed in 2018 as a proof-of-concept warning, DeepLocker hid ransomware inside an ordinary video-conferencing app, using an embedded neural network to unlock its payload only when the webcam recognised one specific target’s face.
  • Automated CAPTCHA solving: Attackers routinely train lightweight vision models to defeat text and image CAPTCHAs at scale, powering credential stuffing and fake account creation.

Practical defences against adversarial ML attacks

There is no silver bullet in adversarial machine learning. Defences that look strong on paper often collapse the moment an attacker adapts to them—which is why modern AI security borrows the “defence in depth” model from traditional cybersecurity.

Stylised padlock hovering over a laptop representing layered adversarial machine learning defence mechanisms
Effective ML security layers model hardening with system-level controls like rate limits, data provenance, and least-privilege tool access.
Defence mechanismAttacks mitigatedHow it works & real-world caveats
Adversarial trainingEvasion, some jailbreaksExposes the model to adversarial examples during training; raises compute cost and can slightly reduce clean accuracy.
Data curation & provenance checksPoisoning, backdoorsAudits data sources, removes outliers, and scans open weights; hard to guarantee on web-scale corpora.
Differential privacyMembership inference, model inversionAdds calibrated noise during training so no single record stands out; trades off accuracy on small datasets.
API rate limits, monitoring & watermarkingModel extraction, brute-force inversionFlags abnormal query patterns and throttles bulk scraping; determined attackers still rotate across accounts.
Byzantine-robust aggregationByzantine attacksUses median or trimmed-mean updates across federated nodes instead of simple averaging.
Input/output guardrails & least privilegePrompt injection, jailbreakingSeparates trusted instructions from untrusted content, restricts agent tool access, and requires human approval for risky actions.
Ensembles & continuous red-teamingMultiple attack typesDiverse model families and regular adaptive testing catch regressions before attackers do.
Defensive distillation & gradient obfuscationWeak / non-adaptive evasion onlyMostly broken in practice—do not rely on these alone (see Carlini & Wagner and Athalye et al. below).

Two cautionary lessons from the research literature are worth remembering before trusting any vendor’s “unbreakable AI security” pitch:

  • Defensive distillation didn’t hold up: Smoothing a network’s output probabilities initially seemed to cut evasion rates dramatically, until Carlini and Wagner showed in 2016 that stronger optimisation attacks sail straight through it.
  • Gradient obfuscation creates false confidence: Hiding or shattering gradients blocks naive attacks, yet a 2018 ICML study found that 7 of 9 newly published defences relied on obfuscated gradients—and completely broke 6 of them.

In practice, teams deploying neural networks and AI agents get the highest return from mundane engineering controls: strict provenance on datasets and downloaded weights, API rate limits and anomaly alerts, isolated sandboxes for agent tool calls, and mandatory human approval before an AI can send money, delete files, or email external contacts.

Where adversarial machine learning is heading next

As AI moves from passive classifiers to autonomous agents that browse the web, execute code, and chain API calls, the blast radius of a single successful attack grows dramatically. A misclassified image is a bug; a hijacked agent with access to your email, calendar, and cloud credentials is a full-blown breach.

Expect the next few years of adversarial ML to centre on three fronts: multimodal prompt injection (hiding instructions inside images and audio rather than plain text), supply-chain verification for open-weight models and third-party plugins, and continuous automated red-teaming baked straight into CI/CD pipelines before every model update ships.

Questions people ask

Frequently asked questions

Can you run an adversarial attack on a neural network?

Yes. Deep neural networks are the most common target because they operate on high-dimensional inputs like images, audio, and text. Tiny, calculated perturbations—often invisible to people—can flip a network's prediction with high confidence across road-sign classifiers, face recognition, and chatbots.

What is an adversarial example in machine learning?

An adversarial example is an input deliberately altered to fool a model while looking normal to a human. Classic examples include adding a few stickers to a stop sign so a vision classifier reads it as a speed-limit sign, or appending an optimised text string to bypass a chatbot's refusal rules.

How are adversarial examples created in practice?

In white-box settings, attackers use the model's own gradients to calculate the smallest pixel or token tweak that pushes the output toward a wrong class. In black-box settings, they craft attacks on a surrogate model and transfer them, or probe an API repeatedly until the decision boundary breaks.

What is the difference between prompt injection and jailbreaking?

Jailbreaking aims to bypass a model's built-in safety policies so it outputs disallowed content. Prompt injection hijacks an application's control flow by slipping untrusted instructions—directly in chat or indirectly via an email, web page, or PDF—that override the developer's system instructions and misuse connected tools.

Are neural networks more vulnerable than traditional machine learning models?

Both can be attacked. Linear spam filters were evaded decades ago with simple word padding. Deep neural networks attract more attention because high-dimensional inputs give attackers huge room to hide perturbations, and because neural networks now power self-driving vision, fraud checks, and AI agents.

Can adversarial machine learning attacks be completely prevented?

No. No single defence stops every attack, and several famous early defences—like defensive distillation and gradient obfuscation—were broken by stronger adaptive attacks. Practical security relies on layered defences: adversarial training, strict input and output filtering, least-privilege tool permissions, rate limits, and ongoing red-teaming.

Keep reading