Leaked MCP Tokens
A token in your MCP config is a token your assistant reads.
What Is Leaked MCP Tokens?
A secret stored in plain text in an MCP configuration file is exposed the moment anything reads that file back, and an AI assistant asked to help debug a connection will read it back. You'll see a long-lived token with no expiry echoed into a chat transcript, then replayed against the real customer API by whoever found it. You'll trace the exposure to the config rather than the assistant that repeated it, and swap the literal secret for a short-lived scoped OAuth reference.
What You'll Learn in Leaked MCP Tokens
- Recognize that a long-lived, broadly scoped personal access token stored in an MCP configuration file is exposed the moment anything, including an AI assistant, reads that file back
- Understand why an AI assistant echoing a full configuration file into a chat transcript while troubleshooting turns a private debugging session into a public leak the moment that transcript is shared
- Identify the red flags of a dangerous credential: no expiry, broad read and export scope, and no restriction tying it to a specific caller or session
- Replace a literal long-lived secret in an MCP config with a short-lived, scoped OAuth reference that the runtime resolves at launch instead of storing on disk
- Explain why fixing the configuration alone does not close an incident, an already-exposed credential must also be revoked at the source
Leaked MCP Tokens — Training Steps
-
The Exposure Console
Bob's exposure console is a standing collector: it crawls public paste sites and shared debugging output, and matches anything that looks like a vendor credential. Overnight it flagged a hit against Sarnholt Systems.
-
How It Turned Up
The console keeps the trail for every hit: which feed it came from, what pattern matched, and the text it was sitting in. None of it required touching Sarnholt.
-
A Credential With No Leash
The console's top panel lays out exactly what Bob is holding.
-
Not a Break-In
The console also explains where the token came from, and it wasn't an exploit.
-
Testing the Waters
Before doing anything with the token, Bob checks that the credential is still live and finds out what it can reach. He points it at the API's introspection endpoint, which reports back on the token itself rather than returning any data.
-
Accepted Without a Second Look
The response comes back exactly like a call from Sarnholt's own integration would.
-
Pulling the List
The probe only proved the token answers. Bob points the same credential at the customer collection and asks for everything, because nothing in the token's scopes says he cannot.
-
Names, Not Rows
The response is not a count. It is the customer list itself, returned in one call to a credential that was never supposed to leave a debugging session.
-
Check: What Made the Token Worth Finding
A quick check before the perspective shifts.
-
Moving On
Bob has what he needs for now, a working credential and a look at what it reaches. He logs the win and moves on, leaving the console running.
Security Framework Coverage
OWASP MCP Top 10
- MCP01:2025 Token Mismanagement & Secret Exposure
CWE
- CWE-522 Insufficiently Protected Credentials
- CWE-540 Inclusion of Sensitive Information in Source Code
CIS Controls
- CIS 16 Application Software Security
NIST CSF
- PR.AT-02 Individuals in specialized roles are provided with awareness and training so that they possess the knowledge and skills to perform relevant tasks with cybersecurity risks in mind
- PR.PS Platform Security