/penetration-tester:detecting-sql-injection-patternsfrom penetration-tester
Scans source trees for SQL injection vulnerable patterns: string concatenation, f-string interpolation, and deprecated cursor methods across Python, JavaScript, Ruby, Go, and Java codebases.
Ships in penetration-tester. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
SQL injection (CWE-89, OWASP A03:2021) remains one of the highest- impact and most-easily-introduced vulnerability classes. The fix is near-universal: use parameterized queries. The cause when introduced: an engineer concatenates user input into a SQL string because the ORM's parameterization mechanism wasn't obvious, or because they "just need to add a quick condition."
The scanner reads source files and grades each apparent SQL-string construction against the threshold table.
| Finding | Severity | Threshold | Affected control |
|---|---|---|---|
| f-string with SQL keywords + user input | CRITICAL | f"SELECT * FROM users WHERE id = {user_id}" | CWE-89 |
| String concat into SQL keyword string | CRITICAL | "SELECT ... " + var + " ..." | CWE-89 |
| %-format SQL string | HIGH | "SELECT * FROM %s" % table_name | CWE-89 |
.format() into SQL string | HIGH | "SELECT {} FROM users".format(col) | CWE-89 |
cursor.execute(f"...") | CRITICAL | f-string passed directly to cursor.execute | CWE-89 |
sequelize.query with template literal | HIGH | sequelize.query(\SELECT * FROM ${table}`)` | CWE-89 |
| Knex / sequelize raw() with interpolation | HIGH | knex.raw('SELECT * FROM ' + table) | CWE-89 |
Django .extra() with raw SQL | MEDIUM | Model.objects.extra(where=['col = ' + val]) | CWE-89 |
cursor.executemany with string-built query | CRITICAL | Same risk as execute | CWE-89 |
JDBC Statement.execute with concat | HIGH | Java pattern: not PreparedStatement | CWE-89 |
Rails where() with string interpolation | HIGH | User.where("name = '#{name}'") | CWE-89 |
Go db.Query with fmt.Sprintf | HIGH | db.Query(fmt.Sprintf("...", arg)) | CWE-89 |
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-sql-injection-patterns/scripts/scan_sqli.py /path/to/repo
Options:
Usage: scan_sqli.py PATH [OPTIONS]
Options:
--output FILE Write findings to FILE
--format FMT json | jsonl | markdown (default: markdown)
--min-severity SEV (default: info)
--include-tests Include test directories (default: excluded)
--languages LIST Comma-separated: python,javascript,typescript,java,
ruby,go,php,csharp (default: all)
CRITICAL = direct user-input → query string construction. Fix the specific query AND audit nearby code for the same pattern.
HIGH = pattern suggests interpolation but might be a fixed identifier (table/column name). Verify by reading the code.
MEDIUM = framework-specific pattern that's safe ONLY with strict
input validation (Django .extra(), Rails string where()).
For each finding, the fix is the same shape per language: use the
language/library's parameterized-query API. See
references/PLAYBOOK.md for per-language snippets.
Consider running scanning-for-hardcoded-secrets (#10) on the same
target — same audit, different class of finding.
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-sql-injection-patterns/scripts/scan_sqli.py \
--min-severity high $(git diff --name-only main...HEAD | tr '\n' ' ')
Scans only files changed in the current branch — fast feedback for PR review.
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-sql-injection-patterns/scripts/scan_sqli.py \
/path/to/legacy-app --format markdown > sqli-audit.md
Expect dozens to hundreds of findings on a pre-ORM Java/PHP codebase. Prioritize by reachability: the queries reached from public endpoints first.
JSON / JSONL / Markdown. Exit codes: 0 clean, 1 high/critical, 2 error.
f"SELECT * FROM {tablename}" where tablename is hardcoded) →
verify manually. The scanner can't reason about variable
provenance without a full AST + control-flow pass.references/THEORY.md — Per-language interpolation patterns,
ORM-specific safe vs unsafe APIs, why prepared statements workreferences/PLAYBOOK.md — Per-language parameterization snippets
(Python sqlite3 + psycopg + SQLAlchemy, Node mysql2 + pg + knex
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sql-injection, static-analysis, cwe-89, security-audit, code-review
26 skills in this plugin
/analyzing-tls-configAnalyze a target's TLS configuration — negotiated protocol version, cipher
suite, certificate chain, expiry, and downgrade vectors.
Use when: SOC2 auditor flagged your endpoint for "weak TLS" but you don't
know which control failed (TSC CC6.7 transmission integrity vs CC6.6
encryption) or which cipher is the problem.
Threshold: any negotiated TLSv1.0 or TLSv1.1, OR a cipher with RC4 / 3DES /
null / EXPORT, OR a cert with under 30 days to expiry, OR a chain that fails
hostname verification.
Trigger with: "audit tls", "check ssl config", "weak tls", "analyze tls".
/auditing-cors-policyAudit a target's CORS posture — Access-Control-Allow-Origin handling,
reflected-origin bypass, credentials+wildcard mismatch, preflight
OPTIONS behavior, Vary header correctness.
Use when: a third-party integration is failing CORS preflight and
someone proposes "just set Allow-Origin to *" as the fix, OR your
bug-bounty inbox has a credential-reuse exploit chain.
Threshold: any reflection of arbitrary Origin into Allow-Origin,
Allow-Credentials:true with wildcard origin (browser-rejected combo
but server config wrong), missing Vary:Origin on per-origin responses,
preflight cached over 86400s, OR Allow-Origin trust of attacker-
controlled subdomain pattern.
Trigger with: "audit cors", "check cors policy", "cors bypass",
"preflight check".
/auditing-npm-dependenciesAudit a Node.js project's installed npm dependency tree for known
CVEs by wrapping the npm audit JSON output and emitting findings in
the canonical penetration-tester schema. Detects direct AND transitive
vulnerabilities, normalizes npm's severity scale (info/low/moderate/
high/critical) to the shared Severity enum, and parses both v1 and
v2 audit output formats so the skill works against npm 6 and npm
7+ lockfiles.
Use when: pre-merge gate on a Node project, post-incident sweep
after a transitive package compromise (e.g. event-stream, ua-parser,
node-ipc, color.js), SOC2 vendor-management evidence collection,
or auditing an inherited or acquired Node codebase.
Threshold: any HIGH or CRITICAL CVE in the resolved dependency
tree. MODERATE / LOW reported informationally.
Trigger with: "audit npm deps", "npm vulnerability scan", "check
node packages for CVEs", "npm audit".
/auditing-python-dependenciesAudit a Python project's installed dependencies for known CVEs by
wrapping pip-audit (PyPA's official vulnerability auditor) and
emitting findings in the canonical penetration-tester schema.
Detects vulnerable direct AND transitive packages, normalizes
pip-audit's severity output via OSV severity bands, falls back to
pip list --outdated when pip-audit isn't installed, and supports
requirements.txt, pyproject.toml (PEP 621), Pipfile.lock, and
poetry.lock as input sources.
Use when: pre-merge gate on a Python project, post-incident sweep
after a PyPI compromise (e.g. ctx, request-toolbelt typosquats,
ultralytics 8.3.42 compromise), SOC2 evidence collection, or
inheriting an unfamiliar Python codebase.
Threshold: any HIGH or CRITICAL CVE in the resolved dependency
tree. MODERATE / LOW reported informationally.
Trigger with: "audit python deps", "pip vulnerability scan",
"check pypi packages for CVEs", "pip-audit run".
/checking-http-security-headersAudit a target's HTTP security headers — CSP, HSTS, X-Frame-Options,
X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and the
Cross-Origin trio (COOP, COEP, CORP).
Use when: SOC2 / PCI auditor flagged "missing security headers" or a
Mozilla Observatory grade is below B, OR you need HSTS preload
eligibility for chrome://net-internals.
Threshold: any missing required header on production HTML response,
HSTS max-age below 31536000s (preload requirement), CSP with
'unsafe-inline' or 'unsafe-eval', X-Frame-Options absent AND CSP
frame-ancestors absent (clickjacking), Cache-Control allowing public
cache on authenticated endpoint.
Trigger with: "audit security headers", "check csp", "hsts check",
"header posture".
/checking-license-complianceAudit a project's dependency licenses against an explicit policy
(allow-list / deny-list / review-required) and flag incompatibilities
before they ship to production. Reads SPDX license identifiers from
npm package manifests, Python METADATA / PKG-INFO files, and
pyproject.toml; classifies each license by family (permissive,
weak-copyleft, strong-copyleft, proprietary, unknown); detects
copyleft contamination and SPDX-incompatible license combinations.
Use when: pre-release legal review, M&A code-audit due diligence,
preparing an OSS attribution NOTICE file, or switching a project's
own license.
Threshold: any GPL-family license in a project declaring MIT or
Apache-2.0; any UNKNOWN-license package; any metadata-vs-source
license mismatch.
Trigger with: "check licenses", "license compliance audit",
"SPDX scan", "GPL contamination check".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin penetration-testerOther plugins' skills for the same job