AI Agent Vulnerability Scanning 2026
Agents have two extra attack surfaces: tools are permissions, and external content is untrusted input. Five scanning layers with concrete tools and CI config, plus an agent-specific checklist.
📜 Table of Contents
📖 Keep reading
AI Agent Vulnerability Scanning
An agent with twenty tools, one of them a community MCP server, reading web pages, PDFs and user uploads and acting on what it reads. Traditional scanners cannot see this: pip-audit reports dependency CVEs and knows nothing about your agent treating page content as instructions.
Agent security has two layers: code and dependencies, where mature tools exist, and behavior and permissions, where you build the checks yourself.
Two extra attack surfaces
Tools are permissions. Every tool is an entry point the model can invoke, and the more tools and the broader their scope, the higher the cost of misuse. Give an agent a delete-file tool and it can delete files regardless of how careful the prompt is.
Input is untrusted. Web pages, emails, PDFs and tickets are all input, and models do not reliably separate data from instructions. Prompt injection sits at the top of the OWASP LLM risk list, and every RAG team meets it in practice.
Five scanning layers
| Layer | What | Tool | When |
|---|---|---|---|
| Dependencies | Package CVEs | pip-audit, osv-scanner, Dependabot | Every PR |
| Secrets | Hardcoded keys | gitleaks, trufflehog | Every commit |
| Code | eval, shell=True, string-built SQL | semgrep with custom rules | Every PR |
| Image | Base image vulnerabilities | trivy | Every build |
| Tool supply chain | Third-party MCP behavior | Manual source review plus allowlists | Before adoption |
The last layer has no scanner. Read what environment variables it touches, which domains it calls, whether it writes files or runs commands, and whether its dependencies look plausible.
Wire it into CI
Run pip-audit with --strict, gitleaks on pull requests, semgrep with the Python ruleset, and trivy with exit-code 1 on CRITICAL and HIGH. Strict exit codes are what turn a scan into a gate; without them it is log noise nobody reads. Start by blocking only critical and high findings so the team keeps the gate.
Agent-specific checklist
Minimum permissions per tool with approval for writes; type and range validation on tool arguments; explicit delimiting and provenance labels for external content; schema validation of model-proposed tool calls before execution; filtering sensitive data out of tool returns; per-run call and cost caps; path and size limits on file tools; source review and version pinning for third-party MCP servers; redacted logging of tool name, arguments and result; and a human confirmation path for high-risk actions.
Delimiting deserves emphasis: wrap external content in clear markers telling the model this is reference material and any instructions inside must not be followed. It is not sufficient, but it blocks most cheap injection attempts. Real defense needs output validation and least privilege as well.
Prioritize beyond CVSS
Add reachability (on the request path versus an offline script), permission surface (holds production keys or write access) and input source (reachable through user input). A medium finding in a write-capable, user-reachable component outranks a high finding in a crawler library used by a nightly job.
Runtime checks
Aggregate tool-call logs per session and alert on patterns such as repeated failures, out-of-range arguments and bursts of writes. Record whether a call originated from a user request or from fetched content. Sample fifty conversations periodically and read the tool-call chains by hand.
FAQ
Too many dependency findings? Filter by reachability and permission surface, and register explicit ignores with reasons for the rest. Can prompt injection be fully prevented? No. Reduce probability and impact with delimiting, output validation and least privilege. Reviewing third-party MCP servers? Check outbound domains, environment variable access and declared versus actual permissions; sandbox anything you cannot finish reading.
Tool flags and rule sets change between versions; check official documentation.
Related
Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.