Revisiting SQL Injection Will we ever get it right? Michael Sutton, Security Evangelist



Similar documents
Smashing Web Apps Applying Fuzzing to Web Applications and Web Services. Michael Sutton, Security Evangelist

The Top Web Application Attacks: Are you vulnerable?

Web Application Security

EC-Council CAST CENTER FOR ADVANCED SECURITY TRAINING. CAST 619 Advanced SQLi Attacks and Countermeasures. Make The Difference CAST.

Application Security Testing

Web Application Security

Web Application Attacks And WAF Evasion

Chapter 1 Web Application (In)security 1

Webapps Vulnerability Report

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

Web Application Worms & Browser Insecurity

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

(WAPT) Web Application Penetration Testing

Introduction to Computer Security

National Information Security Group The Top Web Application Hack Attacks. Danny Allan Director, Security Research

Blackbox Reversing of XSS Filters

AJAX Storage: A Look at Flash Cookies and Internet Explorer Persistence

OWASP and OWASP Top 10 (2007 Update) OWASP. The OWASP Foundation. Dave Wichers. The OWASP Foundation. OWASP Conferences Chair

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Web Application Security. Vulnerabilities, Weakness and Countermeasures. Massimo Cotelli CISSP. Secure

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

Hack Yourself First. Troy troyhunt.com

Web-Application Security

ASP.NET MVC Secure Coding 4-Day hands on Course. Course Syllabus

HTTPParameter Pollution. ChrysostomosDaniel

Bank Hacking Live! Ofer Maor CTO, Hacktics Ltd. ATC-4, 12 Jun 2006, 4:30PM

Web Application Security Considerations

Securing Your Web Application against security vulnerabilities. Ong Khai Wei, IT Specialist, Development Tools (Rational) IBM Software Group

ASL IT Security Advanced Web Exploitation Kung Fu V2.0

Detecting Web Application Vulnerabilities Using Open Source Means. OWASP 3rd Free / Libre / Open Source Software (FLOSS) Conference 27/5/2008

Web Application Hacking (Penetration Testing) 5-day Hands-On Course

Security Testing with Selenium

Advanced Web Security, Lab

The purpose of this report is to educate our prospective clients about capabilities of Hackers Locked.

SQL Injection January 23, 2013

Chapter 12: Advanced topic Web 2.0

DISCOVERY OF WEB-APPLICATION VULNERABILITIES USING FUZZING TECHNIQUES

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

Gateway Apps - Security Summary SECURITY SUMMARY

Conducting Web Application Pentests. From Scoping to Report For Education Purposes Only

Adobe Systems Incorporated

Threat Modeling/ Security Testing. Tarun Banga, Adobe 1. Agenda

Check list for web developers

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

Where every interaction matters.

Enterprise Application Security Workshop Series

WEB ATTACKS AND COUNTERMEASURES

SESSION IDENTIFIER ARE FOR NOW, PASSWORDS ARE FOREVER

Web application security: Testing for vulnerabilities

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

Penetration Test Report

Hack Proof Your Webapps

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

Web Security Testing Cookbook*

Security features of ZK Framework

What about MongoDB? can req.body.input 0; var date = new Date(); do {curdate = new Date();} while(curdate-date<10000)

Cross-Site Scripting

Finding and Preventing Cross- Site Request Forgery. Tom Gallagher Security Test Lead, Microsoft

MatriXay WEB Application Vulnerability Scanner V Overview. (DAS- WEBScan ) The best WEB application assessment tool

Application security testing: Protecting your application and data

Rational AppScan & Ounce Products

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

Security Products Development. Leon Juranic

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

Web Application Penetration Testing

Software Assurance Tools: Web Application Security Scanner Functional Specification Version 1.0

Adding Value to Automated Web Scans. Burp Suite and Beyond

Acunetix Website Audit. 5 November, Developer Report. Generated by Acunetix WVS Reporter (v8.0 Build )

Performing a Web Application Security Assessment

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Attack and Penetration Testing 101

Web application security

Last update: February 23, 2004

What is Web Security? Motivation

Web Application Security 101

Server-Side JavaScript Injection Bryan Sullivan, Senior Security Researcher, Adobe Secure Software Engineering Team July 2011

Barracuda Web Application Firewall vs. Intrusion Prevention Systems (IPS) Whitepaper

WEB 2.0 AND SECURITY

The Dark Side of Ajax. Jacob West Fortify Software

Are AJAX Applications Vulnerable to Hack Attacks?

Detecting and Defending Against Security Vulnerabilities for Web 2.0 Applications

Sitefinity Security and Best Practices

SQL Injection. By Artem Kazanstev, ITSO and Alex Beutel, Student

Web Application Threats and Vulnerabilities Web Server Hacking and Web Application Vulnerability

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

Penetration Testing with Kali Linux

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

Criteria for web application security check. Version

Security Test s i t ng Eileen Donlon CMSC 737 Spring 2008

State of The Art: Automated Black Box Web Application Vulnerability Testing. Jason Bau, Elie Bursztein, Divij Gupta, John Mitchell

An Anatomy of a web hack: SQL injection explained

Intrusion detection for web applications

Client vs. Server Implementations of Mitigating XSS Security Threats on Web Applications

Web Application Guidelines

Transcription:

Revisiting SQL Injection Will we ever get it right? Michael Sutton, Security Evangelist

Overview Background What it is? How are we doing? Web 2.0 SQL injection meets AJAX Fuggle SQL Injection meets Google meets fuzzing Conclusion

Attack Scenario #1 Good ol SQL Injection

SQL Injection Cause Definition Impact Demo Unfiltered User Input Attacker can influence or rewrite a backend SQL query Client Request POST /SPIWare/Login.aspx HTTP/1.1 Host: localhost txtemail=msutton@spidynamics.com&txtpassword=password SQL Query SELECT * FROM Customers WHERE Email = '{0}' and Password = '{1}'", txtemail.text, txtpassword.text

SQL Injection Cause Definition Impact Demo

What is SQL Injection? Cause Definition Impact Demo Verbose SQL Injection Server provides detailed error messages Error messages are leveraged by attacker to gain insight into database structure Blind SQL Injection Database error messages are suppressed Attacker must alter approach and only make queries with Boolean outcomes (yes/no questions)

Verbose vs. Blind SQL Injection Cause Definition Impact Demo Server Error in '/Hackware' Application. Column 'Customers.CustomerID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Whoops an error has occurred! vs

What damage can be done? Cause Definition Impact Demo Confidentiality SELECT Read from application and system tables Integrity DELETE, INSERT, DROP Alter existing data or inject new data Authentication Bypass E.g. OR 1=1 -- System Compromise Stored procedures Extended stored procedures Excellent paper - http://www.nextgenss.com/papers/advanced_sql_injection.pdf

SQL Injection Demo Cause Definition Impact Demo

Prevention Input Validation Always ensure that your receive what you expect White list vs. black list Validate type, length, format, and range Regular expressions - http://regexlib.com Escape special characters Always validate on the server side! Leverage Frameworks Parameterized Queries Point and Click query generation ACLs Execute queries with least privilege

Mitre CVE Statistics 2006 2005 2004 2003 2002 2001 25.00% 20.00% 15.00% 10.00% `` 5.00% 0.00% 11

WASC Statistics - 2006

WASC Statistics 2007 (1H) % of Vuln. Sites 30.00% 26.49% 25.00% 20.00% 15.00% 10.34% 10.00% 8.11% 5.58% 5.00% 1.11% 0.00% Cross Site Scripting Information Leakage SQL Injection Predictable Resource Location Content Spoofing

Attack Scenario #2 SQL Injection via AJAX

What is Web 2.0? Tim O Reilly Web 2.0 is the business revolution in the computer industry caused by the move to the internet as platform, and an attempt to understand the rules for success on that new platform. Wikipedia Web 2.0...refers to a perceived second-generation of Web based communities and hosted services such as social networking sites, wikis and folksonomies that facilitate collaboration and sharing between users.

Web 2.0 My Definition Web 1.0 Incomplete pages were shameful Please come back later when we re ready Web 2.0 Incomplete pages are a feature! Stick around and help us improve the site Same Vulnerabilities Additional Input Vectors More Complexity

Input Vectors Web 1.0 Web 2.0

AJAX Cause Definition Impact Demo What does AJAX change? Business logic is dispersed among multiple client side files/functions Requests are made in the background without user intervention but are just as susceptible to attack What doesn t AJAX change? AJAX does not create new vulnerabilities How does AJAX affect security? Increased surface area More business logic is exposed New input vectors are exposed Security tools must understand the XHR objects and their syntax in order to identify input vectors

What is AJAX? Cause Definition Impact Demo Asynchronous Requests are initiated in the background JavaScript JavaScript instantiates the XmlHttpRequest object and generates the requests and XML This is a misnomer as AJAX frameworks commonly employ alternate data interchange formats JSON - Atlas Serialized Java - Google Web Toolkit HTML XML

What is AJAX? Cause Definition Impact Demo Multiple frameworks Prototype (http://www.prototypejs.org/) Script.aculo.us Dojo (http://dojotoolkit.org/) ASP.Net AJAX (http://ajax.asp.net/) Etc. Multiple browser objects Internet Explorer IE6 - XMLHTTP ActiveX control IE7 XMLHTTP native script object Firefox XMLHttpRequest object

Classic Web Apps Cause Definition Impact Demo

AJAX Web Apps Cause Definition Impact Demo

Google Maps

FireBug

What damage can be done? Cause Definition Impact Demo Same old story Any classic web application vulnerabilities can be exploited through AJAX SQL injection XSS Etc. Risk In a rush to implement the latest Web 2.0 technologies, companies are ignoring security

How Not to Implement AJAX - BlinkList

How Not to Implement AJAX - BlinkList

How Not to Implement AJAX - BlinkList Verbose SQL errors Multiple XSS Ability to inject client side script Exposed functionality Web based email Directory browsing Access to restricted files

AJAX Demo Cause Definition Impact Demo

FUGGLE Fuzzing Using Google Gets Low hanging fruit Easily FuggleTM

FUGGLE Fuzzing Using FuggleTM Google Gets Low hanging fruit Easily

Fuggle RI.gov Hackers steal credit card info from R.I. Web site Dibya Sarkar Published on Jan. 27, 2006 A Russian hackers broke into a Rhode Island government Web site and allegedly stole credit card data from individuals who have done business online with state agencies. The story was first reported by The Providence Journal this morning and comes two days after state and local government officials released national surveys indicating they need more cybersecurity guidance and help in strengthening their systems.

Fuggle Fuzzing Phases Identify Target Identify Inputs Generate Fuzzed Data Execute Fuzzed Data Monitor for Exceptions Determine Exploitability

Fuggle vs. Google Hacking Fuggle Focus on input e.g. URI parameters Identifying targets for further testing Flexible search terms e.g. inurl:"id=10" Custom vulnerabilities Focus on output e.g. page content Identifying pages using vulnerable 3 rd party apps or leaking confidential information Fixed signature based searches e.g. intitle:index.of "parent directory" Known vulnerabilities

Fuggle Prerequisites Fuzz Variables Input vectors must be indexed by Google and accessible via search operators - Title - Displayed page content - URI - Request/response headers - Page source code Limitations Effectively limits using Fuggle to pages using GET method Input vectors indexed in URL

Fuggle Threat How can Fuggle be abused? Indiscriminate web application hacking Vulnerability scanning for self propagating worms / web application worms

Fuggle SQL Injection Identify Input Input User supplied values concatenated into SQL queries www.example.com?id=10 SELECT product from products WHERE id=10; Goal Identify pages with verbose SQL errors Identify Input Identify Targets Generate Fuzzed Data Execute Fuzzed Data Monitor for Exceptions Determine Exploitability

Fuggle SQL Injection Identify Targets Search Term inurl:"id=10" Targets Retail stores E.g. Product catalog Informational sites E.g. News archive Search results Results 1-10 of about 2,010,000 for inurl:"id=10". (0.05 seconds) Cleanse results Remove URLs w/out id=10 Remove duplicate results form single domain Identify Input Identify Targets Generate Fuzzed Data Execute Fuzzed Data Monitor for Exceptions Determine Exploitability

Fuggle SQL Injection Generate Data Goal Identify pages with verbose SQL errors Fuzz data Verbose SQL injection id= 10 Blind SQL injection id=10 OR 1=1 Comment remainder of query id= 10-- Encode query id=%2710 Identify Input Identify Targets Generate Fuzzed Data Execute Fuzzed Data Monitor for Exceptions Determine Exploitability

Fuggle SQL Injection Execute Data Submit queries Capture responses Raw response Headers HTML source code HTML Status codes Associate requests with responses Archive for automated and manual review Identify Input Identify Targets Generate Fuzzed Data Execute Fuzzed Data Monitor for Exceptions Determine Exploitability

Fuggle SQL Injection Monitor Exceptions Identify Input Identify Targets Generate Fuzzed Data Execute Fuzzed Data Monitor for Exceptions Determine Exploitability

Fuggle SQL Injection Exploitability Confidentiality SELECT Integrity DROP INSERT DELETE System compromise Stored procedures Extended stored procedures Identify Input Identify Targets Generate Fuzzed Data Execute Fuzzed Data Monitor for Exceptions Determine Exploitability

Fuggle SQL Injection Results Initial population of URLs 1,000 Population after removal of duplicate servers 732 Population after removal of failed requests 708 Total number of verbose SQL errors 80 Percentage of sample web sites potentially vulnerable to SQL injection attacks 11.3%

Questions Michael Sutton, Security Evangelist http://portal.spidynamics.com/blogs/msutton Michael.Sutton@hp.com