SQL Injection Authentication Bypass
SQL Injection Authentication Bypass
HTTP
SQL injections
SQL injections are one of the most common (web) vulnerabilities. All SQL
injections exercises, found here, use MySQL for back-end. SQL injections come
from a lack of encoding/escaping of user-controlled input when included in
SQL queries.
Depending on how the information gets added in the query, you will need
different things to break the syntax. There are three different ways to echo
information in a SQL statement:
Using back-ticks.
Directly.
You will need to bypass the login page using SQL injection. The SQL query
looks something like:
if the query returns no result, you have not provided a valid username and
password.
Our goal is to make the query return at least one result. To do so we are going
to inject a condition that is always true: 1=1 . To do that, we are going to:
Comment out the remaining query using - (the space at the end matters)
or # .
Example-02(double quote)
Example - 03
This time the developer checked that only one result is return by the database.
We can bypass this using keyword LIMIT
Example -04:
This error message appears as soon as a space is injected inside the request. It
prevents us from using the ' or '1'='1 method, or any fingerprinting that uses the
space character. However, this filtering is easily bypassed, using tabulation (HT
or \t). You will need to use encoding, to use it inside the HTTP request.
We can use /**/, %00, %09, %0a, %0d
Example-05:
Example - 06:
https://shiflett.org/blog/2006/addslashes-versus-mysql-real-escape-string
In this case we will not get an error using single or double quote.
What we can do is we can capture the request in burp, then we can use
%bf%27 instead of %27(‘)