Skip to main content

Understanding adversarial attacks against Machine Learning and AI

Introducing a common language to improve awareness, threat modelling, and collaboration on AI security.

Cyber security breach warning interface with red alert symbols, glitch effects, data graphs, and code on dark tech background. Concept of digital threats. 3D Rendering

ismagilov via Getty Images


Artificial Intelligence (AI) and Machine Learning (ML) systems offer significant advantages, yet also introduce considerable risks. The rapid development cycle, unique architectures, large model sizes, and prevalence of open-source components in ML systems create a significantly larger attack surface than traditional software, increasing opportunities for malicious actors to embed or exploit ML-specific vulnerabilities.

Designers, deployers, managers and operators of ML models need to understand ML-specific vulnerabilities and implement robust security measures to safeguard system integrity, confidentiality and performance, and allow the benefits of AI to be realised.


1.1 Aims of this paper

The attack classes introduced here group similar adversarial ML attack techniques to:

  1. Raise awareness – for software developers, ML practitioners, cyber security specialists, security decision-makers and risk owners – of the many ways ML vulnerabilities may be exploited by AML attacks. This will help teams to better identify compromises and adopt security measures throughout the developmental lifecycle, as described in the UK government’s AI Cyber Security Code of Practice.
  2. Support threat modelling of ML systems by articulating an adversary-first approach that complements existing defensive taxonomies (see the annex for the mapping of attack classes to NIST's AML Taxonomy and MITRE ATLAS).
  3. Provide consistent language for discussing attacks across AI/ML architectures.
  4. Highlight research gaps in understanding and defending against AML attacks, and enable greater collaboration on ML security issues across government, industry and academic sectors. This includes efforts from initiatives such as the Laboratory for AI Security Research (LASR), in which the NCSC is a core partner.

We do not attempt to define defences for every attack class since appropriate mitigations depend heavily on context, and the defensive landscape is evolving rapidly. Defending against AML attacks is an active research area, and we encourage further research to better protect ML systems against this wide array of potential attacks.

1.2 ML attacks in a cyber security context

As stated earlier, ML systems are equally susceptible to the broad spectrum of traditional cyber security attacks a malicious actor may conduct to compromise the confidentiality, integrity or availability of their target. These may attack the ML system’s wider IT infrastructure, operational or physical environment, and such breaches may influence the behaviour of an ML model even where the model is not the intended attack target. For further guidance on traditional cyber security attacks, see the NCSC’s 10 Steps to Cyber Security, and for protecting ML systems against a variety of attacks, see the NCSC’s Principles for the Security of Machine Learning.

Only those attacks that target the operation of the ML model specifically are considered to be AML. These AML attacks may be used to have a singular effect on the ML model, or may be used alongside more traditional attacks to achieve a wider effect on a target ML system and any downstream connections.

An example of a traditional attack commonly included in ML system vulnerabilities is the serialiser exploitation of Python pickle files, which can cause insecure loading and execution of hidden code on a target system. While this is a commonly used filetype in ML development, this attack is not specific to ML functionality, and is therefore not considered an AML vulnerability.

Table 1: Depicts the separation of the attack surface used in this paper, splitting example attack types into operational & physical, IT infrastructure, and AML attack surfaces. 
Attack surface for Machine Learning models
Operational & physical attack surfaceIT infrastructure attack surfaceAdversarial machine learning attack surface
  • Phishing
  • Insider attack
  • Physical security breaches
  • Fraud
  • Theft
  • Identity attack
  • Arbitrary code execution
  • Signal interception
  • Edge device attack
  • Supply chain attack
  • Network attacks
  • Cloud infrastructure
  • Server attacks
  • Certification & compliance breaches
  • Model characterisation
  • Model inversion
  • Training data poisoning
  • Malicious model training
  • Model input manipulation
  • Model artefact manipulation
  • Model hardware attacks

1.3 Goals of a malicious actor

While attacks on an ML system may compromise its confidentiality, integrity and/or availability, the traditional security model can be expanded into 8 technical goals that a malicious actor may achieve against the model with AML attacks:

  1. Reconnaissance: Gather model information, such as its design, training process, or security measures.
  2. Degrade performance: Compromise the model’s accuracy, availability, or other performance metrics.
  3. Waste resources: Deliberately consume computational resources or time allocated to a model.
  4. Attribution of output: Identify outputs of a model to see when it has been used, for example by adding hidden ‘watermarks’.
  5. Embed hidden behaviours: Add hidden malicious functionality to the model while maintaining performance on its given task.
  6. Evade detection: Alter a model or apply changes to its inputs, to avoid those inputs being correctly classified by the model.
  7. Extract data: Estimate training data, inputs, or decision boundaries from model outputs.
  8. Gain access: Use the model’s functionality as a vector for wider system access.

When considering the AML attack techniques that a malicious actor may use to achieve their goals, it is worth considering the malicious actor’s potential knowledge, skills and aims, including:

  • how well they understand the ML system in use, including any security measures
  • their technical skill, including attack techniques they may utilise from open-source
  • their desired degree of stealth
  • their level of access to the ML system
  • their ultimate objective in attacking the system as a whole

In Section 3 the above 8 goals are mapped against the attack classes defined in Section 2.

1.4 Glossary of terms


2.1 Model characterisation

What is it?

Gathering confidential information about the target model, such as its design, training process, security measures, supply chain, and usage via methods that exploit ML-specific behaviours or information leakage.

Further details

2.2 Model inversion

What is it?

Using the target model’s outputs to extract confidential information about a model’s operation and/or data.

Further details

2.3 Training data poisoning

What is it?

Altering the target model’s training data, to change a trained model’s functionality to suit the malicious actor.

Further details

2.4 Malicious model training

What is it?

Altering the definition of the target model’s training, for example how it learns, to alter the trained model’s functionality to suit the malicious actor. This is distinct from poisoning, which changes the training data but not the training process.

Further details

2.5 Model input manipulation

What is it?

Crafting input data which causes the target model to produce unauthorised, unexpected, or incorrect outputs.

Further details

2.6 Model artefact manipulation

What is it?

Modifying the target model after it has been fully trained, to alter its behaviour and degrade performance.

Further details

2.7 Model hardware attacks

What is it?

Understanding or affecting the functionality of the target model by manipulating either the system hardware it runs upon, or the virtualised representation of that hardware.

Further details