Web App Security Testing Tool
Web App Security Testing Tool
fuzzing environment
Ezequiel D. Gutesman
Corelabs
Core Security Technologies
Objectives
• Present a working tool (prototype) to test the
security of a given web application. The tool tests
for (SQL) injection attacks:
• Technique:
– Fuzzing
– Instrumentation
Agenda
• Reporting
• Demo
• Future work
Agenda
• Reporting
• Demo
• Future work
Why Web Applications?
• Widely used
• Easy to develop
– Scripting languages
– Inexperienced programmers are not
security-aware
• XSS
●
Injection Vulns (particularly SQL)
• Malicious File execution
• Insecure Direct Object Reference
• CSRF
• Information Leakage and Error
handling
• Broken auth. , session management
Consequences (SQL-injection)
• Data theft
• Data unavailability
• Data alteration
• Money losses
• Reporting
• Demo
• Future work
SQL injection facts
• It is an injection attack
User-supplied data
<?php
$client_id = $_POST[“id”];
SERVER
$_POST[“id”] ← 3
client.id client.name
3 John Doe
<?php
$client_id = $_POST[“id”];
$client = mysql_query(“SELECT * FROM clients WHERE id = ” . $client_id);
Supplying [offensive] data
SERVER
$_POST[“id”] ← 0 or 1=1
client.id client.name
1 George W
3 John Doe
4 Martin Green
5 Joshua B
76 Ellen Grant
8 Mark Twain
<?php
$client_id = $_POST[“id”];
$client = mysql_query(“SELECT * FROM clients WHERE id = ” . $client_id);
Countermeasure technologies
• Scanners
• Code audits
Agenda
• Reporting
• Demo
• Future work
Fuzzing (general)
Crawling /
Spidering
Detect input vectors
Refine / classify
Heuristics
ta
-
do ially
da
M o cep
m
/ r pec
ex
nit tio
ed it s
or ns
an
fo
aft m
r
cr Sub
Web Application fuzzing
• Exception monitoring is not trivial
– Which are “REAL exceptions”?
Fuzzing
+
Character-grained taint analysis
(aka. Core GRASP)
+
Grammar-based analysis
A LOT of information!
Agenda
• Reporting
• Demo
• Future work
Character-grained taint analysis
• Run-time instrumentation
• It “paints” attacker-controlled
characters as tainted and propagates
taint information during execution.
<f o
rm
<in act
i
<in put ty on=”
< / f p u t p e= p r o c
orm typ ” e
> e= text” ss.p
”su n h
bm am e p ” >
it” =
val ”id”>
ue=
“Q
u er y
clie
nt ”
>
0 or 1=1 0 or 1=1
CLIENT SERVER
Character-grained taint analysis (cont)
$_P
OS
T
DBMS
Character-grained taint analysis & gFuzz
<GRASP_FUZZ_ENTRY>
<GRASP_QUERY_ID>
/location/of/the/executed/file/userlogin.php:40
</GRASP_QUERY_ID>
<GRASP_FUZZ_IS_ATTACK>0</GRASP_FUZZ_IS_ATTACK>
<GRASP_FUZZ_QUERY>
SELECT name,email FROM users WHERE username=’bob’ and password=’foo’
</GRASP_FUZZ_QUERY>
<GRASP_FUZZ_QUERY_MARK>
.............................................XXX................XXX.
</GRASP_FUZZ_QUERY_MARK>
</GRASP_FUZZ_ENTRY>
gFuzz entry sent by GRASP
<GRASP_FUZZ_ENTRY>
<GRASP_QUERY_ID>
/location/of/the/executed/file/userlogin.php:40
</GRASP_QUERY_ID>
<GRASP_FUZZ_IS_ATTACK>0</GRASP_FUZZ_IS_ATTACK>
<GRASP_FUZZ_QUERY>
SELECT name,email FROM users WHERE username=’bob’ and password=’foo’
</GRASP_FUZZ_QUERY>
<GRASP_FUZZ_QUERY_MARK>
.............................................XXX................XXX.
</GRASP_FUZZ_QUERY_MARK>
</GRASP_FUZZ_ENTRY>
Grammatical analysis of SQL queries
SELECT
users and
= =
SELECT
users and
= =
SELECT
users and or
= = =
SELECT
users and or
= = =
GRASP Fuzzer
enabled Executed Queries
PHP
<GRASP_FUZZ_ENTRY>
<GRASP_QUERY_ID>
GUI
/location/of/the/executed/file/userlogin.php:40
</GRASP_QUERY_ID>
<GRASP_FUZZ_IS_ATTACK>0</GRASP_FUZZ_IS_ATTACK>
Attack verification - witnesses
SELECT * SELECT *
FROM users FROM users
WHERE WHERE
username = 'someString ' username = someString
AND AND
password = ' someString ' password = someString
Attack verification - witnesses
if ( isset($_POST[“concerned”]) &&
isset($_POST[“indifferent”]) && isset($_POST[“dontknow”]) )
{
echo “you cannot be concerned, indifferent and
don't know about it at the same time!”;
}
?>
Conclusion:
users and
= =
SELECT name,email
FROM users or
WHERE username='bob'
and =
password='none'
or 1=1; --'
1 1
Agenda
• Reporting
• Demo
• Future work
Reporting
Gfuzz
analysis
Input / URL
Target
parameter
Fuzz
vector
Demo
About the prototype
contact:
[email protected]
Acknowledgments
• Pictures from
– http://www.sxc.hu
– http://www.openclipart.org
– http://www.flickr.com