SQL Injection
SQL Injection
Injection
3rd July, 2024 via Ms Teams
SQL Injection
Vulnerability that consists of an attacker interfering with the SQL queries
that an application makes to a database.
If we want to return DBMS details, we use the statement ' UNION SELECT @@version, NULL#
To test if you can exploit the server script through Boolean logic. Type the following into the User ID: field, and then select Submit.
1' or '1'='1
This is a typical initial SQLi method that uses logic to trick the target into revealing more information than
its programmers intended. The concept is, you are setting up an OR expression between a variable
condition (i.e., whether a User ID exists) and a tautology (i.e., a statement of truth (e.g., 1=1)). The
results of this statement will always be true regardless of whether the variable condition is true. This
results in a lack of context for the remainder of the script, which instead of returning a single entry as
intended, the script may return all entries.
SQL Tips
Type the following command into the User ID: field, then select Submit:
This SQLi expression is attempting to request two columns of data (i.e., table_schema,
table_name) from the default DMBS database information container of MySQL (i.e.,
information_schema.tables). The table_schema value will be the name of the database
(displayed on the First name: lines), and the table_name will be the name of a table within
the database (displayed on the Surname lines).
SQL Tips
You now need to discover the column names of the tables.
However, the fastest way to do that results in all columns from all tables being dumped at once.
Type the following command into the User ID: field, then select Submit: