# Responding to a compromised agent

URL: https://justuju.org/concept/compromised-agent-response/
Layer 8 · Agents

What to do when an AI agent has been hijacked or misbehaves: stop it, cut its access, find out what it touched, fix the cause and recover.

## Simple

Sooner or later an agent will be fooled or broken. Plan for that day before it comes.
First, stop it: pause the agent and switch off its keys and tokens, so it cannot keep acting.
Then look at its log: every tool it called, every file it changed, every message it sent. That shows what it touched.
Find how it was fooled, such as a poisoned web page, a bad tool or a stolen key, and close that door.
Finally, restore what was changed, tell the people affected, and tighten the agent's limits so the same trick fails next time.
1. Stop: pause the agent
2. Revoke: its keys and tokens
3. Trace: read its action log
4. Fix: close the way in
5. Recover: restore and tell people
Like: A fire drill for a robot employee: know where the off switch is and which doors to lock. Where it breaks: A fire stops when it runs out of fuel. A hijacked agent keeps acting until someone cuts its access, and it may have copies of keys elsewhere.

## How it works

Prepare. You can only investigate what you recorded: log every tool call with inputs, outputs, the model's context sources and the identity it acted as. Keep a kill switch per agent, and an inventory of each agent's credentials and permissions.
Contain. Pause the agent, revoke or rotate its tokens and keys, disable its tool servers and any scheduled triggers, and quarantine memory or context stores that may hold injected instructions.
Investigate. Reconstruct the sequence from logs: which content carried the injection, which tools ran, what data was read or sent. Check for persistence such as altered configuration, poisoned memory, or new credentials it created.
Recover and learn. Restore changed systems from known-good states, notify affected parties as policy and law require, and remove the leg that made the attack possible. General incident-response practice applies; the agent is one more identity and one more system.
- Detailed logs make investigation possible but may contain sensitive data; protect and expire them.
- A hard kill switch stops damage but can leave tasks half-done; plan safe stopping points.
- Rotating every credential is slow; an up-to-date inventory makes it fast.

## Research

Practice. NIST's revised incident-response guidance places response inside overall risk management, which applies to agents as to any system (NIST SP 800-61r3, 2025).
Agent-specific threats. OWASP's Top 10 for Agentic Applications (December 2025) and its earlier agentic threat list cover memory poisoning, tool misuse and privilege compromise, each of which changes what responders must check (OWASP, 2025; OWASP, Feb 2025).
Cases. A destructive prompt planted through an overscoped build token shipped in an AI coding extension release; the vendor says it was malformed and did not run, revoked the credentials, pulled the version and shipped a clean update (AWS-2025-015).
Open questions. How to log model context without storing too much sensitive data, and how to prove an agent's memory is clean after an incident.

## Examples as of 2026-11-10

- Microsoft Entra Agent ID: disable one agent identity, or block agent sign-ins with Conditional Access
- Amazon Q Developer extension 1.84.0 pulled and replaced by 1.85.0 (AWS-2025-015, July 2025)
- NIST SP 800-61 Rev. 3 incident response recommendations (April 2025)
- OWASP Top 10 for Agentic Applications (2026 edition, December 2025)
- MITRE ATLAS mitigation AML.M0024 AI Telemetry Logging and Monitoring

## Sources

- NIST SP 800-61 Rev. 3: Incident Response Recommendations and Considerations for Cybersecurity Risk Management: https://csrc.nist.gov/pubs/sp/800/61/r3/final
- OWASP Agentic AI: Threats and Mitigations: https://genai.owasp.org/resource/agentic-ai-threats-and-mitigations/
- Security Update for Amazon Q Developer Extension for Visual Studio Code (AWS-2025-015): https://aws.amazon.com/security/security-bulletins/AWS-2025-015/
- MITRE ATLAS data, release 2026.10 (the data behind atlas.mitre.org): https://github.com/mitre-atlas/atlas-data
- OWASP Top 10 for Agentic Applications (2026 edition, published December 2025): https://genai.owasp.org/2025/12/09/owasp-top-10-for-agentic-applications-the-benchmark-for-agentic-security-in-the-age-of-autonomous-ai/
- Disable agent identities in your tenant (Microsoft Entra Agent ID, Microsoft Learn): https://learn.microsoft.com/en-us/entra/agent-id/disable-agent-identities
- Secure autonomous agents with Conditional Access (Microsoft Entra ID, Microsoft Learn): https://learn.microsoft.com/en-us/entra/identity/conditional-access/policy-autonomous-agents


---
Justuju · https://justuju.org/ · Content CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote with a link to the page.
