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
- Upgrade the SDK. The flaw is fixed in
claude-agent-sdk0.2.121; every release before it is affected. Runpip show claude-agent-sdkto see the installed version, upgrade to 0.2.121 or later, and setclaude-agent-sdk>=0.2.121as the floor in your requirements file orpyproject.tomlso a rebuild cannot silently bring the old version back. - Find where the session ID comes from. Search your code for every call that passes a
resumeor 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? - Never pass untrusted input as the session ID. If a session ID arrives from outside your system, do not hand it to
resumeunchecked. 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. - 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
- The advisory covers the Python package,
claude-agent-sdkon PyPI, only. It says nothing about other SDKs or CLIs, and nothing in this page extends the finding to them. - No exploitation in the wild is reported in the advisory, and no exploit is reproduced or described here. The page describes the mechanism the advisory states and the fix it advises — nothing more.
- Upgrading closes this injection path. It does not make untrusted input safe in general: any other place your code builds a command line from outside input needs the same check.
Related playbooks
- Cursor Agent SDK: define an agent as a folder
- Cursor Agent SDK is GA, with 300-repo environments
- OpenAI Python SDK 3.49.0: typed async tools
- OpenAI Node SDK 7.55.0: typed async tools
Sources
- Argument Injection via resume Option Allows Arbitrary Command Execution — GitHub Advisory Database
- claude-agent-sdk 0.2.121 release
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