Skill detail
exploiting-sql-injection-vulnerabilities
Identifies and exploits SQL injection vulnerabilities using manual techniques and sqlmap across major database engines, demonstrating data extraction and auth bypass.
Why we recommend it: SQL injection detection and exploitation during authorized pentests; core offensive security work.
Inspect before use
Read the source instructions and check the requirements before you install this skill.
SKILL.md
The saved excerpt is a snapshot from when this skill was listed. The external source remains the complete and most current version.
--- name: exploiting-sql-injection-vulnerabilities description: 'Identifies and exploits SQL injection vulnerabilities in web applications during authorized penetration tests using manual techniques and automated tools like sqlmap. The tester detects injection points through error-based, union-based, blind boolean, and time-based blind techniques across all major database engines (MySQL, PostgreSQL, MSSQL, Oracle) to demonstrate data extraction, authentication bypass, and potential remote code execution. Activates for requests involving SQL injection testing, SQLi exploitation, database security assessment, or injection vulnerability verification. ' domain: cybersecurity subdomain: penetration-testing tags: - SQL-injection - sqlmap - database-security - OWASP-A03 - injection-testing version: 1.0.0 author: mahipal license: Apache-2.0 nist_csf: - ID.RA-01 - ID.RA-06 - GV.OV-02 - DE.AE-07 mitre_attack: - T1595 - T1190 - T1059 - T1078 - T1055 --- # Exploiting SQL Injection Vulnerabilities ## When to Use - Testing web application input parameters for SQL injection vulnerabilities during an authorized penetration test - Validating that parameterized queries and input sanitization are properly implemented across all database interactions - Demonstrating the business impact of a confirmed SQL injection vulnerability by extracting sensitive data - Verifying that WAF rules and input validation controls effectively block SQL injection payloads - Testing stored procedures, dynamic SQL, and ORM bypass scenarios in enterprise applications **Do not use** against databases without written authorization, for extracting or exfiltrating actual customer data beyond what is needed for proof of concept, or against production databases where exploitation could corrupt data integrity. ## Prerequisites - Written authorization specifying the target application and permissible level of exploitation (detection only vs. full exploitation) - Burp Suite Professional configured as an intercepting proxy to capture and modify HTTP requests - sqlmap installed with current version for automated detection and exploitation - Knowledge of the target database engine (MySQL, PostgreSQL, MSSQL, Oracle) or ability to fingerprint it - Test accounts at various privilege levels to test injection in authenticated contexts ## Workflow ### Step 1: Injection Point Discovery Identify parameters that interact with the database: - **Map all input vectors**: Catalog every parameter in URLs (GET), request bodies (POST), HTTP headers (Cookie, Referer, User-Agent, X-Forwarded-For), and JSON/XML API payloads - **Error-based detection**: Inject a single quote (`'`) into each parameter and observe the response. SQL errors (e.g., "You have an error in your SQL syntax", "unterminated quoted string", "ORA-01756") confirm the parameter reaches the database unsanitized. - **Boolean-based detection**: Inject `' AND 1=1--` (true condition) and `' AND 1=2--` (false condition). If the responses differ (different content length, different data returned, different HTTP status), the parameter is injectable. - **Time-based detection**: Inject `'; WAITFOR DELAY '0:0:5'--` (MSSQL), `' AND SLEEP(5)--` (MySQL), or `'; SELECT pg_sleep(5)--` (PostgreSQL). A 5-second response delay confirms injection. - **Out-of-band detection**: Use payloads that trigger DNS or HTTP requests to a Burp Collaborator domain to confirm injection in scenarios where responses are not directly observable. - **Second-order injection**: Test for injection where input is stored and later used in a different SQL query (e.g., username stored at registration, used in a query on the profile page). ### Step 2: Database Fingerprinting Determine the database engine and version to select appropriate exploitation techniques: - **Error-based fingerprinting**: Each database produces distinctive error messages. MySQL includes "MySQL", MSSQL mentions "SQL Server", PostgreSQL references "PG", Oracle contains "ORA-".Read the full source on GitHub (opens external page)