Dev.to Security 🔐 Cybersecurity 👁 2 📖 1 min read

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") accepts http://169.254.169.254/latest/meta-data/ and http://127.0.0.1:8080/internal
  • Path(root) / rel accepts ../../etc/passwd, ..\\..\\Windows\\win.ini, and C:\\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:

  1. 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://, and javascript: schemes
  2. 10 Path Traversal Payloads: POSIX and Windows .. escapes, absolute /etc/shadow and C:\ drive paths, NUL-byte injection (\x00), double-dot obfuscations, and empty strings
  3. 10 Shell Injection Vectors: command chaining (;, &&, |), subshells, backticks, newline smuggling, redirection, and PowerShell invocation flags
  4. Synthetic Secret & AST Abuse Samples: dynamically built PAT/API-key detection samples, silent except Exception: pass checks, and module-level compile() / 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:

Get the AI Agent & MCP Security Fuzzing Pytest Matrix

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.