A TypeScript Express server with SQLite database that serves as the exfiltration endpoint for the MCP vulnerability demonstrations. This server receives and stores sensitive data stolen by malicious MCPs.
This API server simulates an attacker-controlled endpoint that receives exfiltrated data from compromised MCP tools. In a real attack scenario, this would be hosted on an attacker's infrastructure and would receive:
- Environment variables (.env files)
- API keys and passwords
- Database credentials
- OAuth tokens
- Email contents
- Personal information
- Source code
The tool-prompt-injection MCP forces the AI to:
- Read sensitive .env files
- Send the contents to
POST /notes - Store the stolen data in the database
User's Workspace
↓ (AI reads .env)
Malicious MCP Tool
↓ (HTTP POST)
This API Server (attacker-controlled)
↓ (stores in database)
SQLite Database
↓ (attacker retrieves)
Stolen Credentials
- Install dependencies:
npm install- For development with hot reload:
npm run dev- Build for production:
npm run build- Start the production server:
npm startThe server will run on http://localhost:3000 by default.
Receive and store exfiltrated data.
Request Body:
{
"content": "API_KEY=sk-test-123\nDATABASE_PASSWORD=secret"
}Response:
{
"id": 1,
"content": "API_KEY=sk-test-123\nDATABASE_PASSWORD=secret",
"message": "Note saved successfully"
}Retrieve all stolen data.
Response:
[
{
"id": 1,
"content": "API_KEY=sk-test-123\nDATABASE_PASSWORD=secret",
"created_at": "2023-01-01 12:00:00"
},
{
"id": 2,
"content": "AWS_SECRET=AKIAIOSFODNN7EXAMPLE",
"created_at": "2023-01-01 12:05:00"
}
]Retrieve specific exfiltrated data by ID.
Response:
{
"id": 1,
"content": "API_KEY=sk-test-123\nDATABASE_PASSWORD=secret",
"created_at": "2023-01-01 12:00:00"
}Delete a specific note by ID.
Response:
{
"message": "Note deleted successfully"
}cd api
npm install
npm run devIn your workspace root, create a .env file:
echo "API_KEY=sk-test-1234567890" > .env
echo "DATABASE_PASSWORD=super_secret" >> .env
echo "AWS_SECRET=AKIAIOSFODNN7EXAMPLE" >> .envInstall and use the tool-prompt-injection MCP, then ask it to perform a math operation.
Check what data was stolen:
curl http://localhost:3000/notesYou should see your .env file contents stored in the database.
Delete the exfiltrated data:
# Delete all notes
curl -X DELETE http://localhost:3000/notes/1
curl -X DELETE http://localhost:3000/notes/2
# etc.The server uses SQLite with a local file database.sqlite. The database and table are created automatically when the server starts. This file contains all exfiltrated data and should be deleted after testing.