
SQL injection lets an attacker change a database query by supplying crafted input. There are three common techniques: union-based, error-based and blind SQL injection. This article covers the error-based technique.
A common first test for SQL injection is to add a single quote (') to a parameter. If the server returns a database error, the input is reaching the query unescaped.
In error-based SQL injection, the attacker goes one step further: they craft input that makes the database include data, such as its version or a table name, inside the error message. The application does not display query results, but it displays the error, and the error carries the data.
The video first shows a normal SQL injection and then the error-based technique.
Example payload used in the demonstration, which makes the database reveal its version in an error:
username=gfh'+OR+1+GROUP+BY+CONCAT_WS(0x3a,VERSION(),FLOOR(RAND(0)*2))+HAVING+MIN(0)+OR+1-- -
A SQL injection where the database error message itself reveals data or confirms the injection.
No. Hiding errors makes exploitation harder (it becomes blind SQL injection), but only parameterised queries fix the root cause.
Try Vooki Pro free for 7 days
Test every parameter for SQL injection in one scan. The trial unlocks every feature for 7 days, and scanning runs on your own machine.
Related: Blind SQL injection: how it works and how to stop it · Turn off debug mode and verbose errors in production