SQL Injection Detection
SQL injection detection confirms whether user-supplied input is interpreted by a backend database. The goal here is to prove the condition exists and identify the injection type — not to extract data. Confirmed injection moves to SQL injection exploitation.
Target any parameter that likely hits a database: id, user, search, category, order, sort, page, filter. Parameters discovered during parameter crawling are your starting list.
Error-Based Detection
Inject a single quote and watch for database error messages in the response. An error proves the input reaches a SQL query without sanitization:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
A MySQL syntax error is a confirmed injection point. Note the database type from the error message — it determines the payload syntax for exploitation. ORA- prefix means Oracle, pg_ means PostgreSQL.
Boolean-Based Blind Detection
When errors are suppressed, compare responses between a true and false condition. Different response sizes or content confirm blind SQLi:
4823
612
Different response sizes for true versus false conditions confirms boolean-blind SQLi. The true condition returns the normal page while the false condition returns a shorter or empty page.
Time-Based Blind Detection
When no response difference is visible, inject a sleep and measure the delay. This works even when the application returns identical responses for all inputs:
real 0m5.123s
A 5-second delay matching the SLEEP parameter confirms time-based blind SQLi. SLEEP is MySQL syntax. WAITFOR DELAY is MSSQL. pg_sleep(5) is PostgreSQL. Try all three if the database type is unknown.
POST Parameter and Header Injection
SQLi is not limited to GET parameters. Test POST bodies, cookies, and HTTP headers:
Automated Detection with sqlmap
sqlmap automates all detection types. Use it for quick confirmation across multiple parameters:
Important
sqlmap is not allowed on OSCP. Use manual detection techniques above for exam environments.
References
-
Automated SQL injection detection and exploitation tool
-
PortSwigger — SQL Injectionportswigger.net/web-security/sql-injection (opens in new tab)
Detection methodology and injection type reference
Was this helpful?
Your feedback helps improve this page.