Skip to content

SQL Injection

SQL injection occurs when user input is concatenated into a SQL query without proper parameterisation, allowing the attacker to alter the query’s structure. Impact ranges from authentication bypass to full database extraction, file read/write on the database host, and remote code execution.

This section is operational reference. Use the page that matches your situation:

You are…Go to
Looking for the first injection in an unknown appDetection
Trying to log in without credentialsAuthentication bypass
Seeing query output reflected in the responseUNION-based
Confirmed injection, need to dump the databaseEnumeration
Output not visible, but page behaviour changesBoolean-based blind
Output not visible, no behavioural differenceTime-based blind
No response feedback at allOut-of-band
User input appears in a query, but only after later useSecond-order
Injecting against MongoDB / NoSQLNoSQL injection
Need to read or write files via the DBFile operations
Payload is being filtered or blockedFilter bypasses
Need syntax for a specific DBMSDBMS cheatsheet
  1. Identify every parameter that may influence a query - URL parameters, form fields, headers (User-Agent, Cookie, X-Forwarded-For), JSON body fields.
  2. Detect by injecting a syntax-breaking character (', ", ), --) and observing for errors, behavioural change, or timing change.
  3. Fingerprint the DBMS using version-specific payloads (see DBMS cheatsheet).
  4. Determine the injection class - in-band (UNION/error), inferential (boolean/time blind), or out-of-band.
  5. Enumerate schema → tables → columns → data.
  6. Escalate where possible: file read/write, command execution, lateral movement.

Placeholders follow the same scheme everywhere:

  • <TARGET> - target host or URL
  • <PARAM> - vulnerable parameter name
  • <TABLE>, <COL>, <DB> - table, column, database name
  • <USER> - target username (e.g. administrator)
  • <N> - column count
  • <ATTACKER> - your listener / collaborator host

When a page shows a payload, assume it is what gets injected into <PARAM> - URL-encoding, prefix, and suffix depend on context.

Manual exploitation is faster for simple cases and essential for understanding what’s happening. sqlmap is the right tool when:

  • You need to enumerate a large schema quickly.
  • You’re chasing blind SQLi with hundreds of characters to extract.
  • The target needs unusual handling (cookies, custom headers, JSON, multipart).

Minimal invocation:

Terminal window
sqlmap -u "https://<TARGET>/path?<PARAM>=test" --batch --dbs

For complex requests, save the request from Burp to a file and use -r request.txt. See DBMS cheatsheet for --dbms, --technique, and other flags worth knowing.