How ?¿$ & Developers Defeat The Most Famous Web Vulnerability Scanners or How To Recognize Old Friends
How ?¿$ & Developers Defeat The Most Famous Web Vulnerability Scanners or How To Recognize Old Friends
Chema Alonso
Informtica64
Jos Parada
Microsoft Ibrica
Agenda
1.- Introduction
2.- Inverted Queries
3.- Arithmetic Blind SQL Injection
4.- Time-Based Blind SQL Injection
using Heavey Queries
5.- Conclusions
1.-Introduction
12.186
sites
97.554
bugs
2.-Inverted
Queries
Right
SELECT UID
FROM USERS
WHERE
NAME=V_NAME
AND
PASSWORD=V_PASS
W;
Wrong?
SELECT UID
FROM USERS
WHERE
V_NAME=NAME
AND
V_PASSW=PASSWO
RD
Blind Attacks
Attacker injects code but cant access
directly to the data.
However this injection changes the
behavior of the web application.
Then the attacker looks for diferences
between true code injections (1=1) and
false code injections (1=2) in the
response pages to extract data.
Blind SQL Injection
Biind Xpath Injection
Blind LDAP Injection
MSSQL:
Program.php?id=1 and 100>(Select top 1
ASCII(Substring(name,1,1))) from sysusers)
Oracle:
Program.php?id=1 and 100>(Select
ASCII(Substr(username,1,1))) from all_users where
rownum<=1)
Acunetix
Paros
AppScan
W3af
Wapiti
Proxy Strike
Demo
W3af
Wapiti
Proxy Strike
Results
Normal
Inverted
MS SQL
MS SQL
MySQL
Server
MySQL
Server
Numer
Numer
Numer
Numer
ic
String
ic
String
ic
String
ic
String
Paros
AppScan
Acunetix
w3af
wapiti
Proxy
Strike
In the end
OUCH!!!
Solutions?
Concat string injection
Arithmetic Blind SQL Injection
Time-Based Blind SQL injection
Delay Functions
Heavy queries
3.- Arithmetic
Demo:
Divide by zero
Sums and
subtractions
Integer overflow
Conclusions
Arithmetic Blind SQL Injection allows
to construct binary logic without
AND and OR.
detects bugs in this kind of queries
And also in Inverted queries in which a
numeric value is used
Ex:
; if (exists(select * from users)) waitfor delay '0:0:5
Oracle connections
MS Access
DB2
Where-Clause execution
order
Select whatever
From whatever
Where condition1 and condition2
- Condition1 lasts 10 seconds
- Condition2 lasts 100 seconds
Which condition should be executed first?
Condition1 (10
sec)
Condition2 &
condition1
Response
Time
TRUE
FALSE
FALSE
110 sec
TRUE
TRUE
TRUE
110 sec
FALSE
Not evaluated
FALSE
100 sec
Condition2 (100
sec)
Condition1 &
condition2
Response
Time
TRUE
FALSE
FALSE
110 sec
TRUE
TRUE
TRUE
110 sec
FALSE
Not evaluated
FALSE
10 sec
Oracle
all_users
MySQL (versin 5)
information_schema.columns
Microsoft Access
MSysAccessObjects (97 & 2000 versions)
MSysAccessStorage (2003 & 2007)
52
Ex 1: MS SQL Server
Ex 1: MS SQL Server
Ex 2: Oracle
Ex 2: Oracle
Ex 3: Access 2007
Ex 3: Access 2007
Marathon Tool
Automates Time-Based Blind SQL Injection
Attacks using Heavy Queries in SQL Server,
MySQL, MS Access and Oracle Databases.
Schema Extraction from known databases
Extract data using heavy queries not matter
in which database engine (without schema)
Developed in .NET
Source code available
http://www.codeplex.com/marathontool
5.Conclusions
References
Inverted SQL queries (Spanish)
http://elladodelmal.blogspot.com/2009/09/inverted-sql-queries-ii-deii.html
Arithemtic Blind SQL Injection (spanish)
http://elladodelmal.blogspot.com/2009/07/arithmetic-blind-sqlinjection-i-de-ii.html
Time-Based Blind SQL Injection Using heavy queries & Marathon
Tool
http://www.defcon.org/images/defcon-16/dc16-presentations/alonsoparada/defcon-16-alonso-parada-wp.pdf
Marathon Tool
http://www.codeplex.com/marathontool
Connection String Attacks (spanish)
http://www.slideshare.net/chemai64/connection-string-parameterpollution
Thanks!
Chema Alonso
([email protected])
Jos Parada
([email protected])