Compromised AI Agent: Incident Response Playbook
How do you recognize that an agent is compromised?
By its actions, rarely by its messages. An agent hijacked by prompt injection often keeps answering the user politely while it executes something else in the background. The general framework is on our AI agent security page. The signals to watch:
| Signal | Where to see it | Hypothesis to check |
|---|---|---|
| Call to a tool never used before | The agent's action logs | Injected instruction or modified configuration |
| Unusual read volume (exports, customer lists) | Source application logs | Exfiltration attempt |
| Outgoing message or link to an unknown domain | Send logs, outbound proxy | Leak through link, image or webhook |
| Action outside working hours or with no associated human request | Action / conversation correlation | External trigger (email, file, web page) |
| Reply mentioning instructions nobody gave | Conversation history | Trapped content in the context or memory |
| OAuth token used from an unexpected address | Identity provider logs | Stolen secret, see secrets and OAuth |
| Complaint from a customer or colleague | Support, mailbox | Late detection, treat as a confirmed incident |
This list assumes logs exist. Without a trace of what the agent called, with which parameters and for which user, you can neither detect nor bound the incident: see logging AI agent actions. OWASP notes that logging and monitoring do not prevent excessive agency but do limit the damage.
What should you do in the first hour?
Cut the ability to act before trying to understand. The priority is to stop new actions; finding the cause comes after. In order:
- Name an incident lead and open a single, timestamped thread of exchanges.
- Suspend the agent: disable the trigger (the Zap, scenario, webhook, scheduled task) or switch it to read-only. If the platform allows it, cut tool access rather than deleting the agent, so its configuration survives. Some platforms have an emergency path: Zapier's MCP documentation, for example, says that in case of a suspected incident you can ask your account manager to disable MCP access.
- Freeze the evidence before changing anything: export logs, conversation history, memory contents, tool and prompt configuration, model version. An export made after cleanup is unusable.
- Quarantine the triggering content if identified (the email, file, page), without opening it with another agent.
The general frame of incident response is described in NIST SP 800-61 Revision 3 (April 2025), presented as a community profile of the NIST CSF 2.0. It aims to help prepare for, detect, respond to and recover from incidents more efficiently; for an agent, the specific work is linking each step to tool actions.
How do you revoke an agent's access?
By revoking every token and key the agent holds, then checking they no longer work. A compromised agent stays dangerous as long as its credentials are worth something:
- OAuth tokens: revoke them at the provider (Google, Microsoft, CRM) and not only in the agent tool. RFC 7009 states that revoking a refresh token should, if the server supports access token revocation, invalidate access tokens issued from the same grant. If the server does not, those access tokens are not invalidated immediately and keep working until they expire: verify with a test call.
- API keys: regenerate them, update legitimate systems, delete the old ones.
- Service accounts: disable them or remove their roles.
- Secrets in prompts or memory: if any are there, treat them as exposed and change them.
- Shared connections: a personal account connected to the agent exposes that person; change their password and session.
After revocation, check that the agent can no longer do anything (test tool call, expected result: failure) and watch the provider's logs for use of a surviving token.
How do you measure the scope of the incident?
You reconstruct what the agent read, wrote and sent between the first abnormal action and the suspension. Three questions:
- What is the entry point? The first external content read before the deviation: email, file, web page, ticket, channel message.
- What did it touch? Data read (customers, employees), items modified or deleted, messages sent, payments or API calls triggered.
- Did it spread? A shared memory or thread can contaminate other sessions or agents (see multi-agent injection and memory poisoning).
If personal data is involved, legal qualification matters. The CNIL (the French data protection authority) states that a breach presenting a risk to individuals must be notified to it as soon as possible and, if possible, within 72 hours of becoming aware of it, with a supplementary notification possible when missing information arrives; if the 72 hours are exceeded, the reasons must be explained. Where the risk to individuals is high, informing the people concerned is also required (GDPR Article 34). Have your DPO or a lawyer validate the qualification.
How do you communicate during and after?
With dated facts, a clear action and a contact. A useful message to affected customers or partners has five elements: what happened, which data is concerned, what has been done, what they should do (change a password, watch for emails), and whom to contact. Internally, hold regular status updates. If the agent comes from a vendor, notify them: a serious vendor must have a procedure and a contractual deadline (see evaluating an agent before buying). Avoid asserting what you do not know yet, and correct your messages as soon as the facts change.
What should you prepare before an incident happens?
An agent incident goes well when five things already exist: an inventory of agents with their tools and owners, retained and exportable action logs, a written procedure to suspend each agent within five minutes, the list of secrets and connections to revoke, and a named contact for communication and for the DPO. A one-hour tabletop exercise, simulating a trapped email that hijacks the agent, is often enough to reveal the gaps.
How do you bring the agent back and prevent a repeat?
You only turn the agent back on with reduced rights and an understood cause. Before restart:
- Fix the cause: filter the input, remove the excessive tool, restrict parameters, add human approval, see human approval of actions.
- Clean the contaminated memory and index.
- Replay the attack on a copy: the payload that worked must now fail. It is the most useful regression test.
- Restart in stages: read-only first, then limited write, then full scope.
- Document: timeline, cause, decisions, detection and reaction times, planned improvements.
A preventive test avoids learning in production. The Agent Red Team Express (€1,900, 5 days, start within 48 hours after the quote and authorization are signed) looks for these hijack scenarios before they happen, and for several agents or incident-response exercises across a fleet, the Custom Red Team is quoted individually. Tests run on development or staging by default; production is targeted only at the client's written request. The first step is a free 30-minute discovery call.
Does your product ship an AI agent? CleanIssue tests what a stranger can make it do with the Agent Red Team Express (5 days, €1,900), or a custom red team for several agents and MCP servers. First step: a free 30-minute discovery call.
Related articles
Three adjacent analyses to keep exploring the same attack surface.
Logging AI agent actions: audit and incident response
What to trace to audit an AI agent and respond to an incident: events, fields, data to mask, log integrity and a response procedure.
Meta: AI Agent Posts Bad Advice, Sev 1 Incident
In mid-March 2026 a Meta internal agent posted wrong advice without approval; data was exposed for about two hours. Verified facts and controls.
AI Agent Secrets: API Keys, OAuth Tokens, Rotation
API keys and OAuth tokens of an AI agent: what the model must never see, least privilege, rotation, revocation and how to test for leakage.
Sources
Related services
If this topic maps to a real risk in your stack, these are the most relevant CleanIssue audits.