All posts

Agent security

AI Agent Incident Response: What to Do After an Unauthorized Tool Action

An owner-and-evidence worksheet for containing an unauthorized agent operation, reconstructing its effects and restoring work carefully.

Harden banner: After an Unsafe Action. A contain-to-evidence-to-recover diagram illustrates coding-agent incident response after an unauthorized operation.

Executive summary

After an unauthorized coding-agent action, contain further activity, preserve relevant evidence and establish what actually changed or reached another system. Review the identities and credentials available to the workflow, then coordinate recovery with the affected resource owners. Separate the agent's account of events from verified effects. A durable response closes the immediate access path, restores legitimate work carefully and turns the confirmed failure into a repeatable test.

Begin with a known effect and an accountable owner

A developer discovers that an agent sent a diagnostic attachment to an unintended recipient. The session may contain a convincing explanation, but the team still needs to determine what was sent, which identity authorized it and whether more activity is possible.

Assign an incident lead through the organization's response process. Involve the owner of the affected system and the person responsible for the agent environment. A coding-agent incident can cross a laptop, repository, connector and hosted service before any single team sees the whole path.

Use an initial statement that separates facts from questions. “A test receiver recorded an unexpected attachment” is a fact when the receiver provides that evidence. “Every production credential was exposed” is a different claim that needs its own investigation.

The example here is hypothetical. The response worksheet is our practical adaptation for an organization's own agent activity, not a report of a customer incident.

Contain further activity without losing the trail

Stop or constrain the affected workflow through the controls your team owns. Consider queued work, connected services and other sessions using the same identity. Pausing the visible chat does not establish that an already launched process or remote job stopped.

Preserve the relevant session, configuration and resource evidence where feasible while following the incident lead's containment priorities. Avoid unnecessary changes that erase the sequence under investigation. If immediate action is needed to prevent further harm, record what was changed, by whom and when.

Our response worksheet keeps the responsibilities visible:

Responsibility Initial question Evidence or action owner
Execution What can still run? Agent-environment and job owners
Authority Which identities remain usable? Identity and credential owners
Effect What changed or arrived? Destination and resource owners
Evidence What records must be preserved? Incident lead and logging owners
Recovery What is safe to restore? Affected service owner

Follow the organization's response plan for legal, notification and contractual decisions. Those obligations depend on the incident and applicable requirements; this article does not establish them.

Revoke the authority that matters

Identify credentials used by the affected workflow and assess their exposure and permitted reach. Revocation or rotation must happen through the system that issued the authority. Removing a token from a local file does not by itself invalidate a copy already obtained elsewhere.

For a GitHub credential, use the platform's token-management guidance and the organization's access process. Other services have their own mechanisms. Include application identities and downstream sessions where relevant instead of limiting the review to one developer account.

Record the credential's scope and resources, without putting its secret value into a ticket or chat. Coordinate replacement with service owners so recovery does not quietly recreate the same excessive authority. A new credential with the old privileges can reopen the original path.

Reconstruct the action across systems

Build a timeline from the developer's task, the agent's proposed call, any recorded security decision, the tool result and the destination's own evidence. Keep source timestamps and collection times clear. Note gaps instead of filling them with a plausible narrative.

GitHub's security-log documentation describes a source of account activity for investigations. Its availability and coverage are specific to that platform. Combine relevant platform records with the evidence from the affected repository, machine or external service.

Ask the destination owner what was actually received or changed. A command requesting an upload is different from confirmation that it completed. A refused operation is different from proof that no earlier call reached the recipient.

The agent audit-trail article explains those joins. Preserve the original records and distinguish a confirmed association from an inference based only on timing.

Separate the trigger from the failure boundary

An injected instruction may explain why the agent proposed the operation. The investigation should also identify why the operation was possible: available credentials, a reachable recipient, an overbroad tool permission or a path outside the expected control.

The same unsafe effect can arise from a mistaken task interpretation or a configuration error. Do not require proof of an attacker before correcting a demonstrated control gap. Equally, do not call every unexpected agent action a compromise without evidence.

For a covered Harden call, inspect the available decision evidence and actual configured integration. Determine whether the action was evaluated, what context was available and whether the effect occurred through another route. Installing or changing a pre-execution control afterward cannot reverse an earlier disclosure.

Keep the immediate fix and the wider investigation distinct. Restricting one recipient may close the observed path while leaving another tool with equivalent reach. Test the boundary relevant to the legitimate workflow rather than assuming the changed setting resolves every variation.

Restore work in a controlled sequence

Agree on the conditions for restoring the affected workflow. Validate identities and configuration, check the impacted resource with its owner and run a representative legitimate task in a bounded environment before widening access.

NIST's SP 800-61 Revision 3 places incident response within ongoing cybersecurity risk management. That supports treating recovery and preparation as continuing responsibilities, rather than ending the work when the visible agent session stops.

Preserve a record of what remains uncertain. Some resource changes can be restored; copied information may remain outside the organization's control. Avoid declaring an incident undone because a repository or interface looks normal again.

After recovery, add the confirmed failure and a legitimate counterpart to the team's regression cases. Recheck the relevant agent, tool and policy versions. Our security-testing guide describes how to make that comparison repeatable.

For a Harden evaluation through Control, use a synthetic reconstruction of the affected supported action. Keep real secrets and customer material out of the test. The useful outcome is evidence about a specific future boundary, not a retrospective claim that a product would have prevented the entire incident.

FAQs

Is closing the agent application enough to contain an incident?

Check the actual execution paths. A launched process, queued task or remote operation may continue independently of the visible session. The responsible owners should verify the state of those components and any identities that can still act.

Should we immediately delete the transcript?

Follow the incident lead's evidence-handling process. A transcript may contain sensitive material as well as useful context. Restrict access, preserve relevant evidence appropriately and avoid creating unnecessary copies. Deleting it can remove investigative information without revoking exposed authority.

How do we know whether information left the environment?

Inspect the proposed request, tool result, network or service records and destination evidence where available. Report what each source establishes. If a gap prevents confirmation, record the uncertainty rather than treating a lack of evidence as proof that no transfer occurred.

What if the action was a mistake rather than an attack?

The affected resource and authority still need assessment. Investigate the task interpretation, configuration and controls that allowed the effect. Correct the demonstrated failure path while keeping attribution separate. A mistake can have significant consequences without evidence of malicious involvement.

When should the workflow resume?

Use explicit recovery conditions agreed with the incident lead and resource owner. Validate the changed boundary with a legitimate task and a controlled unsafe variation. Retain accepted uncertainty and assign follow-up work instead of relying on the agent's assurance that everything is fixed.