SQL Injection Attacks

20
SQL Injection Attacks Marcelle Lee

Transcript of SQL Injection Attacks

Page 1: SQL Injection Attacks

SQL Injection Attacks Marcelle Lee

Page 2: SQL Injection Attacks

History - Web ServersOutward-facingAccessible to the publicDesigned to accept

requestsDesigned to serve up

resources on demand

Page 3: SQL Injection Attacks

Topology - DMZ

Page 4: SQL Injection Attacks

Example - UMBC

Page 5: SQL Injection Attacks

Reconnaissance - nslookup

130.85.12.160

Page 6: SQL Injection Attacks

Reconnaisance - whois

Page 7: SQL Injection Attacks

Reconnaissance - nmap port scan

Apache httpd 2.4.6 ((Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 PHP/5.4.16

mod_perl/2.0.9dev Perl/v5.16.3)

Page 8: SQL Injection Attacks

OWASP - Top 10

Page 9: SQL Injection Attacks

OWASP - Injection Breakdown

Page 10: SQL Injection Attacks

SQL InjectionSQL - Structured Query LanguageUsed to access and/or modify a databaseExample is authentication on a web serverCommon commands are SELECT, UPDATE, DELETE,

INSERT INTO, and DROP TABLE

Page 11: SQL Injection Attacks

SQL Query with JavaScript CodeString username = req.getParameter("username");

String password = req.getParameter("password");

String query = "SELECT id FROM user_table WHERE " +

"username = '" + username + "' AND " +

"password = PASSWORD('" + password + "')";

ResultSet rs = stmt.executeQuery(query);

int id = -1; // -1 implies that the user is unauthenticated.

while (rs.next()) {

id = rs.getInt("id");

}

Page 12: SQL Injection Attacks

SQL Injection StatementSELECT id FROM user_table WHERE username = '' OR 1=1 -- '

Page 13: SQL Injection Attacks
Page 14: SQL Injection Attacks

Testing - http://SQLZOO.net/hack

Page 15: SQL Injection Attacks

Web Application Scanners

Page 16: SQL Injection Attacks

ZAP Scanner

Page 17: SQL Injection Attacks

ZAP Scanner - Results

Page 18: SQL Injection Attacks

Qualys Scanner

Page 19: SQL Injection Attacks

Qualys Scanner - Results

Page 20: SQL Injection Attacks

Hackmaggedon Statistics - August 2015