deploy-gate icon indicating copy to clipboard operation
deploy-gate copied to clipboard

Bounty #36: exact-call verification does not bind the destination server/resource

Open cybershang opened this issue 1 month ago • 2 comments

Claim for permission-protocol/deploy-gate#36.

Summary

The signed requestJson.action.resource names the MCP server, but exact-call verification never checks it. hashablePayloadInputHash() covers only { tool, operation, input, metadata: null }, and CallInput has no resource/server field. A valid human-approved receipt for one server therefore verifies for the same tool, operation, and arguments sent to a different server.

This is distinct from #75 (the reference workflow omits --call) and #76 (array/object params collide): this reproduction supplies --call-equivalent input and uses identical arguments. The substituted authorization subject is the server/resource.

Exact locations

  • mcp-guard/src/issuer.ts:69-74 — hashablePayloadInputHash() omits the server/resource.
  • mcp-guard/src/issuer.ts:143-146 — the signed request separately records action.resource from server_label.
  • mcp-guard/src/receipt-verify.ts:137-141 — CallInput has only tool, operation, and input.
  • mcp-guard/src/receipt-verify.ts:209-214 — exact-call verification compares only that resource-less hash; it never compares requestJson.action.resource with the action being authorized.
  • mcp-guard/src/verify-cli.ts:139-146 — the CLI call schema likewise has no server/resource expectation.

Local reproduction

Against permission-protocol/mcp-guard main 91930537639319c9bbe27121ed3775526136da41:

  1. Generate an Ed25519 key and pin its fingerprint.
  2. Use the public Issuer with server_label: "approved-server" to issue a human-approved scoped receipt for deploy with { env: "production", sha: "a1b2c3d4" }.
  3. Verify that artifact with the expected scope and exact-call input for an attempted action on untrusted-server.

Observed output:

{
  "signedResource": "approved-server",
  "attemptedResource": "untrusted-server",
  "signedInputHash": "sha256:6d2372c66b6fd38d64584d0fd4ebe0b86695bd4767a2b33fb5be5612edd1b5bc",
  "valid": true,
  "reasons": []
}

The signature, signed scope, approval, expiry, and arguments are all valid; only the destination server changes. The verifier returns valid: true because its CallInput cannot even represent the destination resource.

Impact

Where multiple MCP servers expose the same tool name, an approval for a safe or test server can be replayed to authorize the same call on a different server, including a production or otherwise more privileged server. This violates the exact-action guarantee without attacking infrastructure or forging a signature.

Suggested fix

Bind the resource into exact-call verification. Add a required resource/server expectation to CallInput and the CLI call contract, parse action.resource from the signed requestJson, and require an exact match. Alternatively, version the input-hash scheme to include the resource and ensure the verifier and issuer use the same server identity. Add a regression test asserting that the reproduction above fails while the originally approved server still passes.

Validation

  • npm ci
  • npm run build
  • npm test — 217 tests, 0 failures
  • local PoC above

If this qualifies under #36, payment details can be provided privately.

cybershang avatar Oct 31 '26 04:10 cybershang

Opened a focused fix with API and CLI regression coverage: permission-protocol/mcp-guard#20. The new test failed before the patch and the full suite now passes 218/218.

cybershang avatar Oct 31 '26 04:10 cybershang