Web App Pen Testing - SQL Injection Videos
Web App Pen Testing - SQL Injection Videos
Test:
→ single quote in input field or “id” value;
→ see what error is and if it gives any useful info; may then use useful info by going to Burpe and
manipulating it: e.g. intercept request of logging in and then right click and send to “repeater” in
Burpe;
→ you can see we've added a single quote to the password parameter, which in the response shows
the error.
→ most modern web applications don't show errors in output which forces us to find other injection
techniques;
→ forward the request and see what the search results return:
→ a different result when we try SQL injection than under the highlighted heading above will
indicate if our sql injection is working or not;
test this: append a single quote to id request and see how everything changes:
nothing is returned. Now test an “always true” and “always false” condition:
To conduct a proper pen test have to test all the GET, POST, and cookie HEADER values, looking
for vulns;
Anyway with the cookie header, we do the same true / false tests. If single quote doesn't work, try
double quotes; if that doesn't work, try something else like the below (which returns a color, so
seem to be on the right path):
→ press “go”on the repeater tab to send the original request to the site to study the response;
→ autoscroll rule so response automatically goes to part of html that we want to see if our sql
injection is working:
As you can see on the login page, we're trying different combinations but nothing seems to be
working:
we can see success in confirming sql injection! [this was an always true condition];
→ and now we can see the always true condition returns the id value data, so, this is vulnerable to
sql injection:
→ inject a “union select” statement to see how many fields the original query has:
let's try a string in field 2: (which doesn't work, so we have to try a different data type):
to display the UNION SELECT results on output, have to set a non-existent id like 9999
Exploit this to get info about dbms and more (@@version):
→ retrieve username:
etc, etc.
we need to use the closing bracket and comment box since the input will be expecting closing
bracket and comment will comment out the other closing bracket;
continue until we extract all the table names. When no more errors are printed and just normal
output, we've found all the table names.
Let's find out the columns of the table – like the “accounts” table: