03 Sqlia
03 Sqlia
Muhammad Nadeem
[email protected]
SQL INJECTION ATTACK
User ID Administrator
Password abc
User ID Administrator
• Introduction
• Types of SQL injection attacks
• How to counter SQLIA
• Tool Demo: FindBugs®
• Best practices
• Q&A
• August 17, 2009, United States Department of Justice charged three suspects with
the theft of 130 million credit card numbers using SQL injection attack (Considered
“the biggest”)
• April 13, 2008, Oklahoma, 10,597 Social Security numbers were downloaded via an
SQL injection attack
• January 13, 2006, computer criminals broke into a Rhode Island government web
site and stole credit card data of individuals who have done business with state
agencies
1112
713 684
648
588
273
206 175
159 160 123 144
99
50 56
2 7
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
Source: Common Vulnerabilities and Exposures (CVE) repository
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=SQL+injection
Tautologies
Union
Queries
Piggybacked
Queries
Select * from users where userID= ‘’ and password= ‘’; Drop table
users – –’
Stored
Procedures
Malformed
Queries
Alternate
encoding
Hex: 3b2044726f70207461626c6520757365727320962d92
Equivalent: ; Drop table users – –’
Inference
Runtime
approaches Used when the system in the execution mode
(real time vs. post attack)
Hybrid
approaches
Have both the design time and runtime components
Select secret01
* secret02
From secret03
Where secret04
= secret05
and secret06
‘ secret07
…
06/15/2025 Application Security 25
KEYWORD RANDOMIZATION
User ID Administrator
Password abc
sec01 sec02 sec03 users sec04 userID sec05 sec07 sec07 sec06 password sec05 sec07 sec07
User ID Administrator
sec01 sec02 sec03 users sec04 userID sec05 sec07 sec07 sec06 password sec05 sec07 sec07
Illegal keywords/
characters
Query
Accept Compare
Signature
• Version 3.0.1
• Open source static code analysis tool
• Scans Java code
• Finds different type of vulnerabilities including SQL injection
vulnerability
• http://findbugs.sourceforge.net/downloads.html
06/15/2025
Application Security 34
FALSE POSITIVES / FALSE NEGATIVES
Code repository
V1 V4 V1
V2
V1
V3 V3
V3 Vx Example of False Positive
…
Static analysis
Vn
Vx
V4 Vn
Application Security 35
FALSE POSITIVES / FALSE NEGATIVES
• Almost all the tools generate false positive and false negative results
• False Positive
– A false alarm for a vulnerability when it is actually not there
• False negative
– No alarm for a vulnerability when it actually exists in the code
[email protected]
06/15/2025 Application Security 41