/sqli
Detect SQL injection where user input reaches SQL query construction through string concatenation, template literals, or ORM raw query methods.
$ npx -y skills add ByamB4/find-cve-agent --skill sqli --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/sqli
Context preview
The summary Claude sees to decide when to auto-load this skill.
Detect SQL injection where user input reaches SQL query construction through string concatenation, template literals, or ORM raw query methods.
SKILL.md
sqli.SKILL.mdname: sqli
description: "Detect SQL injection where user input reaches SQL query construction through string concatenation, template literals, or ORM raw query methods."
metadata:
filePattern:
- "**/*.js"
- "**/*.ts"
- "**/*.py"
- "**/*.go"
- "**/*.rb"
- "**/*.php"
bashPattern:
- "semgrep.*sqli"
- "grep.*(query|execute|raw|cursor)"
priority: 85SQL Injection Detection
When to Use
Audit database-backed applications, ORM wrappers, query builders, and any code that constructs SQL queries from user input.
Process
Step 1: Find SQL Query Construction
# JavaScript
grep -rn "query(\|execute(\|\.raw(\|\.rawQuery(" .
grep -rn "knex\.raw\|sequelize\.query\|prisma\.\$queryRaw" .
# Python
grep -rn "cursor\.execute\|execute(\|executemany(" .
grep -rn "\.raw(\|RawSQL\|text(" .
grep -rn "f\".*SELECT\|f\".*INSERT\|f\".*UPDATE\|f\".*DELETE" .
# Go
grep -rn "db\.Query\|db\.Exec\|db\.QueryRow\|tx\.Query" .
grep -rn "fmt\.Sprintf.*SELECT\|fmt\.Sprintf.*INSERT" .
# Ruby
grep -rn "find_by_sql\|execute\|select_all\|where.*#\{" .
# PHP
grep -rn "query(\|prepare(\|exec(\|mysql_query\|mysqli_query" .Step 2: Check for String Concatenation/Interpolation
# Template literals in SQL
grep -rn "query.*\`.*\$\{" . --include="*.js" --include="*.ts"
# String concatenation in SQL
grep -rn "SELECT.*\+\|INSERT.*\+\|UPDATE.*\+\|DELETE.*\+" .
# Python f-strings in SQL
grep -rn 'f".*SELECT\|f".*INSERT\|f".*UPDATE\|f".*DELETE' .
# Format strings in SQL
grep -rn "\.format(.*SELECT\|\.format(.*INSERT" .Step 3: Check for Parameterized Queries
Parameterized queries are SAFE:
// SAFE: parameterized
db.query('SELECT * FROM users WHERE id = ?', [userId]);
// UNSAFE: string concatenation
db.query('SELECT * FROM users WHERE id = ' + userId);Step 4: Check ORM Raw Methods
ORMs are generally safe, but `.raw()` / `.query()` methods often bypass protections:
// SAFE: ORM query builder
User.findOne({ where: { id: userId } });
// UNSAFE: raw query with interpolation
sequelize.query(`SELECT * FROM users WHERE id = ${userId}`);Step 5: Check Non-Parameterizable Locations
Some SQL elements CANNOT be parameterized:
- ORDER BY column names
- Table names
- Column names in SELECT
- LIMIT/OFFSET (in some databases)
If user input reaches these, it is SQLi even with prepared statements.
CVSS Guidance
- Data exfiltration (UNION/blind): HIGH 8.1-8.8
- Data modification: HIGH 8.1
- Unauthenticated with admin data access: CRITICAL 9.8
- Authenticated: HIGH 8.8
- ORDER BY injection (limited): MEDIUM 5.3
References
- [Sinks](references/sinks.md) -- SQL query sinks by language
- [False Positive Indicators](references/false-positive-indicators.md)
- [PoC Skeleton](references/poc-skeleton.md)
Read more
name: sqli
description: "Detect SQL injection where user input reaches SQL query construction through string concatenation, template literals, or ORM raw query methods."
metadata:
filePattern:
- "**/*.js"
- "**/*.ts"
- "**/*.py"
- "**/*.go"
- "**/*.rb"
- "**/*.php"
bashPattern:
- "semgrep.*sqli"
- "grep.*(query|execute|raw|cursor)"
priority: 85SQL Injection Detection
When to Use
Audit database-backed applications, ORM wrappers, query builders, and any code that constructs SQL queries from user input.
Process
Step 1: Find SQL Query Construction
# JavaScript
grep -rn "query(\|execute(\|\.raw(\|\.rawQuery(" .
grep -rn "knex\.raw\|sequelize\.query\|prisma\.\$queryRaw" .
# Python
grep -rn "cursor\.execute\|execute(\|executemany(" .
grep -rn "\.raw(\|RawSQL\|text(" .
grep -rn "f\".*SELECT\|f\".*INSERT\|f\".*UPDATE\|f\".*DELETE" .
# Go
grep -rn "db\.Query\|db\.Exec\|db\.QueryRow\|tx\.Query" .
grep -rn "fmt\.Sprintf.*SELECT\|fmt\.Sprintf.*INSERT" .
# Ruby
grep -rn "find_by_sql\|execute\|select_all\|where.*#\{" .
# PHP
grep -rn "query(\|prepare(\|exec(\|mysql_query\|mysqli_query" .Step 2: Check for String Concatenation/Interpolation
# Template literals in SQL
grep -rn "query.*\`.*\$\{" . --include="*.js" --include="*.ts"
# String concatenation in SQL
grep -rn "SELECT.*\+\|INSERT.*\+\|UPDATE.*\+\|DELETE.*\+" .
# Python f-strings in SQL
grep -rn 'f".*SELECT\|f".*INSERT\|f".*UPDATE\|f".*DELETE' .
# Format strings in SQL
grep -rn "\.format(.*SELECT\|\.format(.*INSERT" .Step 3: Check for Parameterized Queries
Parameterized queries are SAFE:
// SAFE: parameterized
db.query('SELECT * FROM users WHERE id = ?', [userId]);
// UNSAFE: string concatenation
db.query('SELECT * FROM users WHERE id = ' + userId);Step 4: Check ORM Raw Methods
ORMs are generally safe, but `.raw()` / `.query()` methods often bypass protections:
// SAFE: ORM query builder
User.findOne({ where: { id: userId } });
// UNSAFE: raw query with interpolation
sequelize.query(`SELECT * FROM users WHERE id = ${userId}`);Step 5: Check Non-Parameterizable Locations
Some SQL elements CANNOT be parameterized:
- ORDER BY column names
- Table names
- Column names in SELECT
- LIMIT/OFFSET (in some databases)
If user input reaches these, it is SQLi even with prepared statements.
CVSS Guidance
- Data exfiltration (UNION/blind): HIGH 8.1-8.8
- Data modification: HIGH 8.1
- Unauthenticated with admin data access: CRITICAL 9.8
- Authenticated: HIGH 8.8
- ORDER BY injection (limited): MEDIUM 5.3
References
- [Sinks](references/sinks.md) -- SQL query sinks by language
- [False Positive Indicators](references/false-positive-indicators.md)
- [PoC Skeleton](references/poc-skeleton.md)
Open Source CVE Hunting Harness for Claude Code A Claude Code plugin that systematically finds real CVEs in open source packages through coordinated multi-agent security research.
Repo: ByamB4/find-cve-agent
Other skills on find-cve-agent.
- /advisory-mining
Mine GitHub Security Advisories and CVE databases for incomplete fixes, finding variant vulnerabilities in patched code or similar patterns in related packages.
Open skill - /auth-bypass
Detect authentication and authorization bypass vulnerabilities including missing auth middleware, JWT algorithm confusion, IDOR, and session fixation.
Open skill - /code-injection-codegen
Detect code injection vulnerabilities in packages that dynamically generate or evaluate code via new Function(), eval(), vm.run*, or template literal interpolation.
Open skill - /command-injection
Detect OS command injection via shell execution sinks where user-controlled input reaches system commands without proper sanitization.
Open skill - /cross-pollination
Cross-pollination multiplier technique: find a vulnerability in one package, then search for the same pattern across all similar packages to multiply findings.
Open skill - /decompression-bomb
Detect decompression bomb vulnerabilities where compressed input can expand to exhaust memory, targeting buffer-based decompression without size limits.
Open skill

