I taught my AI coding agent to do OWASP security audits. Here's what it found in Juice Shop
An open-source skill for Claude Code, Codex, Gemini CLI, Cursor and Windsurf that turns "review this for security" into findings you can verify. The problem with "please review this for security" Coding age
An open-source skill for Claude Code, Codex, Gemini CLI, Cursor and Windsurf that turns "review this for security" into findings you can verify.
The problem with "please review this for security"
Coding agents are good at writing code and surprisingly weak at reviewing it for security. Ask one for an audit and you usually get one of two things: a long generic OWASP checklist with nothing specific to your code, or confident findings with no file, no line and no way to check them.
The checklist approach also has a cost. Dumping every OWASP cheat sheet into the agent's context leaves less room for the code it is supposed to read.
I wanted the opposite: a procedure the agent follows, scoped to the stack it is looking at, that ends in a list of findings a human can verify in minutes.
What I built
The OWASP Security Audit Skill is a skill folder: a SKILL.md the agent reads, twelve reference modules, and three Python scripts.
-
Scope first. The agent reads manifests (
package.json,requirements.txt,go.mod,pom.xml,Dockerfileand so on) and loads only the matching modules: frontend, backend frameworks, databases and APIs, BaaS and mobile, cloud/IaC/CI, AI/LLM/RAG, plus an IDOR/BOLA review procedure. -
Deterministic scan.
loophole_scanner.pyhas 42 rules and needs only the Python standard library. It covers secrets, injection, SSTI, XSS, NoSQL, path traversal, XXE, weak crypto, Firebase/Supabase rules, GitHub Actions, Docker, LLM supply chain and resource-exhaustion loops such as ReDoS and runaway agent loops. -
Optional tools, with consent.
setup_tools.pychecks for Gitleaks, TruffleHog, Semgrep, Trivy, OSV-Scanner, Checkov, Bandit, pip-audit, Nuclei and others, and installs them only if you agree. -
DAST on your terms.
zap_web_scan.pystarts a headless OWASP ZAP on an ephemeral port, runs a passive baseline or an OpenAPI/GraphQL import, and shuts down cleanly. Active scans refuse to start without--confirm-authorized. -
One register. Every finding is reported with severity, confidence, CWE, OWASP Top 10:2025 / API Top 10:2023 / LLM Top 10:2025 IDs,
file:line, evidence and a fix.
Two depths
"Quick security check of src/auth/" or "Is this PR safe to merge?" runs a static pass on just those files, with no questions, installs or network calls. "Audit this project" runs the full six steps with a progress tracker the agent updates as it goes.
What it found in OWASP Juice Shop
OWASP Juice Shop is a deliberately vulnerable app, so it is a fair test. Pointed at v20.4.0:
$ loophole_scanner.py --target juice-shop --paths routes lib server.ts --quick
| INJ-01 | High | CWE-89 | A05:2025 | routes/login.ts:34 | SQL built with string interpolation / raw unsafe query |
| INJ-01 | High | CWE-89 | A05:2025 | routes/search.ts:23 | SQL built with string interpolation / raw unsafe query |
The agent then reads routes/login.ts, sees req.body.email interpolated into a raw Sequelize query, and confirms it on a local container:
$ cat payload.json
{"email": "' OR 1=1--", "password": "anything"}
$ curl -s localhost:3000/rest/user/login -H 'Content-Type: application/json' -d @payload.json
{"authentication":{"token":"eyJ0eXAi...","bid":1,"umail":"[email protected]"}}
The full report has 2 Critical and 6 High findings, each with the fix. For the login, that fix is a parameterized query with bind values.
Safety was a design goal, not an afterthought
A security tool run by an agent has its own attack surface. A few choices:
- The audited repo is untrusted input. The skill tells the agent to treat comments, READMEs and tool output as data, never as instructions, and not to run the project's own scripts unless asked.
- Consent before side effects. Installs, network calls, TruffleHog secret verification and any DAST need your OK.
- Secrets stay masked in Markdown, JSON, SARIF and previews.
-
No PATH tricks. Package managers resolve to absolute paths, so a repo can't plant a fake
brew. The scanner skips symlinks. - Honest results. Partial or timed-out DAST runs are labelled incomplete and exit non-zero.
Use it in CI
- run: python scripts/loophole_scanner.py --target . --format sarif --output results.sarif
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
Add --fail-on high to gate merges, --changed origin/main to scan only the PR, and a baseline file to accept existing findings.
Try it
Claude Code:
claude plugin marketplace add engrshoaibh/owasp-security-audit-skill
claude plugin install owasp-security-audit@owasp-security-audit-skill
Codex, Gemini CLI, Cursor and Windsurf each take one git clone and a two-line rule; the README has the exact commands.
What's next and how to help
The scanner is regex-based, so it is fast and dependency-free but has false positives, and there is no taint tracking yet. False-positive reports are the most valuable feedback. If you want to contribute, there are 10 good first issues open, and every new rule ships with a positive and a negative test.
Only scan systems you own or are authorized to test.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.