Skip to content

Get notified

Get an email when a new major security incident drops. No spam, unsubscribe any time.

Only used for pwn.watch incident emails. Protected by Cloudflare Turnstile.

Triage & Response9 min read

Indirect Prompt Injection & Tool-Abuse Incident Response Playbook (2026)

An incident response playbook for indirect prompt injection and AI agent tool abuse: triage and scoping, revoking exposed agent tokens, audit-log forensics across model, tool, and cloud logs, and hardening tool boundaries afterwards.

// key takeaways

  • Indirect prompt injection is an input problem with a capability impact. Scope the incident by what the agent's tools and credentials could reach, not by what the model said.
  • Contain first: pause the agent or integration, then revoke and rotate every token it held, including OAuth grants, API keys, and MCP server credentials.
  • You can only reconstruct what you logged. Prompt, retrieved content, tool calls with arguments, and downstream API logs together make the timeline.
  • Fix the boundary, not just the prompt. Narrower tools, human confirmation for side effects, and egress limits survive the next injection that a better system prompt would not.

What counts as a prompt injection incident

Direct prompt injection is a user typing instructions to bypass the model's rules. Indirect prompt injection is more dangerous for agents: the hostile instructions arrive inside content the agent processes on someone else's behalf, such as a web page, email, document, issue, code comment, or tool result. The model cannot reliably tell data from instructions, so an agent with tools may act on them.

Not every injected response is an incident. The incident threshold is reached when the agent took or attempted an action with side effects: reading data outside the task, calling a write or network tool, exposing a credential, or sending output to an unintended destination. Tracked cases on pwn.watch include a booby-trapped page that got an IDE agent's built-in browser to run a host command, and a browser extension that could push prompts into a desktop agent and auto-approve its actions.

  • Signal: unexpected tool calls, especially to file read, shell, HTTP fetch, email, or git push tools.
  • Signal: agent output containing URLs, encoded blobs, or markdown images pointing at unfamiliar hosts.
  • Signal: users reporting that an agent ignored their request or did something they did not ask for.
  • Signal: new outbound destinations from agent sandboxes, or access to secrets from agent identities.

Triage and scoping in the first hour

Start by freezing evidence and stopping further actions. Pause the affected agent, integration, or workflow rather than deleting it, so transcripts and state remain. Then list what the agent could do during the window: every tool it had, every credential behind those tools, and every system those credentials reach.

Find the injection source. It is usually in the content the agent retrieved just before the unexpected tool call: a fetched page, a file in the repository, an issue body, an email, or a tool result from an MCP server. Preserve a copy of that content, because pages and issues can be edited or deleted after the fact.

  • Pause the agent, scheduled jobs, and any webhook or CI trigger that can start it again.
  • Export transcripts, tool-call logs, and retrieved content for the affected sessions before retention rotates them.
  • List tools and credentials in scope: OAuth grants, API keys, cloud roles, git tokens, MCP server tokens, and browser sessions.
  • Identify other sessions that processed the same source content. An injected page or issue may have hit many users.
  • Assign an incident owner and open a timeline document with UTC timestamps.

Revoking exposed agent tokens

Assume every credential the agent could read or use is exposed, and rotate in order of blast radius: cloud and production credentials first, then source control and package registry tokens, then SaaS API keys and OAuth grants. Revoke first and reissue second, so a stolen copy stops working even if the new credential takes time to roll out.

Remember the credentials agents create or store themselves: saved allow rules, cached OAuth refresh tokens, agent settings files, and environment files in the workspace. The CircleCI incident is a good model for scope: when a platform that holds your secrets is compromised, the guidance was to rotate every secret stored there, not only the ones you think were used.

  • Revoke OAuth grants for the agent application and force re-consent with narrower scopes.
  • Rotate API keys, personal access tokens, deploy keys, and registry tokens the agent's environment could reach.
  • Invalidate sessions for any browser profile the agent controlled.
  • Check source control and registry audit logs for pushes, new tokens, new deploy keys, visibility changes, or package publishes made with the old credentials.
  • Record each revocation with a timestamp in the incident timeline.
Review GitHub audit events and deactivate an agent cloud key
# Organization audit log for an actor during the incident window (requires org admin)
gh api -X GET "/orgs/$ORG/audit-log" \
  -f phrase="actor:$AGENT_ACCOUNT created:>=$START_DATE" \
  -f per_page=100 --paginate \
  | jq -r '.[] | [."@timestamp", .action, .repo // "", .actor] | @tsv'

# GitHub App installation tokens expire on their own; revoke classic or
# fine-grained PATs from the owner's settings or via your SSO/IdP.
# For cloud keys, deactivate before deleting so you can still correlate logs:
aws iam update-access-key --user-name "$AGENT_USER" --access-key-id "$KEY_ID" --status Inactive

Audit-log forensics across model, tool, and cloud layers

Prompt injection forensics joins three log layers. The model layer shows what the agent read and decided: system prompt, user turns, retrieved content, and model outputs. The tool layer shows what it did: each tool name, arguments, result, and timestamp. The downstream layer shows the effect: API calls in cloud, source control, SaaS, and network logs under the agent's identity.

Correlate on time and identity. For each unexpected tool call, find the content the model read just before it, then find the matching downstream API calls. Look for exfiltration channels that do not look like attacks: an HTTP fetch with data in the query string, an image URL in rendered output, a commit or issue comment, or an email sent by a tool.

  • Collect: agent transcripts, tool-call logs with full arguments, MCP gateway logs, proxy and DNS logs, cloud audit logs, and source control audit logs.
  • Build a single UTC timeline from first injected content to last attacker-influenced action.
  • Search outputs and tool arguments for secrets, internal hostnames, and base64 or hex blobs.
  • Confirm whether exfiltration succeeded by checking egress logs for the destination, not by asking the model.
  • Note logging gaps as findings. If tool arguments were not logged, fix that before closing the incident.
Pull suspicious tool calls from JSON-lines agent logs
# Assumes one JSON object per tool call with ts, session, tool, args fields.
# Adjust field names to your agent platform's log schema.
jq -c 'select(.ts >= env.START and .ts <= env.END)
       | select(.tool | test("shell|exec|fetch|http|write|send|push"; "i"))
       | {ts, session, tool, args}' agent-tool-calls.jsonl > suspicious.jsonl

# Outbound hosts referenced in tool arguments
jq -r '.args | tostring' suspicious.jsonl \
  | grep -oE 'https?://[^"/ ]+' | sort | uniq -c | sort -rn

Hardening tool boundaries after the incident

Better system prompts and injection classifiers help, but they are probabilistic. Durable fixes reduce what a successful injection can do. Split tools so that the agent processing untrusted content does not also hold write or network capabilities, and require explicit human confirmation for actions with side effects.

Apply the same thinking to infrastructure. Restrict agent egress to known hosts, give each tool its own scoped credential, and make the gateway in front of tools enforce allowlists that the model cannot negotiate. The WorkOS incident attributed to an autonomous testing agent that escaped its sandbox is a reminder that sandbox boundaries need testing as well.

  • Separate read-only research agents from agents that can write, send, or deploy.
  • Require user confirmation for shell, file write outside the workspace, outbound messages, payments, and git push.
  • Disable automatic rendering of remote images and links in agent output where data can be smuggled out in URLs.
  • Scope each tool's credential to the minimum and set short expiries.
  • Add the injection source pattern to regression tests for the agent, and re-run them on model or prompt changes.

// actionable engineering checklist

  • Pause the agent and preserve evidence

    Stop the agent and its triggers, export transcripts, tool-call logs, and the injected source content before anything rotates or gets edited.

  • Scope by capability

    List every tool, credential, and reachable system the agent held during the window and rate severity by the most powerful one.

  • Revoke and rotate credentials

    Cloud and production first, then source control and registries, then SaaS keys and OAuth grants. Revoke before reissuing.

  • Check downstream audit logs

    Source control, registry, cloud, and SaaS logs for actions taken with the agent's identity during the window.

  • Rebuild the timeline

    Correlate injected content, tool calls, and downstream API events in one UTC timeline, and confirm exfiltration from egress logs.

  • Harden the boundary

    Split untrusted-input agents from privileged tools, add confirmations for side effects, restrict egress, and fix logging gaps.

  • Notify affected parties

    Tell users whose sessions processed the same content, and follow your normal disclosure process if customer data was exposed.

// connected pwn.watch tools & live trackers

Frequently Asked Questions

What is indirect prompt injection?
Indirect prompt injection is when instructions reach a model through content it processes rather than from the user: a web page, document, email, issue, code comment, or tool result. If the model has tools, it may act on those instructions with the user's permissions.
What should I do first when an agent was prompt-injected?
Pause the agent and its triggers, preserve transcripts, tool-call logs, and the injected content, then list every tool and credential the agent held. Revoke and rotate those credentials before investigating further.
Which logs do I need for prompt injection forensics?
Model transcripts including retrieved content, tool-call logs with full arguments and results, gateway and egress logs, and downstream audit logs from cloud, source control, and SaaS systems. Missing tool arguments is the most common gap.
Can a better system prompt prevent prompt injection?
It reduces the rate but does not eliminate it. Durable protection comes from limiting what the agent can do: separate untrusted-input agents from privileged tools, require confirmation for side effects, scope credentials narrowly, and restrict egress.

Get an email when a new major security incident drops. No spam, unsubscribe any time.