la_housing_portal
Atualizado
Atualizado
Challenge description:
If you click on the link, you will the the page, with its functionalities:
It seems the site is doing a query request to the server, lets look at the source code provided on the chall
This is the code that handles the request when you click the submit, you can see that they do not allow characters that are comments for SQL
The code that handles the SQL query:
So it seems that every parameter on the site is being added as PARAMETER = 'INPUT'
, so when you put the name Lordza
it will be name = 'LORDZA'
, this means that if you finish the input with '
you can probably do a SQL injection, the problem is that you can't use comments, and the place where the code is inserting the user input is before a LIMIT 25
and after a WHERE
, this means you can't use JOIN
, and you need to use the last parameter to make the injection to actually work
When you open on burpsuite, you can see the following requests:
Let's take a closer look at the submit request:
In the source code, you can see that you don't need all the parameters, and the name is taken off from the list, so you need to inject in another parameter.
We used the intercept on the burpsuite to edit the request. And encoded the query to url using the Ctrl+u
when selected the query
The SQL code was inserted after this, which was this one: ' UNION SELECT *,*,*,*,*,* FROM flag WHERE ''='
In our case, we used the parameter guests and erased all the others, so the query was something like this:
Then we got the flag printed in all the columns of the site:
lactf{us3_s4n1t1z3d_1npu7!!!}