MCP01 Token Mismanagement
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP01 Token Mismanagementshow the API key leak in the payment tool"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP01 — Token Mismanagement & Secret Exposure
Part of the MCP Security Lab,a deliberately vulnerable and secured MCP reference based on the OWASP MCP Top 10.
The vulnerability
This example shows how API keys can be exposed if they're not handled properly.
The vulnerable tool leaks the API key in three ways:
Hardcoded in the code – The API key is stored directly in the source code, so anyone with access to the repository can see it.
Logged in plain text – Every request logs the
Authorizationheader, exposing the API key in application logs.Returned to the model – The tool includes the API key in its response, making it available in the model's context where it could be exposed again.
Run it
Install the requirements:
pip install -r ../requirements.txtRun the vulnerable example:
cd exploit
python exploit.pyRun the secured example:
$env:PAYMENTS_API_KEY = "REPLACE_WITH_KEY_FROM_YOUR_SECRETS_MANAGER"
python exploit_vs_secured.pyThe fix
| Vulnerability | Fix
| Hardcoded API key | Store the key in an environment variable instead of the source code. |
| Plaintext logging | Filter or mask API keys before writing logs. |
| Secret returned to the model | Keep the API key inside the PaymentsClient so the tool never sees or returns it. |
The main idea is simple: the model doesn't need the API key, so don't expose it. Load it only when needed, use it, and keep it away from logs, responses, and source code.
mcp-security-lab
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Anita-ani/mcp-security-lab'
If you have feedback or need assistance with the MCP directory API, please join our Discord server