This page lists what the crate does against each attack on an MCP sign-in, and how to report a vulnerability.
| Attack | What the crate does |
|---|---|
| An app pretends to be Claude or ChatGPT | The selected HTTPS callback must be tied to a known client for verification. A known registration using a local callback gets a prompt that shows the claimed name. Unreviewed look-alikes get a cancel warning. Each connection requires approval |
| A stolen authorization code | PKCE S256 is required. Codes work once, live 5 minutes and are bound to the client, callback, challenge, resource and scopes. A second use revokes what the first one got |
| A stolen refresh token | Tokens rotate on every refresh. An old one coming back outside a 2-minute retry window revokes the whole grant |
| A code sent to the wrong place | Callbacks must match a registered one exactly. Errors before the client and callback are trusted never redirect. Dangerous schemes, user names in URLs and .. tricks are refused |
| A token for another server | Each table set serves one MCP resource. Give different resources different table prefixes. Redirects carry iss (RFC 9207) |
| A 401 challenge prompts clients to request privileged scopes | The challenge offers the route's required scopes or the first configured scope, plus offline_access |
| An approval inherits broader scopes | A grant is reused only for the same scope set. Tokens carry the approved scopes |
| Guest access across transports | Guest methods require one JSON-RPC 2.0 message in an application/json POST. The guard handles OPTIONS itself |
| Two account IDs compare as one | String account keys compare byte for byte |
| An older metadata fetch restores a removed callback | A permanent failure or callback removal clears the stored callbacks, including on the first fetch. When versions conflict, the store keeps only callbacks shared by both versions. An empty intersection leaves the registration invalidated |
| A callback is removed while the person approves or before the client exchanges a code | Approval and code exchange check the current callbacks on the writer inside their transactions |
| Cross-site requests and framing | The approval form has a CSRF token, and the page can't be framed or cached. The redirect that carries a code sends no Referer |
| Reaching your network through a metadata URL | Fetching uses HTTPS on 443 only and public addresses only, checked after resolution, with the connection pinned to them. No redirects, proxies or cookies, 5 seconds, 10 KB |
A forged Host header | Every advertised URL comes from APP_URL, never from the request |
DNS rebinding against /mcp | McpAuthenticate refuses browser origins other than APP_URL's and the ones you allow |
| Flooding the endpoints | Per-address limits on authorization (before any fetch), registration, token exchange and revocation. Per-account limits on approvals |
| A database leak | Only SHA-256 digests of 256-bit random tokens are stored |
| Tokens in logs | Debug output redacts credentials, including the Location header of every callback redirect, including denials and other errors |
| A suspended user keeps access | Your can_use hook runs on every request; revoke_all ends every connection |
| Revocation with an old or unrelated token | The endpoint requires the public client ID and a live token issued to that client before it revokes the grant |
| A pending approval disappears during pruning | Unexpired pending approvals keep their client registrations |
| A database outage logging everyone out | A token that can't be checked gets 503, not 401 |
Reporting a vulnerability
Please report it privately through GitHub's private vulnerability reporting, not in a public issue. See SECURITY.md.