Comparing the Effectiveness of Penetration Testing and Static Code Analysis



Similar documents
Detecting SQL Injection Vulnerabilities in Web Services

Using Web Security Scanners to Detect Vulnerabilities in Web Services

The Devils Behind Web Application Vulnerabilities

Black Box versus White Box: Different App Testing Strategies John B. Dickson, CISSP

Protecting Database Centric Web Services against SQL/XPath Injection Attacks

Using Web Security Scanners to Detect Vulnerabilities in Web Services

Automatic vs. Manual Code Analysis

Protecting Database Centric Web Services against SQL/XPath Injection Attacks

Learning objectives for today s session

Application Security Testing. Erez Metula (CISSP), Founder Application Security Expert

Streamlining Application Vulnerability Management: Communication Between Development and Security Teams

CHAPTER 5 INTELLIGENT TECHNIQUES TO PREVENT SQL INJECTION ATTACKS

Adobe Systems Incorporated

HP WebInspect Tutorial

Systematically Enhancing Black-Box Web Vulnerability Scanners

Penetration Testing Lessons Learned. Security Research

Application Code Development Standards

Software Security. Group project: application security verification using OWASP ASVS

METHODS TO TEST WEB APPLICATION SCANNERS

Dissecting and digging application source code for vulnerabilities

Web Application Report

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

The Top Web Application Attacks: Are you vulnerable?

Metrics, methods and tools to measure trustworthiness

A clustering Approach for Web Vulnerabilities Detection

Countering The Faults Of Web Scanners Through Byte-code Injection

CS346: Database Programming.

Turning the Battleship: How to Build Secure Software in Large Organizations. Dan Cornell May 11 th, 2006

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

TOOL EVALUATION REPORT: FORTIFY

Mingyu Web Application Firewall (DAS- WAF) All transparent deployment for Web application gateway

Software Testing Interview Questions

Using Free Tools To Test Web Application Security

The JAVA Way: JDBC and SQLJ

Java Program Vulnerabilities

How to Avoid an Attack - Security Testing as Part of Your Software Testing Process

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

MapReduce. MapReduce and SQL Injections. CS 3200 Final Lecture. Introduction. MapReduce. Programming Model. Example

Introduction to Web Application Security. Microsoft CSO Roundtable Houston, TX. September 13 th, 2006

Client logo placeholder XXX REPORT. Page 1 of 37

Serious Threat. Targets for Attack. Characterization of Attack. SQL Injection 4/9/2010 COMP On August 17, 2009, the United States Justice

Early Vulnerability Detection for Supporting Secure Programming

Web Application Penetration Testing

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

Security Module: SQL Injection

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

Course Title: Penetration Testing: Network Threat Testing, 1st Edition

Background. HSBC DOD VA Masters in Computer Science Somerset Recon. Avid CTF Competitor

Supplement IV.C: Tutorial for Oracle. For Introduction to Java Programming By Y. Daniel Liang

Web Vulnerability Detection and Security Mechanism

Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

Web application security: automated scanning versus manual penetration testing.

A Study of Android Application Security

A Strategic Approach to Web Application Security The importance of a secure software development lifecycle

Rational AppScan & Ounce Products

Hybrid Analysis Mapping: Making Security and Development Tools Play Nice Together. Dan Cornell. CTO, Denim

Exam Name: IBM InfoSphere MDM Server v9.0

(WAPT) Web Application Penetration Testing

Web Applications Testing

IBM Rational AppScan: Application security and risk management

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

Encoding the Password

CS2506 Operating Systems II Lab 8, 8 th Tue/03 /2011 Java API

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

HP Application Security Center

External Network & Web Application Assessment. For The XXX Group LLC October 2012

Fuzzing in Microsoft and FuzzGuru framework

Effective Software Security Management

Application Security Testing. Generic Test Strategy

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O

Overview of Web Services API

Database Access from a Programming Language: Database Access from a Programming Language

Database Access from a Programming Language:

BDD FOR AUTOMATING WEB APPLICATION TESTING. Stephen de Vries

SAST, DAST and Vulnerability Assessments, = 4

Penetration Testing: Lessons from the Field

HackMiami Web Application Scanner 2013 PwnOff

WebCruiser Web Vulnerability Scanner User Guide

SINGLE SIGNON FUNCTIONALITY IN HATS USING MICROSOFT SHAREPOINT PORTAL

Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today.

SQL Injection Attack Lab Using Collabtive

Transcription:

Comparing the Effectiveness of Penetration Testing and Static Code Analysis Detection of SQL Injection Vulnerabilities in Web Services PRDC 2009 Nuno Antunes, nmsa@dei.uc.pt, mvieira@dei.uc.pt University of Coimbra Portugal

Web Services n Web services are becoming a strategic component in a wide range of organizations n Components that can be remotely invoked n Well defined interface n Web services are extremely exposed to attacks n Any existing vulnerability will most probably be uncovered/exploited n Both providers and consumers need to assess services security 2

Web Services Environment 3

SQL Injection vulnerabilities ' OR 1=1 -- public String auth(string login, String pass) throw SQLException { String sql = "SELECT * FROM users WHERE "+ "username='" + login + "' AND "+ "password='" + pass + "'"; } "SELECT ResultSet * FROM rs = users statement.executequery(sql); WHERE username='' OR 1=1 -- ' AND ( ) password='' ; ' OR ''=' public void delete(string str) throw SQLException{ String sql = "DELETE FROM table "WHERE id='" + str + "'"; statement.executeupdate(sql); } "DELETE FROM table WHERE id='' OR '' = ''"; 4

Developers must n Apply best coding practices n Perform code analysis n Manual code analyses (reviews, inspections) n Automated static code analysis n Perform tests n Manual penetration testing n Automated penetration testing (vulnerability scanners) 5

Penetration testing n Widely used by developers n Consists in stressing the application from the point of view of an attacker n black-box approach n Uses specific malicious inputs n e.g., for SQL Injection: or 1=1 n Can be performed manually or automatically n Many tools available n Including commercial and open-source n Does not require access to the code 6

Static code analysis n white-box approach n Consists in analyzing the source code of the application, without execution it n Looks for potential vulnerabilities n Among other types of software defects n Can be performed manually or automatically n These tools provide an automatic way for highlighting possible coding errors n Does require access to the code (or bytecode) 7

Our goal n Evaluate several automatic penetration testing tools and static analysis tools n In a controlled environment n Focus on two key measures of interest: n Coverage n Portrays the percentage of existing vulnerabilities that are detected by a given tool n False positives rate n Represents the number of reported vulnerabilities that in fact do not exist n Target only SQL Injection vulnerabilities n Extremely relevant in Web Services 8

Steps n Preparation n Select the penetration testers and static code analyzers n Select the Web Services to be considered n Execution n Use the tools to identify potential vulnerabilities n Verification n Perform manual verification to confirm that the vulnerabilities identified by the tools do exist n Analysis n i.e., are not false positives n Analyze the results obtained and systematize the lessons learned 9

Web Services tested n Eight Web Services n A total of 25 operations n Four of the services are based on the TPC-App performance benchmark n Four other services have been adapted from code publicly available on the Internet n Implemented in Java and use a relational database 10

Web Services characterization 11

Tools studied n Penetration testing n HP WebInspect n IBM Rational AppScan n Acunetix Web Vulnerability Scanner n [Antunes 2009] n Static code analysis n FindBugs n Yasca n IntelliJ IDEA n Decided not to mention the brand of the tools n VS1, VS2, VS3, VS4 (without any order in particular) n SA1, SA2, SA3 (without any order in particular) 12

Tools and environment configuration n Penetration-testing n Underlying database restored before each test n This avoids the cumulative effect of previous tests n Guarantees that all the tools started the service testing in a consistent state n If allowed by the testing tool, information about the domain of each parameter was provided n If the tool requires an exemplar invocation per operation, the exemplar respected the input domains of operation n All the tools in this situation used the same exemplar n Static code analysis n Configured to fully analyze the services code n For the analyzers that use binary code, the deployment-ready version was used 13

Web Services manual inspection n It is essential to correctly identify the vulnerabilities that exist in the services code n A team of experts was invited to review the source code looking for vulnerabilities n False positives were eliminated by cross-checking the vulnerabilities identified by different people n A key difficulty is that different tools report (and count) vulnerabilities in different ways n Penetration testing: a vulnerability for each vulnerable parameter n Static analysis: a vulnerability for each vulnerable line in the service code 14

Vulnerabilities found 15

Penetration testing results 16

Examples of penetration testing limitations public void operation(string str) { try { String sql = "DELETE FROM table" + "WHERE id='" + str + "'"; statement.executeupdate(sql); } catch (SQLException se) {} } No return value; exceptions related with SQL mal-formation do not leak out to the invocator public String dumpdepositinfo(string str) { try { String path = "//DepositInfo/Deposit"+ "[@accnum='" + str + "']"; return csvfrompath(path); } catch (XPathException e) {} return null; } Lack of output information 17

Static code analysis results 18

Examples of static analysis limitations public void operation(string str) { int i = Integer.parseInt(str); try { String sql = "DELETE FROM table" + "WHERE id='" + str + "'"; statement.executeupdate(sql); } catch (SQLException se) {} } Analyzers identify the vulnerability because the SQL query is a non-constant string public String dumpdepositinfo(string str) { try { String path = "//DepositInfo/Deposit"+ "[@accnum='" + str + "']"; return csvfrompath(path); } catch (XPathException e) {} return null; } Depending on the complexity of csvfrompath method A static analysis tool may not be able to find the vulnerability 19

Penetration testing vs Static analysis (1) n Coverage 20

Penetration testing vs Static analysis (2) n False positives 21

Key observations n The coverage of static code analysis is typically higher than of penetration testing n False positives are a problem for both approaches n But have more impact in the case of static analysis; n Different tools report different vulnerabilities in the same piece of code n Even tools implementing the same approach frequently n Very poor results! 22

Conclusions n The effectiveness of vulnerability detection tools is very low n How to improve penetration testing? n Increase representativeness of the workload n Guarantee high coverage n Improve the attacks performed n Improve the vulnerability detection algorithms n How to improve static analysis? n Include new vulnerable code patterns n Merge penetration testing and static analysis? 23

Questions? 24