DVWA Exercises 5
Last updated
Last updated
Here we can see an input field where we can put in a number. The sql statement in the background could look like this:
select firstname,surname from users where uid='$_GET['id']';
Let's try to inject a SQL statement:
1' or '1' = '1
With SQL Union we can grab information from other tables.
The UNION
keyword lets you execute one or more additional SELECT
queries and append the results to the original query. For example:
This SQL query will return a single result set with two columns, containing values from columns a
and b
in table1
and columns c
and d
in table2
.
For a UNION
query to work, two key requirements must be met:
The individual queries must return the same number of columns.
The data types in each column must be compatible between the individual queries.
Let's try the following SQL Query:
Most database types (with the notable exception of Oracle) have a set of views called the information schema which provide information about the database.
You can query information_schema.tables
to list the tables in the database:
You can then query information_schema.columns
to list the columns in individual tables:
Let's try the following SQL Query:
I put the collected password hashes in a file and try to crack the passwords with John the ripper.
First let's check which hash type we have with a tool called hash-identifier: