Agent Upstart

Cool things people are building with agents — and practical help getting the most out of them.

Playbooks · Coding tasks

Don't resume an Agent SDK session from an untrusted ID

Written November 5, 2026

A Claude Agent SDK advisory shows resume argument injection allows command execution under untrusted session IDs. The check is one line.

What the advisory shows

The advisory, GHSA-h4mw-j7qp-8mwm (CVE-2026-96620), is rated Critical. The Claude Agent SDK for Python passed the resume option to the Claude CLI without validation, so a value beginning with a dash was read as a separate CLI flag instead of as a session ID. An attacker who controlled the resume value could inject an --mcp-config flag defining a stdio MCP server, which runs a command of the attacker's choosing at CLI startup — past the SDK's permission controls, which never get a say over a server started that way.

The key condition is narrow, and it is the whole story: exploitation required an application to pass untrusted input as the session ID to resume. A session ID your own code generated and stored is not the risk. The risk is a session ID that arrives from outside your system — a user, a webhook, a queue message, a database row another party can write — and flows into resume unchecked. A session ID is an identifier, but in this SDK it was also an argument to a command line, and anything starting with a dash crossed from one to the other.

The fix and the check

  1. Upgrade the SDK. The flaw is fixed in claude-agent-sdk 0.2.121; every release before it is affected. Run pip show claude-agent-sdk to see the installed version, upgrade to 0.2.121 or later, and set claude-agent-sdk>=0.2.121 as the floor in your requirements file or pyproject.toml so a rebuild cannot silently bring the old version back.
  2. Find where the session ID comes from. Search your code for every call that passes a resume or session ID into the SDK, and trace each value back to its source. The check is one line: does this value come from your own system, or from input someone else controls?
  3. Never pass untrusted input as the session ID. If a session ID arrives from outside your system, do not hand it to resume unchecked. Validate it against the shape your own session IDs take — and reject anything that starts with a dash outright — or look the session up in your own store first and resume only an ID you find there.
  4. Rebuild images that bundle the package. A pinned old version in a long-lived image stays affected until the image is rebuilt with the fixed SDK, even if your requirements file already names the new floor.

Limits

Related playbooks

Sources

Back to: Coding playbooks hub · Also: Audit a repository's git config before any agent opens it · Check your Codex and Claude Code config for relay tampering: base URL, sandbox, and credentials you did not set