Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

SQL Injection Manual

Complete hands-on guide from beginner to expert level. This 22-chapter curriculum provides comprehensive coverage of SQL injection vulnerabilities across MySQL, PostgreSQL, MSSQL, Oracle, and SQLite.

What You Will Learn

  • Detection & Fundamentals - Systematic approaches to identify injection points through error messages, boolean logic, and time-based delays.

  • Data Extraction - Master UNION-based extraction, blind injection with binary search optimization, schema enumeration, and efficient dumping techniques for large datasets.

  • Defense Evasion - Advanced WAF bypass techniques including case variation, comment injection, double URL encoding, hex concatenation, REVERSE() function obfuscation, and cutting-edge JSON SQL operator bypasses (@>, <@, JSON_EXTRACT) that exploit parser mismatches.

  • Modern Attack Vectors - Exploit JSON APIs, XML/SOAP services, HTTP headers, cookies, JWT KID parameters, GraphQL resolvers, and ORM frameworks (Hibernate, Django, Sequelize).

  • Specialized Techniques - Second-order stored injection, HTTP Parameter Pollution, heavy query DoS attacks, polyglot XSS+SQLi payloads, multibyte encoding bypasses (GBK, Big5, Shift-JIS), and NoSQL injection (MongoDB, Redis, Cassandra, Elasticsearch).

  • System Compromise - File system operations, privilege escalation, and OS command execution via database functions.

Each chapter includes real-world scenarios, database-specific syntax, exploitation workflows, detection checklists, and defensive mitigation strategies. The cheat sheet provides quick reference for all payloads across database types.

Quick Navigation

OrderFileTopicLevelKey Skills
1Guide/01-Introduction.mdSQL Injection FundamentalsBeginnerUnderstanding vulnerability, basic payloads, prevention
2Guide/02-Detection-Methods.mdFinding Injection PointsBeginnerReconnaissance, testing methodology, tool usage
3Guide/03-Basic-Exploitation.mdError & Boolean ExploitationBeginnerError-based extraction, blind boolean, time-based
4Guide/04-Union-Injection.mdUnion-Based Data ExtractionIntermediateColumn enumeration, UNION SELECT, concatenation
5Guide/05-Database-Fingerprinting.mdDB IdentificationIntermediateVersion detection, syntax differences, capabilities
6Guide/06-Schema-Enumeration.mdDatabase MappingAdvancedSystem tables, column extraction, blind enumeration
7Guide/07-Data-Extraction.mdEfficient Data DumpingAdvancedGROUP_CONCAT, chunked extraction, optimization
8Guide/08-Blind-Injection.mdAdvanced Blind TechniquesIntermediateBinary search, automation, OOB extraction
9Guide/09-Filter-Evasion.mdWAF Bypass TechniquesExpertEncoding, comments, keyword alternatives, tampering
10Guide/10-Advanced-Techniques.mdStacked Queries & File OpsExpertMulti-statement execution, file read/write, privilege escalation
11Guide/11-OS-Command-Execution.mdShell Access via SQLiExpertUDF, xp_cmdshell, COPY TO PROGRAM, reverse shells
12Guide/12-Second-Order-Injection.mdStored Injection AttacksExpertDelayed execution, storage-based attacks, admin exploitation
13Guide/13-Alternative-Context-Injection.mdJSON, XML, Header InjectionExpertModern API contexts, HTTP headers, cookies
14Guide/14-HTTP-Parameter-Pollution.mdHPP AttacksExpertDuplicate parameter exploitation, framework bypass
15Guide/15-Heavy-Query-DoS.mdResource ExhaustionExpertCPU/memory/disk exhaustion, DoS via SQL
16Guide/16-JWT-SQL-Injection.mdJWT InjectionExpertKID parameter SQL injection, signature bypass
17Guide/17-GraphQL-SQL-Injection.mdGraphQL InjectionExpertResolver vulnerabilities, API-layer injection
18Guide/18-ORM-Injection.mdORM Bypass TechniquesExpertHibernate, Django ORM, Sequelize bypasses
19Guide/19-Polyglot-Payloads.mdPolyglot PayloadsExpertXSS+SQLi combo, multi-context payloads
20Guide/20-Multibyte-Encoding-Bypass.mdMultibyte BypassExpertGBK/charset encoding bypasses
21Guide/21-NoSQL-Injection.mdNoSQL InjectionExpertMongoDB, Redis, Cassandra, Elasticsearch injection
22Guide/22-Cheat-Sheet.mdComplete ReferenceAll LevelsQuick payload reference, syntax comparison

Learning Path by Goal

Goal 1: Detection & Basic Exploitation

Start here if you are new to SQL injection:

  1. Guide/01-Introduction.md - Understand the vulnerability
  2. Guide/02-Detection-Methods.md - Learn to find injection points
  3. Guide/03-Basic-Exploitation.md - Extract data via errors and boolean logic

Goal 2: Efficient Data Extraction

For penetration testers who need to extract data quickly:

  1. Guide/04-Union-Injection.md - Fast extraction with UNION
  2. Guide/05-Database-Fingerprinting.md - Identify your target
  3. Guide/06-Schema-Enumeration.md - Map the database structure
  4. Guide/07-Data-Extraction.md - Dump data efficiently

Goal 3: Bypassing Defenses

For advanced scenarios with WAFs or input filters:

  1. Guide/08-Blind-Injection.md - When no output is visible
  2. Guide/09-Filter-Evasion.md - Bypass WAFs and filters
  3. Guide/10-Advanced-Techniques.md - Stacked queries and file operations

Goal 4: Full System Compromise

For red team operations and advanced exploitation:

  1. Guide/10-Advanced-Techniques.md - File system access
  2. Guide/11-OS-Command-Execution.md - Achieve command execution

Goal 5: Advanced Contexts & Modern APIs

For specialized scenarios and modern application architectures:

  1. Guide/12-Second-Order-Injection.md - Stored/delayed injection attacks
  2. Guide/13-Alternative-Context-Injection.md - JSON, XML, HTTP header, and cookie injection
  3. Guide/14-HTTP-Parameter-Pollution.md - HPP attacks and framework bypass
  4. Guide/15-Heavy-Query-DoS.md - Resource exhaustion and DoS via SQL

Goal 6: Specialized Injection Vectors

For niche attack surfaces and bypass techniques:

  1. Guide/16-JWT-SQL-Injection.md - JWT KID parameter injection
  2. Guide/17-GraphQL-SQL-Injection.md - GraphQL resolver injection
  3. Guide/18-ORM-Injection.md - ORM framework bypass techniques
  4. Guide/19-Polyglot-Payloads.md - Multi-context polyglot payloads
  5. Guide/20-Multibyte-Encoding-Bypass.md - Character set encoding bypasses
  6. Guide/21-NoSQL-Injection.md - MongoDB, Redis, Cassandra, Elasticsearch injection

Prerequisites

  • Basic SQL knowledge (SELECT, WHERE, JOIN)
  • Understanding of HTTP requests and responses
  • Familiarity with command line tools

Practice Labs

docker run --rm -it -p 80:80 vulnerables/web-dvwa
# Login: admin / password# Set security level to "low" or "medium"

How to Use This Guide

  1. Follow the order: Each chapter builds on previous knowledge
  2. Practice immediately: Set up a lab and test every payload
  3. Take notes: Document what works and what does not
  4. Use the cheat sheet: Keep Guide/22-Cheat-Sheet.md open while testing
  5. Be ethical: Only test on systems you own or have explicit permission to test

Legal Notice

IMPORTANT: This material is for authorized security testing and educational purposes only.

  • Never test on systems without explicit written permission
  • Unauthorized access to computer systems is illegal in most jurisdictions
  • Always follow responsible disclosure practices
  • Use isolated lab environments for learning

License

This project is licensed under the MIT license. See the LICENSE file for details.