Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Sh Kb Sqli

ASecurity

Knowledge base for finding SQL injection (and query-language injection). Use when hunting SQLi, or when a hunter/reviewer needs sources, sinks, detection queries, payloads, false-positive filters, and remediation for injection into SQL/ORM raw queries. CWE-89, OWASP A03:2021-Injection.

14 stars
0 votes
0 copies
0 views
Added 9/28/2026
ai-agentspythonrustgojavarubyphpsqldjangoawsapi

Works with

cursorcliapi

Security Analysis

A100/100

Scanned 9/28/2026

Install to Claude Code

$npx -y skills add dmdhrumilmistry/security-harness --skill sh-kb-sqli --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sh Kb Sqli?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Sh Kb Sqli
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dmdhrumilmistry-sh-kb-sqli-security-harness/badge)](https://www.skillsdirectory.com/skills/dmdhrumilmistry-sh-kb-sqli-security-harness)

More formats (shields.io, HTML) on the badges page.

Files
SKILL.md
---
name: sh-kb-sqli
description: "Knowledge base for finding SQL injection (and query-language injection). Use when hunting SQLi, or when a hunter/reviewer needs sources, sinks, detection queries, payloads, false-positive filters, and remediation for injection into SQL/ORM raw queries. CWE-89, OWASP A03:2021-Injection."
---

# SQL Injection - Hunter Knowledge Base

SQLi happens when attacker-controlled input is placed into a SQL statement as **code** rather than
**data** - typically string concatenation/interpolation into a query instead of a bound parameter.

## When to hunt this
- Any code that builds SQL from variables: string concatenation, f-strings/template literals, `%`/`+`/`.format`.
- ORM "raw" escape hatches even when the ORM normally parameterizes.
- Dynamic query pieces attackers rarely expect to be bound: table/column names, `ORDER BY`, `LIMIT`,
  `IN (...)` lists, `LIKE` patterns.
- Reachability first: prioritize sinks reachable from an entry point in `codebase-map.json`.

## Sources (untrusted input)
Request params/body/query/headers/cookies, path segments, uploaded content, values from other services,
and anything from the entry-point inventory. Also "stored" sources: DB/file values that were themselves
attacker-influenced (second-order SQLi).

## Sinks by ecosystem (grep targets)
- **Python**: `cursor.execute(`, `cursor.executemany(`, `.execute(` on a DB conn; SQLAlchemy `text(`,
  `.from_statement(`, `session.execute(`, `engine.execute(`; Django `.raw(`, `.extra(`, `RawSQL(`,
  `connection.cursor()`. Danger sign: a `%`, `+`, `f"..."`, or `.format(` inside the SQL string.
- **JS/TS**: `db.query(`, `connection.query(`, `pool.query(`, `sequelize.query(`, `knex.raw(`,
  `.$queryRawUnsafe(` (Prisma), `client.query(`. Template literals with `${...}` inside SQL.
- **Java**: `Statement.execute*(`, `createStatement()` then `executeQuery(concat)`, JPA
  `createQuery`/`createNativeQuery` with string concat, MyBatis `${}` (vs safe `#{}`).
- **PHP**: `mysqli_query(`, `$pdo->query(`, `->exec(` with concatenation; `mysql_query(`.
- **Go**: `db.Query(`/`db.Exec(`/`QueryRow(` where the query string is built with `fmt.Sprintf`/`+`.
- **Ruby**: `where("... #{}")`, `find_by_sql(`, `exec_query(`, `.where(user_str)`.
- **.NET**: `SqlCommand(concat)`, `ExecuteReader` with interpolated string; EF `FromSqlRaw(`.

## Detection recipe (see references/graft-guide.md)
1. `graft grep "execute\(|\.query\(|raw\(|createNativeQuery|FromSqlRaw" --json` (or Grep).
2. For each hit, inspect the query argument: is it a bound-parameter call (safe) or string building (suspect)?
   Grep the same lines for `%|\+|\$\{|f\"|\.format\(|#\{|Sprintf|concat`.
3. `graft callers <enclosing-fn>` to reach an entry point; record the `data_flow[]` source->sink.
4. Confirm no whitelist/cast/parameterization intervenes.

## Payloads / PoC templates (curated)
- Detection: `'` , `''` , `1' OR '1'='1` , `1) OR (1=1` , `admin'--` , `" OR ""="`.
- Boolean-blind: `1 AND 1=1` vs `1 AND 1=2` (differing responses).
- Time-blind: `1; WAITFOR DELAY '0:0:5'--` (MSSQL), `1 AND SLEEP(5)` (MySQL), `1; SELECT pg_sleep(5)--` (PG).
- UNION: `1 UNION SELECT NULL,version(),NULL--` (adjust column count/types).
- Error-based: `1 AND extractvalue(1,concat(0x7e,version()))` (MySQL).
- Second-order: store `x'--` via one endpoint, trigger the vulnerable query via another.
See `references/cheatsheet.md` for per-DB detail and `ORDER BY`/`LIKE`/`IN` injection variants.

## False-positive filters (do NOT flag)
- Fully **parameterized** queries: `execute("... WHERE id = %s", [id])`, `?`/`:name` placeholders,
  Prisma `$queryRaw` tagged template (safe) vs `$queryRawUnsafe` (unsafe), MyBatis `#{}` (safe).
- The interpolated value is a **constant/enum/int-cast** the attacker cannot control, or is validated
  against an allowlist (e.g. sort column checked against a fixed set).
- ORM query builders (`.filter(User.id==id)`, `.where({id})`) that bind under the hood.
- Identifiers quoted via a proper quoting API (e.g. `psycopg2.sql.Identifier`).

## CWE / OWASP / severity
- CWE-89 (SQLi), CWE-943 (NoSQL/query injection). OWASP **A03:2021-Injection**.
- Severity: usually **critical** if unauthenticated and dumps/modifies data; **high** if authenticated
  or limited. Blind-only with narrow impact may be high/medium.

## Chaining hints
- SQLi -> read credential/secret tables -> auth bypass / account takeover.
- SQLi write -> stored XSS or config poisoning.
- SQLi -> read files (`LOAD_FILE`, `COPY ... FROM PROGRAM`) -> RCE on some DBs; -> SSRF via DB features.
- Feeds chains with `secrets`, `auth`, `access-control`.

## Mitigation (put a specific one on each finding)
Use parameterized queries / prepared statements for values; for identifiers use an allowlist or the
driver's identifier-quoting API; least-privilege DB accounts; ORM safe APIs. Never concatenate input into SQL.

Attribution

dmdhrumilmistrydmdhrumilmistry
View sourceMore from dmdhrumilmistry →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

1074701 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

695601 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

691 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →