Iron Chef: John Henry Challenge



Similar documents
Secure Programming with Static Analysis. Jacob West

How I Learned to Stop Fuzzing and Find More Bugs

A Test Suite for Basic CWE Effectiveness. Paul E. Black.

Countering The Faults Of Web Scanners Through Byte-code Injection

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

Software Engineering Techniques

Software security specification and verification

All Your Code Belongs To Us Dismantling Android Secrets With CodeInspect. Steven Arzt Secure Software Engineering Group Steven Arzt 1

Interactive Application Security Testing (IAST)

SAF: Static Analysis Improved Fuzzing

Format string exploitation on windows Using Immunity Debugger / Python. By Abysssec Inc

Learning objectives for today s session

Precise XSS Detection with Static Analysis using String Analysis

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

Idea: Measuring the Effect of Code Complexity on Static Analysis Results

Secure in 2010? Broken in 2011!

Measuring the Effect of Code Complexity on Static Analysis Results

Eliminating SQL Injection and Cross-Site Scripting With Aspect Oriented Programming

THE BLIND SPOT IN THREAT INTELLIGENCE THE BLIND SPOT IN THREAT INTELLIGENCE

Using JML to protect Java code against SQL injection. Johan Janssen June 26, 2007

IMPROVING VULNERABILITY MANAGEMENT EFFECTIVENESS WITH APPLICATION SECURITY MONITORING

RIPS - A static source code analyser for vulnerabilities in PHP scripts

CHAPTER 5 INTELLIGENT TECHNIQUES TO PREVENT SQL INJECTION ATTACKS

Linux Kernel. Security Report

VA SOFTWARE ASSURANCE PROGRAM OFFICE

Securing Network Software using Static Analysis

Automatic vs. Manual Code Analysis

Software Vulnerabilities

AUTOMATE CRAWLER TOWARDS VULNERABILITY SCAN REPORT GENERATOR

Know your enemy. Class Objectives Threat Model Express. and know yourself and you can fight a hundred battles without disaster.

Bug hunting. Vulnerability finding methods in Windows 32 environments compared. FX of Phenoelit

Sandy. The Malicious Exploit Analysis. Static Analysis and Dynamic exploit analysis. Garage4Hackers

SAFECode Security Development Lifecycle (SDL)

X05. An Overview of Source Code Scanning Tools. Loulwa Salem. Las Vegas, NV. IBM Corporation IBM System p, AIX 5L & Linux Technical University

Braindumps.C questions

Adobe Systems Incorporated

Columbia University Web Security Standards and Practices. Objective and Scope

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

jmonitor: Java Runtime Event Specification and Monitoring Library

Comparing Application Security Tools

The Need for Fourth Generation Static Analysis Tools for Security From Bugs to Flaws

Detect and Sanitise Encoded Cross-Site Scripting and SQL Injection Attack Strings Using a Hash Map

Taking Event Correlation With You

The Web AppSec How-to: The Defenders Toolbox

The Art of Exploiting Logical Flaws in Web Apps. Sumit sid Siddharth Richard deanx Dean

Building Assurance Into Software Development Life- Cycle (SDLC)

TOOL EVALUATION REPORT: FORTIFY

Secure in 2010? Broken in 2011! Matias Madou, PhD Principal Security Researcher

Getting started with OWASP WebGoat 4.0 and SOAPUI.

HP Fortify Application Security Lucas v. Stockhausen PreSales Manager HP Fortify EMEA Enterprise Security

CSC230 Getting Starting in C. Tyler Bletsch

Glassbox: Open Source and Automated Application Troubleshooting. Ron Bodkin Glassbox Project Leader

Unix Security Technologies. Pete Markowsky <peterm[at] ccs.neu.edu>

MetaXSSploit. Bringing XSS in Pentesting A journey in building a security tool. Claudio

Hack-proof Your Drupal App. Key Habits of Secure Drupal Coding

Java Application Developer Certificate Program Competencies

A Study of Android Application Security

Database Application Developer Tools Using Static Analysis and Dynamic Profiling

Common Errors in C/C++ Code and Static Analysis

Static vs. Dynamic Testing How Static Analysis and Run-Time Testing Can Work Together. Outline

Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A

Passing PCI Compliance How to Address the Application Security Mandates

RE-TRUST Design Alternatives on JVM

Hands-on Hacking Unlimited

Developers and the Software Supply Chain. Andy Chou, PhD Chief Technology Officer Coverity, Inc.

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

APPLICATION SECURITY: FROM WEB TO MOBILE. DIFFERENT VECTORS AND NEW ATTACK

Seven Practical Steps to Delivering More Secure Software. January 2011

Client Side Cross Site Scripting

Source Code Review Using Static Analysis Tools

Agenda. SQL Injection Impact in the Real World Attack Scenario (1) CHAPTER 8 SQL Injection

Why Do Software Assurance Tools Have Problems Finding Bugs Like Heartbleed?

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

Entire contents 2011 Praetorian. All rights reserved. Information Security Provider and Research Center

STATIC CODE ANALYSIS Alexandru G. Bardas 1

QUIRE: : Lightweight Provenance for Smart Phone Operating Systems

Product Roadmap. Sushant Rao Principal Product Manager Fortify Software, a HP company

What is Web Security? Motivation

Transparent Monitoring of a Process Self in a Virtual Environment

elearning for Secure Application Development

Comparing the Effectiveness of Penetration Testing and Static Code Analysis

SQLITE C/C++ TUTORIAL

Transcription:

Iron Chef: John Henry Challenge Brian Chess Pravir Chandra Black Hat 3/27/2008 Amsterdam Sean Fay Jacob West

Concept We love Iron Chef. We can t cook.

Concept Compare tools and manual code review in head-tohead bake off Rules: 45 minutes to find vulnerabilities in the same program Chef with tools can only use tools he has written Secret ingredient: the code! Present results to a panel of celebrity judges Judging: Quality of findings Originality Presentation Bug Hunting First Chef Presents Second Chef Presents

Chefs Name: Pravir Chandra Specialty: Manual code review Job: Principle, Cigital

Chefs Name: Sean Fay Specialty: Static and runtime analysis Job: Chief Architect, Fortify Software

Sean Fay

Chefs

Chefs

Chefs After judging, you point out bugs these guys missed

Judges TBA TBA TBA

Secret Ingredient Name: Version: Language: Size: Home: Overview:

< start >

Runtime Analysis Black Hat 3/27/2008 Amsterdam

Dynamic Taint Propagation Follow untrusted data and identify points where they are misused

Example: SQL Injection... user = request.getparameter("user"); try { sql = "SELECT * FROM users " + "WHERE id='" + user + "'"; stmt.executequery(sql); }...

Tracking Taint 1. Associate taint marker with untrusted input as it enters the program 2. Propagate markers when string values are copied or concatenated 3. Report vulnerabilities when tainted strings are passed to sensitive sinks

Java: Foundation Add taint storage to java.lang.string Length Body Length Taint Body

Java: Foundation StringBuilder and StringBuffer propagate taint markers appropriately Untainted + Untainted = Untainted Untainted + Tainted = Tainted Tainted + Tainted = Tainted

Java: Sources Instrument methods that introduce input to set taint markers, such as: HttpServletRequest.getParameter() PreparedStatement.executeQuery() FileReader.read() System.getenv()...

Java: Sinks Instrument sensitive methods to check for taint marker before executing, such as: Statement.executeQuery() JspWriter.print() new File() Runtime.exec()...

Example: SQL Injection user = request.getparameter("user"); TaintUtil.setTaint(user, 1); try { sql = "SELECT * FROM users " + "WHERE id='" + user + "'"; TaintUtil.setTaint(sql,user.getTaint()); TaintUtil.checkTaint(sql); stmt.executequery(sql); }

Results Overview

Security Coverage

SQL Injection Issue

Source

Sink

Where is the Problem? Severity Category URL Critical SQL Injection /splc/listmyitems.do Class com.order.splc.itemservice Query select * from item where item name = adam and... Stack Trace Line 196 java.lang.throwable at StackTrace$FirstNested$SecondNested. <init>(stacktrace.java:267) at StackTrace$FirstNested. <init>(stacktrace.java:256) at StackTrace. <init>(stacktrace.java:246) at StackTrace. main(stacktrace.java:70)

Instrumentation Instrument JRE classes once Two ways to instrument program: Compile-time Rewrite the program's class files on disk Runtime Augment class loader to rewrite program

Aspect-Oriented Programming Express cross-cutting concerns independently from logic (aspects) Open source frameworks AspectJ (Java) AspectDNG (.NET) Could build home-brew instrumentation on top of bytecode library (BCEL, ASM)

Example public aspect SQLInjectionCore extends... { //Statement pointcut sqlinjectionstatement(string sql): (call(resultset Statement+.executeQuery(String)) && args(sql))... }

Instrument Inside or Outside? Inside function body Lower instrumentation cost Outside function call Lower runtime cost / better reporting

Types of Taint Track distinct sources of untrusted input Report XSS on data from the Web or database, but not from the file system Distinguish between different sources when reporting vulnerabilities Prioritize remotely exploitable vulnerabilites

Java: Foundation Round 2 Add taint storage and source information to java.lang.string storage Length Taint Body Length Taint Source Body

Writing Rules Identifying the right methods is critical Missing just one source or sink can be fatal Leverage experience from static analysis Knowledge of security-relevant APIs

Static Analysis Black Hat 3/27/2008 Amsterdam

Prehistoric static analysis tools RATS Flawfinder ITS4

Prehistoric static analysis tools (+) Good Help security experts audit code Repository for known-bad coding practices (-) Bad NOT BUG FINDERS Not helpful without security expertise RATS Flawfinder ITS4

Advanced Static Analysis Tools: Prioritization int main(int argc, char* argv[]) { char buf1[1024]; char buf2[1024]; char* shortstring = "a short string"; strcpy(buf1, shortstring); /* eh. */ strcpy(buf2, argv[0]); /*!!! */... }

Static Analysis Is Good For Security Fast compared to manual review Fast compared to testing Complete, consistent coverage Brings security knowledge with it Makes security review process easier for non-experts Useful for all kinds of code, not just Web applications

What You Won t Find Architecture errors Microscope vs. telescope Bugs you re not looking for Bug categories must be predefined System administration mistakes User mistakes

Under the Hood

Building a Model Front end looks a lot like a compiler Language support One language/compiler is straightforward Lots of combinations is harder Could analyze compiled code Everybody has the binary No need to guess how the compiler works No need for rules but Decompilation can be difficult Loss of context hurts. A lot. Remediation requires mapping back to source anyway

Capacity: Scope vs. Performance

Only Two Ways to Go Wrong False positives Incomplete/inaccurate model Missing rules Conservative analysis False negatives Incomplete/inaccurate model Missing rules Forgiving analysis The tool that cried wolf! Missing a detail can kill. Developer Auditor

Rules: Dataflow Specify Security properties Behavior of library code buff = getinputfromnetwork(); copybuffer(newbuff, buff); exec(newbuff); Three rules to detect the command injection vulnerability 1) getinputfromnetwork() postcondition: return value is tainted 2) copybuffer(arg1, arg2) postcondition: arg1 array values set to arg2 array values 3) exec(arg) precondition: arg must not be tainted

Rules: Control Flow Look for dangerous sequences Example: Double-free vulnerability while ((node = *ref)!= NULL) { *ref = node->next; free(node); if (!unchain(ref)) { break; } } if (node!= 0) { free(node); return UNCHAIN_FAIL; } (other operations) (other operations) start initial state freed error free(x) free(x)

Rules: Control Flow Look for dangerous sequences Example: Double-free vulnerability while ((node = *ref)!= NULL) { *ref = node->next; free(node); if (!unchain(ref)) { break; } } if (node!= 0) { free(node); return UNCHAIN_FAIL; } (other operations) (other operations) start initial state freed error free(x) free(x)

Rules: Control Flow Look for dangerous sequences Example: Double-free vulnerability while ((node = *ref)!= NULL) { *ref = node->next; free(node); if (!unchain(ref)) { break; } } if (node!= 0) { free(node); return UNCHAIN_FAIL; } (other operations) (other operations) start initial state freed error free(x) free(x)

Displaying Results Must convince programmer that there s a bug in the code Different interfaces for different scenarios: Security auditor parachutes in to 2M LOC Programmer reviews own code Programmers share code review responsibilities Interface is just as important as analysis Don t show same bad result twice Try this at home: Java Open Review http://opensource.fortify.com Bad interface Your Code Sucks. OK

Interface

Iron Chef: John Henry Challenge Brian Chess Pravir Chandra Black Hat 3/27/2008 Amsterdam Sean Fay Jacob West