LIVE·The trends shaping tomorrow's world.
Future Tech

AI Model Security and Adversarial Attacks Explained

How adversarial attacks on AI models work, from evasion and data poisoning to model stealing and training-data extraction, and which defenses help.

Adversarial attacks on AI models exploit the fact that models learn statistical patterns from data instead of following explicit rules. An attacker can craft inputs that a model misreads, corrupt the data it learns from, copy its behavior through its API, or coax it into revealing data it was trained on. NIST's taxonomy groups these attacks by the attacker's goal: breaking availability, violating integrity, compromising privacy, or, for generative AI, misuse [1]. No single defense covers all of them, and several defenses trade away some accuracy [1].

This article covers attacks on the model itself. For threats to AI systems that retrieve documents or take actions, see our guides to RAG security and prompt injection and AI agent security and governance.

Why machine learning creates new attack surfaces

Traditional software fails when code has a bug. Machine learning can fail even when the code is perfect, because behavior comes from training data and learned weights. NIST notes that the "statistical, data-based nature of ML systems" opens attack vectors "beyond the threats faced by traditional software systems." These include manipulating training data, crafting adversarial inputs and extracting sensitive information through interaction [1]. It adds that such attacks "have been demonstrated under real-world conditions" and are growing in sophistication [1].

NIST's report, AI 100-2 E2025, published in March 2025, classifies attacks along five dimensions [1]:

  • the type of AI system (predictive or generative);
  • the life cycle stage attacked;
  • the attacker's goals;
  • the attacker's capabilities and access;
  • the attacker's knowledge.

Evasion: adversarial examples

An evasion attack changes an input at inference time so the model gets it wrong. The classic research finding is that neural networks "consistently misclassify adversarial examples." These are inputs altered by small, deliberately worst-case perturbations, which make the model output a wrong answer "with high confidence" [2]. Goodfellow and colleagues argued in 2014 that the cause is largely the models' linear behavior in high dimensions. They also gave a fast method for generating such examples [2].

The stakes are physical as well as digital. NIST cites well-known demonstrations where adversarial perturbations caused stop signs to be misclassified as speed limit signs, and autonomous vehicles to swerve into lanes going the opposite way [1].

Attackers don't always need the model's internals. NIST distinguishes white-box attacks, where the attacker has full knowledge of the system, from black-box attacks, where the attacker knows little or nothing beyond query access. Gray-box attacks sit in between, for example knowing the architecture but not the parameters. NIST also discusses transferability: examples crafted against one model often fool others [1].

Defenses. NIST calls three directions "most promising" [1]:

  • Adversarial training: generating adversarial examples and training on them with correct labels. NIST notes this "usually comes at the cost of decreased model accuracy on clean data" and is computationally expensive.
  • Randomized smoothing: certifying predictions by evaluating the model under noise.
  • Formal verification: proving properties of a network's behavior within bounds.

Poisoning: corrupting what the model learns

Poisoning attacks manipulate training data or the training process. NIST lists several kinds [1]:

  • Availability poisoning degrades the model overall.
  • Targeted poisoning changes predictions on specific inputs.
  • Backdoor poisoning plants a hidden trigger. The model behaves normally until it sees a particular pattern, then produces the attacker's chosen output.
  • Model poisoning corrupts model updates directly, for example in federated learning.

Large models trained on web-scraped data are exposed. In a 2023 paper, Carlini and colleagues showed two practical attacks on web-scale datasets. With "split-view poisoning," an attacker buys expired domains that a dataset's URLs point to, so later downloaders get different content from what the maintainers indexed. The authors showed they could have poisoned 0.01% of the LAION-400M or COYO-700M image datasets "for just $60 USD" [3]. Their second attack, "frontrunning poisoning," targets datasets built from periodic snapshots of crowd-sourced content such as Wikipedia, where an attacker needs only a short window to insert malicious edits before the snapshot is taken [3]. They notified dataset maintainers and recommended low-overhead defenses. One is integrity verification: distributing cryptographic hashes of all content so clients receive the same data the maintainers indexed [3].

Defenses. Data provenance and integrity verification, such as hashing dataset contents at collection time, sanitizing and validating training data, and inspecting trained models for backdoor behavior before deployment [1][3]. NIST notes that differential privacy can also limit poisoning but may lower accuracy [1].

Privacy attacks: making the model leak

A model can reveal information about its training data or about itself. NIST's privacy category includes data reconstruction, memorization, membership inference, property inference and model extraction [1].

  • Membership inference asks whether a specific record was in the training set. A simple method exploits the fact that models have lower loss on data they were trained on [1]. If the training set is sensitive, such as patients with a condition, membership alone is a privacy breach.
  • Training-data extraction recovers actual training examples. Carlini and colleagues extracted "hundreds of verbatim text sequences" from GPT-2. These included names, phone numbers, email addresses, code and 128-bit UUIDs, some of which appeared in only one training document. They found larger models were more vulnerable than smaller ones [4].
  • Model extraction ("model stealing") copies a model's functionality through its prediction API. In 2016, Tramèr and colleagues showed "simple, efficient attacks" that extracted models with near-perfect fidelity. Their targets included logistic regression, neural networks and decision trees, and they demonstrated the attacks against BigML and Amazon Machine Learning [5].

Defenses. Differential privacy during training limits what a model can memorize, at some cost to accuracy [1]. At the API, limiting queries and detecting suspicious query patterns raise the cost of extraction, though NIST warns that motivated, well-resourced attackers can get around them [1]. Tramèr and colleagues studied omitting confidence values as a countermeasure and found it doesn't stop extraction entirely [5]. Researchers have also designed membership inference attacks that need only predicted labels [1].

Supply-chain attacks

Most organizations don't train foundation models. They download pre-trained weights, datasets and libraries, and each is a supply-chain risk. NIST lists supply-chain attacks, including model poisoning delivered through third-party models, as a separate category [1]. OWASP's 2025 list for LLM applications likewise ranks supply chain third, and data and model poisoning fourth [6].

Defenses. NIST points to provenance information for data and models, verifying web downloads against published cryptographic hashes, vulnerability scanning of model artifacts, and research methods for spotting backdoors. It also advises treating models as untrusted components and designing applications to limit the harm from attacker-controlled outputs [1]. In practice, that also means pulling models from trusted sources.

Generative AI adds misuse and prompt injection

For generative models, NIST adds a misuse category: attackers try to get around the restrictions placed on a model's outputs, for example by jailbreaking it past its refusal behavior [1]. NIST's taxonomy lists prompt injection as the attack behind misuse. Prompt injection can also violate availability, integrity and privacy, for example by extracting a system prompt or manipulating an agent's tool calls [1].

NIST separates two forms [1]. In direct prompt injection, the attacker is the user and types instructions meant to override higher-trust ones, such as the system prompt. In indirect prompt injection, the attacker never talks to the application. Instead, they plant instructions in content the model will read, such as a web page or a document retrieved by a RAG system. This works because generative models mix data and instructions in the same channel. OWASP's 2025 Top 10 for LLM applications ranks prompt injection first, followed by sensitive information disclosure [6].

Prompt injection is especially dangerous when a model can read untrusted content or call tools. We cover it in depth in our RAG security and agent security guides. Related failure modes such as AI hallucinations aren't attacks, but attackers can exploit them.

Summary: attacks and defenses

Attack

Stage

Attacker goal (NIST)

Main defenses

Evasion (adversarial examples)

Deployment

Integrity

Adversarial training, randomized smoothing, formal verification

Data or backdoor poisoning

Data and training

Availability or integrity

Provenance and integrity checks, data sanitization, backdoor detection

Membership inference, data extraction

Deployment (queries)

Privacy

Differential privacy, query monitoring

Model extraction

Deployment (queries)

Privacy

Rate limits, query monitoring, limited output detail

Supply-chain compromise

Before training or deployment

Availability or integrity

Trusted sources, signatures and hashes, model scanning

Prompt injection (GenAI)

Deployment

Misuse; also integrity, privacy or availability

Input isolation, least-privilege tools, output filtering

How organizations should approach AI model security

  1. Threat-model each AI system. Who can query it? What data was it trained on? What can its outputs trigger? NIST's dimensions of goals, capabilities and knowledge are a useful checklist [1].
  2. Use shared attack catalogs. MITRE ATLAS is a public knowledge base of adversary tactics, techniques and procedures targeting AI systems, maintained as open data [7]. It helps red teams and defenders use common language.
  3. Secure the data pipeline with provenance, integrity checks and access controls, as for code.
  4. Harden the inference interface with authentication, rate limits and monitoring for probing patterns.
  5. Red-team before and after release, and re-test when models are retrained or fine-tuned.
  6. Accept residual risk explicitly. NIST's report doesn't set acceptable risk levels, because that depends on the application [1]. For high-stakes uses, that may mean keeping a human in the loop.

Model security is also becoming a policy issue. See our coverage of Microsoft, Google and xAI agreeing to give the US government early access to new models for national security testing.

Frequently asked questions

What is an adversarial example?

An input altered slightly, often imperceptibly, so that a machine learning model misclassifies it with high confidence [2]. Examples include images with crafted pixel noise and physical stickers on road signs [1].

Can adversarial attacks be fully prevented?

Not with current techniques. Adversarial training, randomized smoothing and formal verification reduce risk, but NIST describes trade-offs such as lower accuracy on clean data and high computational cost [1].

What is the difference between data poisoning and prompt injection?

Data poisoning corrupts what a model learns during training, so the damage is built into the model [1]. Prompt injection manipulates a generative model at use time, through crafted inputs or instructions hidden in content it reads, without changing its weights [1][6].

Can someone steal an AI model just by using its API?

Researchers have shown it's possible for some model types. Tramèr and colleagues extracted near-equivalent copies of models through public prediction APIs in 2016 [5]. Their paper found that simply omitting confidence scores doesn't fully stop extraction, so rate limits and query monitoring matter too [5].

Do large language models memorize their training data?

They can. Carlini and colleagues extracted verbatim sequences, including personal information, from GPT-2. They found larger models more vulnerable [4]. Differential privacy during training reduces memorization, with an accuracy trade-off [1].

Sources

  1. Apostol Vassilev, Alina Oprea, Alie Fordyce, Hyrum Anderson, Xander Davies and Maia Hamin, NIST, "AI 100-2 E2025, Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations," March 2025. https://csrc.nist.gov/pubs/ai/100/2/e2025/final
  2. Ian J. Goodfellow, Jonathon Shlens and Christian Szegedy, "Explaining and Harnessing Adversarial Examples," arXiv:1412.6572, December 2014 (revised March 2015). https://arxiv.org/abs/1412.6572
  3. Nicholas Carlini et al., "Poisoning Web-Scale Training Datasets is Practical," arXiv:2302.10149, 2023. https://arxiv.org/abs/2302.10149
  4. Nicholas Carlini et al., "Extracting Training Data from Large Language Models," arXiv:2012.07805, 2020. https://arxiv.org/abs/2012.07805
  5. Florian Tramèr et al., "Stealing Machine Learning Models via Prediction APIs," arXiv:1609.02943, September 2016. https://arxiv.org/abs/1609.02943
  6. OWASP GenAI Security Project, "OWASP Top 10 for Large Language Model Applications (2025)." https://genai.owasp.org/llm-top-10/
  7. MITRE, "MITRE ATLAS Data" (repository README). https://github.com/mitre-atlas/atlas-data