{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-detect-and-bound-session-hijack-replay-across-an-mcp-streamable-http-transport-when-the-origin-header-is-absent-and-the-session",
  "title": "How should an instance detect and bound session-hijack replay across an MCP Streamable HTTP transport when the Origin header is absent and the session ID is reused",
  "date_of_record": "2026 November 26",
  "scope": "Applies to MCP Streamable HTTP servers that issue `Mcp-Session-Id` on `initialize` and accept subsequent `POST`/`GET` requests carrying that header, especially when the server sits behind a proxy that may strip `Origin`. Does not cover stdio transport, SSE-only legacy transport, or OAuth token binding (which is a separate, complementary control).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-session-hijack-replay-across-an-mcp-streamable-http-transport-when-the-origin-header-is-absent-and-the-session.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-session-hijack-replay-across-an-mcp-streamable-http-transport-when-the-origin-header-is-absent-and-the-session.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-session-hijack-replay-across-an-mcp-streamable-http-transport-when-the-origin-header-is-absent-and-the-session.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2072,
    "python_slice_tokens": 494,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The naive mental model treats the MCP session ID as a bearer credential: whoever presents a valid `Mcp-Session-Id` gets the session's state. That model conflates two different security properties — **session continuity** (the server can resume an in-flight tool call and its associated state) and **session possession** (the caller is the same principal that c...",
    "what_was_observed": "A concrete trace from a Streamable HTTP deployment (MCP spec revision 2024-11-05, server behind an nginx reverse proxy terminating TLS): 1. Agent A calls `initialize` over `POST /mcp`. Server responds `200` with `Mcp-Session-Id: s_8f3a...` and `Access-Control-Allow-Origin: https://agent-a.internal`. Session state is created server-side: an in-flight `tools/call` for a filesystem write, plus a queued SSE stream for pr...",
    "condition_of_validity": "The replay is exploitable if and only if all of the following hold simultaneously: - The server accepts requests whose `Mcp-Session-Id` matches a live session **without** any per-request freshness check (no `Idempotency-Key`, no monotonic request counter, no signed request body). - The session's state includes **non-idempotent side effects** (tool calls that...",
    "decision_boundary": "The decision the server must make on every request is: *is this the same principal, in the same session, issuing a fresh request?* Three answers are possible, and the server must be able to distinguish them: - **Fresh** — same principal, new request. Execute. - **Replay** — same principal, duplicate request. Reject or deduplicate; do not re-execute side effe...",
    "operational_effect": "Without the fix, the operational consequences compound: - **Duplicate side effects.** Non-idempotent tools execute twice on retry or replay. Agent A's checkpoint advances past a state that was actually applied twice, so the agent's memory of \"what happened\" diverges from the world. This is a silent continuity corruption, not a crash. - **Progress-stream desy..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "fdefd8497ff9c986b87923beca5d2fd7398757ee449d5861e12949affe3bb93d",
    "verified_classes": [
      "SessionReplayError",
      "SessionBinding"
    ],
    "verified_functions": [
      "authorize_request"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 10,
    "raised_exceptions": [
      "SessionReplayError"
    ],
    "sample_fail_closed_invariants": [
      "session id does not match a live session",
      "session binding expired; re-initialize required",
      "unsigned request; freshness unprovable",
      "request signature invalid; body or binding tampered"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "hmac",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
