# Claude Agent SDK session-ID MCP RCE (CVE-2026-96620)

- ID: claude-agent-sdk-cve-2026-96620
- Reported: 2026-10-16
- Researcher: moamenmahmood (HackerOne)
- Organization: Anthropic (advisory) / HackerOne reporter
- AI role: ai_agent_or_mcp_as_target (Agent / MCP as target)
- Confidence in AI involvement: not assessed
- Research / borderline: false
- Last reviewed: 2026-10-20
- Entry page: https://openattacks.ai/attacks/claude-agent-sdk-cve-2026-96620/
- Entry JSON: https://openattacks.ai/api/attacks/claude-agent-sdk-cve-2026-96620.json
- Browse title: Claude Agent SDK session-ID MCP code execution (CVE-2026-96620)
- Editorial summary: Untrusted session IDs starting with '-' were parsed as CLI flags, letting attackers load an MCP server that runs outside SDK permission controls. CVSS 9.2.
- Evidence class (catalog annotation): Vulnerability report
- Source-stated target environments: Agents & MCP
- Stage hunts and conditional defenses: https://openattacks.ai/api/defenses/claude-agent-sdk-cve-2026-96620.json

## Technique
SDK passed untrusted resume session ID to Claude CLI. IDs starting with '-' become CLI flags, enabling --mcp-config with a stdio MCP server that launches at startup outside SDK permission controls. CVSS 9.2.

## Stack relevance (editorial)
Assessment: mapped. Editorial applicability reviewed against the catalog source account; not a scan or independent incident verification.
First action: Update the affected SDK and validate session identifiers before forwarding them to a CLI.
- Relationship: target; tools: claude-agent-sdk; OS scope: not OS-specific / not stated; requires existing MCP connections: false.
  Relevance: The reported session-ID parsing flaw affects the Claude Agent SDK.
  Condition to check: Confirm that the installed version is affected by the historical report; selecting a product does not establish its version or patch status.
  Condition to check: The application must pass attacker-influenced session IDs into the affected CLI invocation.
  Evidence: https://github.com/advisories/GHSA-h4mw-j7qp-8mwm
A product mention alone is not a victim-side applicability mapping. Selection does not verify affected versions, permissions or compromise.

## Initial access
Application must pass untrusted user-controlled session ID into resume

## AI tooling and models
- [claude-agent-sdk](https://github.com/anthropics/claude-agent-sdk-python) \< 0.2.121
- [Claude CLI](https://github.com/anthropics/claude-code)
- stdio MCP

## Other tooling
- unknown

## Victims and sectors
Apps that let users pick/restore agent sessions

## Target geography
- unknown

## Attribution
Vulnerability (not a named campaign)

## Scale and metrics
Fixed in 0.2.121 on 2026-07-17; advisory public 2026-10-16

## Attack flow
Catalog reconstruction of the supplied source account. Unknowns and research caveats are preserved.
### step-1: Application accepts a session ID [access]
An application passes an untrusted resume identifier into the SDK.
Evidence: https://github.com/advisories/GHSA-h4mw-j7qp-8mwm

### step-2: Identifier becomes a CLI flag [execution]
A leading hyphen causes the supplied value to be interpreted as command-line options.
Evidence: https://github.com/advisories/GHSA-h4mw-j7qp-8mwm

### step-3: MCP configuration is injected [ai]
The argument selects a stdio MCP server configuration.
Evidence: https://github.com/advisories/GHSA-h4mw-j7qp-8mwm

### step-4: Server launches outside controls [impact]
The MCP startup command executes outside the SDK permission boundary.
Evidence: https://github.com/advisories/GHSA-h4mw-j7qp-8mwm

Connections:
- step-1 -> step-2
- step-2 -> step-3
- step-3 -> step-4

## Stage defense and hunting recommendations
Editorial recommendations, not validated coverage. Source-controlled query starters are drafts. Custom-schema examples require telemetry collection and field mapping; absence of a mapping means not assessed. MagicSword policy opportunities require managed Windows scope and enforcement.
### step-1: Untrusted content enters an agent session
- Visibility: Application / agent audit records
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/agent-input.sigma.yml
- KQL query download: /api/detections/agent-input.kql
- SPL query download: /api/detections/agent-input.spl
- Hunt hypothesis: An agent ingests external content or an untrusted session identifier before a tool action or configuration change outside the approved task.
- Required telemetry: Input provenance, source type and request/session identifier; Captured tool responses or retrieved content where collection is approved; Subsequent tool calls, configuration changes and approval decisions
- Investigate: Join the ingested input to later actions by session or request ID; preserve the original content as evidence.
- Investigate: Compare the resulting action with the approved task and baseline. Receiving suspicious text alone is not successful injection.
- Limitation: Requires application instrumentation and a custom field mapping. Input exposure does not prove that the model followed instructions, executed a tool or bypassed approval. Avoid collecting sensitive prompt bodies unless authorized.
- Qualification: Capture resume/session identifiers at the application boundary and correlate with later session handling; do not treat every resume request as malicious.
- No direct MagicSword prevention claim is recorded for this stage.

### step-2: Agent trust / configuration changes
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/mcp-config.sigma.yml
- KQL query download: /api/detections/mcp-config.kql
- SPL query download: /api/detections/mcp-config.spl
- Hunt hypothesis: A repository, dependency or agent changes MCP commands, automatic-task settings, tool approval or model-routing configuration before new execution.
- Required telemetry: File changes and before/after content for MCP / IDE configuration; Repository audit / pull-request history; Agent startup and tool-invocation logs
- Investigate: Diff command, args, environment, origin, autoApprove and task settings against the previously approved version.
- Investigate: Correlate the author and change with the next agent launch; inspect path canonicalization and trailing-dot variants where relevant.
- Limitation: A file-write event alone cannot establish what changed. Legitimate setup also changes these files; obtain a diff and authorization context.
- No direct MagicSword prevention claim is recorded for this stage.
- Community intelligence: LOLSkills — https://lolskills.io

### step-3: Agent trust / configuration changes
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/mcp-config.sigma.yml
- KQL query download: /api/detections/mcp-config.kql
- SPL query download: /api/detections/mcp-config.spl
- Hunt hypothesis: A repository, dependency or agent changes MCP commands, automatic-task settings, tool approval or model-routing configuration before new execution.
- Required telemetry: File changes and before/after content for MCP / IDE configuration; Repository audit / pull-request history; Agent startup and tool-invocation logs
- Investigate: Diff command, args, environment, origin, autoApprove and task settings against the previously approved version.
- Investigate: Correlate the author and change with the next agent launch; inspect path canonicalization and trailing-dot variants where relevant.
- Limitation: A file-write event alone cannot establish what changed. Legitimate setup also changes these files; obtain a diff and authorization context.
- No direct MagicSword prevention claim is recorded for this stage.

### step-4: Unexpected agent tool use
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/agent-tools.sigma.yml
- KQL query download: /api/detections/agent-tools.kql
- SPL query download: /api/detections/agent-tools.spl
- Hunt hypothesis: Untrusted content or a changed tool definition precedes a file read, command, or remote call outside the user's intended task.
- Required telemetry: Agent tool-call audit records with session / tool / destination; Tool-definition and approval changes; Endpoint process, file-access and network evidence where available
- Investigate: Join input provenance, tool descriptions and calls by session ID and compare the action to the approved task.
- Investigate: Inspect child processes and destinations; record whether execution was in-process, local, or through a remote SaaS connector.
- Limitation: Process logs cannot recover model intent. Remote connectors and in-process interpreters may produce no local child process. Prompt content alone is not a reliable signature.
- No direct MagicSword prevention claim is recorded for this stage.


## MITRE ATLAS
Mappings are catalog annotations based on described behavior, not assignments or endorsements by MITRE.
- AML.T0081: Modify AI Agent Configuration — Attacker-controlled CLI arguments inject an MCP startup configuration.
  Technique: https://atlas.mitre.org/techniques/AML.T0081
  Evidence: https://github.com/advisories/GHSA-h4mw-j7qp-8mwm

## Defensive notes
Upgrade SDK; validate CLI argv; treat attacker-touchable MCP config as code execution; app control on unexpected MCP-launched binaries

## Sources
- https://github.com/advisories/GHSA-h4mw-j7qp-8mwm
