Fuzz-Testing Local MCP Servers and AI Coding Agents With 32 Concrete Attack Payloads (Zero-Dep Pytest Matrix)
Fuzz-Testing Local MCP Servers and AI Coding Agents With 32 Concrete Attack Payloads (Zero-Dep Pytest Matrix) Unit tests on AI tool servers usually check one happy path and move on. Then an untrusted webpage, prompt in
Fuzz-Testing Local MCP Servers and AI Coding Agents With 32 Concrete Attack Payloads (Zero-Dep Pytest Matrix)
Unit tests on AI tool servers usually check one happy path and move on. Then an untrusted webpage, prompt injection, or malformed argument hits production and slips past naive checks:
-
url.startswith("http")acceptshttp://169.254.169.254/latest/meta-data/andhttp://127.0.0.1:8080/internal -
Path(root) / relaccepts../../etc/passwd,..\\..\\Windows\\win.ini, andC:\\Windows\\System32\\cmd.exe - Unchecked shell argument strings let
;,&&, backticks, or newlines slip through CLI wrappers
Checking "https://example.com" in one unit test misses all 32 edge cases.
A Parameterized Adversarial Matrix You Can Wire Into CI
We extracted the exact attack vectors we test against ZMB's own guards into a zero-dependency package, zmb_safety_matrix, covering:
-
12 SSRF Payloads: loopback IPv4/IPv6 (
127.0.0.1,[::1],0.0.0.0), RFC1918 subnets (10.0.0.1,172.16.0.5,192.168.1.1), cloud metadata IPs (169.254.169.254),file://,gopher://, andjavascript:schemes -
10 Path Traversal Payloads: POSIX and Windows
..escapes, absolute/etc/shadowandC:\drive paths, NUL-byte injection (\x00), double-dot obfuscations, and empty strings -
10 Shell Injection Vectors: command chaining (
;,&&,|), subshells, backticks, newline smuggling, redirection, and PowerShell invocation flags -
Synthetic Secret & AST Abuse Samples: dynamically built PAT/API-key detection samples, silent
except Exception: passchecks, and module-levelcompile()/eval()snippets
Plug your own validator callbacks into run_security_matrix(root, url_fn=..., path_fn=..., arg_fn=...) and assert report["ok"] in pytest or GitHub Actions on every PR.
If you want the complete zmb_safety_matrix package, GitHub Actions workflow template, and remediation cheat sheet for EUR 17:
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.