sqlmap¶
Bridge an MCP tool call to sqlmap. mcpwn sqlmap materialises a
tools/call invocation as a raw HTTP request file (sqlmap -r) with the chosen argument
marked as an injection point (*), and best-effort negotiates a live Mcp-Session-Id so stateful
servers accept the replayed requests.
HTTP(S) only
sqlmap operates on raw HTTP requests, so this command requires an HTTP(S) MCP server. A stdio target is rejected.
Examples¶
# Write the request file and print the sqlmap command
mcpwn sqlmap http://127.0.0.1:8765/mcp/ lookup_user --inject name -a name=admin
# Run sqlmap directly (must be on PATH), passing extra flags through
mcpwn sqlmap http://host/mcp/ lookup_user -i name --run \
-s --dbms=sqlite -s --technique=BEU
# Send sqlmap's own traffic through Burp too
mcpwn -x http://127.0.0.1:8080 sqlmap http://host/mcp/ lookup_user -i name -a name=admin
Options¶
| Flag | Meaning |
|---|---|
-i, --inject |
(required) Tool argument to mark as the injection point. |
-a key=value |
Other arguments (repeatable); same parsing as call. |
--json '{...}' |
Arguments as a JSON object. |
-o, --out |
Where to write the raw request (default mcpwn_sqlmap.req). |
--session-id |
Provide an Mcp-Session-Id manually instead of negotiating one. |
--no-session |
Do not auto-negotiate a session id. |
--run |
Execute sqlmap (otherwise just print the command). |
-s, --sqlmap-arg |
Extra sqlmap flag, repeatable — e.g. -s --dbms=sqlite. |
The generated request¶
The chosen argument's value gets the injection marker * spliced onto it, so you control exactly
where sqlmap injects:
POST /mcp/ HTTP/1.1
Host: 127.0.0.1:8765
Accept: application/json, text/event-stream
Content-Type: application/json
Connection: close
Mcp-Session-Id: 28f1c7d6...
Content-Length: 119
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"lookup_user","arguments":{"name":"admin*"}}}
How the command is built¶
- Always includes
-r <request file>and--batch. - Adds
--proxy=<proxy>when you pass-x. - If you supply no
-sflags, sensible first-pass defaults are added:--level=2 --risk=2. - Any
-s/--sqlmap-argvalues are appended verbatim.
With --run, sqlmap must be on your PATH (otherwise the command exits 127 and prints the
command for you to run manually). Without --run, the request file is written and the command is
printed — re-run with --run to execute it.
For a full hands-on walkthrough against the bundled server, see the SQL injection guide.