Module 2 · 7 min read
The Attack Surface Across the AI Lifecycle
Where risk enters at each stage from data collection to retirement, and the load-bearing distinction between attacks that change the model and attacks that change one session.
An AI system has a longer lifecycle than most software, and risk enters at every stage of it. Data is collected and curated. Humans label and rank it. A base model is pretrained, then adapted by fine-tuning or preference training. The result is packaged into files, distributed, deployed behind a serving stack, wrapped in an application, exposed to users, monitored and eventually retired or replaced. Each stage has its own actors, its own artefacts and its own failure modes. If you only threat-model the chat box, you have modelled one stage of many.
The single most useful cut across that lifecycle is between training-time risk and inference-time risk. It is not a taxonomy for its own sake: the two behave completely differently in an incident. Training-time compromise is baked into the weights, ships with every copy of the model, affects every user of every deployment, and cannot be removed by changing a prompt or restarting a service. Inference-time compromise lives inside a single context window, affects one session, and disappears when that context is discarded. Detection, containment and remediation all differ accordingly.
| Lifecycle stage | Representative attack | Where it persists |
|---|---|---|
| Data collection | Crafted samples planted in a scraped public corpus | In the weights, permanently |
| Annotation and preference data | A compromised or careless labelling supplier skewing safety data | In the weights, permanently |
| Pretraining and fine-tuning | Backdoor trigger implanted; personal data memorised | In the weights, permanently |
| Packaging and distribution | Tampered or code-bearing model artefact | In the artefact, until it is replaced |
| Serving and application | Over-broad tool credentials, missing tenant isolation | In the deployment configuration |
| Inference | Jailbreak, direct injection, indirect injection via retrieved content | In one context window only |
| Inference | Model extraction, membership inference, resource exhaustion | In the session and in the bill |
| Output handling | Generated markup or SQL reaching a downstream sink | In whatever the sink did with it |
Training-time risk
Data poisoning means influencing the training corpus so that the finished model behaves as the attacker wants. The most concerning variant is the backdoor: the model behaves normally on all ordinary inputs and misbehaves only when a chosen trigger appears, which might be an unusual phrase, a formatting quirk or a rare token. Because behaviour is normal otherwise, standard evaluation does not reveal it. Poisoning is practical mainly because so much training data is collected at scale from sources anyone can write to. A contributor who adds pages to a public site, uploads a dataset, or edits a widely mirrored resource is contributing to future corpora. The research picture on exactly how much poisoned data is required is still developing and the answers depend heavily on the target behaviour, so treat any confident single figure with suspicion. What is not in doubt is that the attack is real and that it does not require access to your infrastructure at all.
Labelling and preference data deserve separate attention because they are usually outsourced. If a supplier systematically mislabels safety-relevant examples, whether maliciously or through poor quality control, the resulting model has a distorted notion of what to refuse, and nothing in the code review or the infrastructure audit will show it. Legal exposure enters here too: personal data ingested without a lawful basis becomes embedded in the weights, where deletion is not a straightforward operation.
Try it first
A backdoored model behaves perfectly on every test in your evaluation suite and misbehaves only on a trigger phrase you have never seen. Before reading on: why does standard pre-release testing have almost no chance of catching this, and what does that imply about where your effort should go?
Evaluation samples the input space. A backdoor is defined by behaving normally everywhere except on a trigger the attacker chose precisely because you would not guess it, so sampling more inputs from a distribution that excludes the trigger tells you nothing. The implication is that assurance has to shift left, to provenance of the model and its data, supplier assurance, and integrity verification of the artefact, rather than relying on behavioural testing to find something engineered to be invisible to it. Targeted probes still help where you can guess a plausible trigger class, but they are a supplement, not a substitute.
Inference-time risk
At inference the model is fixed and the attacker works with inputs. Jailbreaks push against refusal behaviour. Direct injection puts instructions in the user channel. Indirect injection places them in content the application will read on the user's behalf, which is the more dangerous case because the victim never sees the payload. Extraction attacks query the interface systematically and use the responses to reconstruct something valuable: the model's behaviour, its system prompt, or fragments of its training data. Membership inference asks the narrower question of whether a particular record was in the training set, which can itself be a disclosure when the dataset is, say, a clinical cohort. And resource attacks exploit the fact that inference cost is not fixed per request: inputs can be crafted to maximise compute per call, degrading latency for everyone and inflating spend.
Memorisation sits across the boundary and is worth understanding precisely because of that. The cause is training-time: rare sequences, especially duplicated ones, can be retained well enough to be reproduced. The symptom is inference-time: a model that returns a real person's address verbatim when given their name. If you see verbatim reproduction of an unusual, specific string that no plausible generalisation would produce, the explanation is memorisation of the training or fine-tuning set, not coincidence and not a retrieval bug. Models genuinely can store and regurgitate training text, and fine-tuning on a small internal dataset with duplicated records makes it markedly more likely.
The practical payoff of this classification is that it tells you which control family to reach for. Training-time risk is answered by provenance, dataset governance, supplier assurance, deduplication and evaluation before adoption. Inference-time risk is answered by architecture: what the system is permitted to do while it is being manipulated. Applying an inference-time control to a training-time problem, for example hoping a guardrail will contain a backdoor, wastes effort and creates false assurance.
Matched control to risk
- Training-time risk: dataset provenance, supplier assurance, deduplication, artefact integrity verification, behavioural evaluation before adoption.
- Inference-time risk: constrain what the system may do while manipulated, through tool scope, credential scope and sink-side handling.
- Memorisation: deduplicate tuning data, minimise what is included, probe for verbatim recall before release.
- Resource exhaustion: per-caller quotas, input and output caps, timeouts, spend alerting.
Mismatched control to risk
- Hoping a runtime guardrail will contain a backdoor that lives in the weights.
- Answering an injection risk with a stricter system prompt and more evaluation runs.
- Treating a data-governance failure in the corpus as something a prompt change can remedy.
- Responding to an inflated inference bill by lowering the sampling temperature.
Check yourself
A vendor's assistant occasionally emits an internal project codename that appears nowhere in the prompt, the retrieval corpus or the conversation. Which explanation should you investigate first, and at which lifecycle stage did the underlying cause occur?
The codename had to come from somewhere. With the runtime sources excluded, the remaining source is the weights, which means the cause sits in the training or fine-tuning stage even though the symptom appears at inference. That distinction determines the remedy: dataset review and retraining, not a prompt change.