A Test Suite for Basic CWE Effectiveness. Paul E. Black. paul.black@nist.gov. http://samate.nist.gov/



Similar documents
Source Code Security Analysis Tool Functional Specification Version 1.0

Measuring the Effect of Code Complexity on Static Analysis Results

Using the Juliet Test Suite to compare Static Security Scanners

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

Gold Standard Method for Benchmarking C Source Code Static Analysis Tools

Using Static Code Analysis Tools for Detection of Security Vulnerabilities

Source Code Review Using Static Analysis Tools

Static Analysis Tool Exposition (SATE) 2008

Real World Software Assurance Test Suite: STONESOUP

Secure Programming with Static Analysis. Jacob West

D. Best Practices D.1. Assurance The 5 th A

KEN VAN WYK. Fundamentals of Secure Coding and how to break Software MARCH 19-23, 2007 RESIDENZA DI RIPETTA - VIA DI RIPETTA, 231 ROME (ITALY)

Web Application Report

Application Intrusion Detection

Iron Chef: John Henry Challenge

More Repeatable Vulnerability Assessment An introduction

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

The Road from Software Testing to Theorem Proving

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

DISCOVERY OF WEB-APPLICATION VULNERABILITIES USING FUZZING TECHNIQUES

Attack Vector Detail Report Atlassian

Security Vulnerabilities in Open Source Java Libraries. Patrycja Wegrzynowicz CTO, Yonita, Inc.

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

TOOL EVALUATION REPORT: FORTIFY

Software security assessment based on static analysis

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

Software security specification and verification

How to achieve PCI DSS Compliance with Checkmarx Source Code Analysis

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

What is Web Security? Motivation

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

STATIC CODE ANALYSIS Alexandru G. Bardas 1

Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security

(General purpose) Program security. What does it mean for a pgm to be secure? Depends whom you ask. Takes a long time to break its security controls.

Application Code Development Standards

CS 241 Data Organization Coding Standards

Early Vulnerability Detection for Supporting Secure Programming

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

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

CSCI E 98: Managed Environments for the Execution of Programs

Quiz I Solutions MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Department of Electrical Engineering and Computer Science

Comparison of Secure Development Frameworks for Korean e- Government Systems

Linux Kernel. Security Report

- Table of Contents -

Development. Resilient Software. Secure and. Mark S. Merkow Lakshmikanth Raghavan. CRC Press. Taylor& Francis Croup. Taylor St Francis Group,

Securing PHP Based Web Application Using Vulnerability Injection

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

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

The C Programming Language course syllabus associate level

Columbia University Web Security Standards and Practices. Objective and Scope

Jonathan Worthington Scarborough Linux User Group

The programming language C. sws1 1

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

CS 356 Lecture 23 and 24 Software Security. Spring 2013

How to Build a Trusted Application. John Dickson, CISSP

Web application security: automated scanning versus manual penetration testing.

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

Application Security Testing How to find software vulnerabilities before you ship or procure code

Programming Flaws and How to Fix Them

Crash Course in Java

Web App Security Audit Services

<Insert Picture Here> What's New in NetBeans IDE 7.2

TECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction

ERNW Newsletter 51 / September 2015

Detecting Software Vulnerabilities Static Taint Analysis

Database Security Guide

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

Introduction to Automated Testing

SAFECode Security Development Lifecycle (SDL)

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

Last update: February 23, 2004

2,000 Websites Later Which Web Programming Languages are Most Secure?

Facebook Twitter YouTube Google Plus Website

90% of data breaches are caused by software vulnerabilities.

DFW INTERNATIONAL AIRPORT STANDARD OPERATING PROCEDURE (SOP)

El Dorado Union High School District Educational Services

An Implementation of a Tool to Detect Vulnerabilities in Coding C and C++

Redefining Static Analysis A Standards Approach. Mike Oara CTO, Hatha Systems

Manual vs. Automated Vulnerability Assessment: ACaseStudy

I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation. Mathias Payer, ETH Zurich

Testing for Security

Rapid Security Framework (RSF) Taxonomie, Bewertungsparameter und Marktanalyse zur Auswahl von Fuzzing-Tools

Promoting Application Security within Federal Government. AppSec DC November 13, The OWASP Foundation

Introduction to Static Analysis for Assurance

Penetration Testing Guidelines For the Financial Industry in Singapore. 31 July 2015

Payment Card Industry (PCI) Terminal Software Security. Best Practices

8.5. <summary> Cppcheck addons Using Cppcheck addons Where to find some Cppcheck addons

Transcription:

A Test Suite for Basic CWE Effectiveness Paul E. Black paul.black@nist.gov http://samate.nist.gov/

Static Analysis Tool Exposition (SATE V) News l We choose test cases by end of May l Tool output uploaded to NIST web site by end of July (end of August at latest) l Use Coverage Claims Representation l Experience workshop in early 2014 l Prizes for best test cases l We invite tool users to be on planning committee static analysis tool makers to participate 2

Statistics, the Universe of Programs, and Everything Relevant (SUPER) l We want a set of small programs that statistically represent all programs. l But, what is the universe, i.e., all programs? l All strings of characters? All programs that compile? Everything a competent programmer would write? Including malware and obfuscated code? Generated code? l What statistics do we want? Can we even pose reasonable questions? l Let s get statisticians, computer scientists, and others together in a workshop. 3

Common Weakness Enumeration (CWE) l A dictionary of every kind of bug or flaw in software. l More than 600 distinct classes For instance, buffer overflow, OS injection, race condition, cross-site scripting, directory traversal, left-over debug code, hard-coded password, and insecure random number generator. http://cwe.mitre.org/ 4

MITRE s CWE Compatibility and Effectiveness Program l Phase 1 Declare compatibility l Phase 2 Verify mapping to CWEs l Phase 3 Test cases whose results allow [one] to understand which CWE identifiers [a] capability is effective in locating http://cwe.mitre.org/compatible/program.html 5

Start With CWE-121 Stack-based Buffer Overflow in C Language l It is a frequent, serious problem. l It is well-defined and easily understood. l We have thousands of examples. l It is addressed by static analysis, compiletime techniques, or run-time detection.

We Propose a Test Suite for Basic CWE Effectiveness 7

What is the Test Suite Like? l Publicly available l Consists of a small number of programs l Each program is short code is vulnerable, i.e., exploitable standard code (no language extensions) (usually) synthetic fairly clean 8

Background Work l Over the summer NIST researchers installed five static analyzers, then examined 7,338 cases in 9,962 files from Juliet (split into 5,892 good & bad cases) Kratkiewicz (1,139 cases) KDMA TCG (249 cases) 2005 Fortify (41 cases) other SRD (17 cases)

Proposed CWE-121 Basic Set l It consists of five cases. l The most basic case is basic-00001-min.c char buf[10];! buf[10] = A ;!

Two More Cases l basic-00034-min.c access through a pointer! *(buf + 10) = A ;! l basic-00045-min.c library function!strcpy(buf, "AAAAAAAAAA");

Last Two Cases l basic-00182-min.c fgets(): limited copy and external input!fgets(buf, 11, f);! l stack_overflow_loop.c variable index; bad bounds check for (unsigned i=1;i<=10;++i) {! bstr[i] = (char)i + A ;!

Next Step Code Complexities l to "articulate what types of complexity in software [a] capability is most successful at dealing with..." 13

What is Code Complexity?!!!!!! char data;! data = C ;! data = Z ;! printhexcharline(data);! char data;! if (1) {! data = C ;! } else {! data = C ;! printhexcharline(data);! }! if (1) {! data = Z ;! printhexcharline(data);! } else {! printhexcharline(data);! }! CWE-563 Unused Variable, after SRD test cases 35455 and 35456 14

Complexity Factors l Other fns: str(n)cpy/cat, memcpy/move, s(n)printf l Separate files (casea.c & caseb.c) l Duplicate variable or function names l Dynamic allocation (alloca); other scopes l Complex expressions in index, allocation, tests, etc. l Data Types l Containers (buffer in struct) l Unreachable and dead code l Open coded or obfuscated str(n)cpy() l Weakness vs. Vulnerability 15

More Complexity Factors l Unflawed cases (for false positive) l Minimal ( fake ) parsing l Alias (passed through other variables) l Access by array or pointer l Read or write access l Gravity (just outside buffer or far beyond) l Continuity (every element or jumping) l Control flow & loop structure l Intervening path l Taint source 16

What about tool short cuts? l Tool makers may build to a public, static set. A secret or dynamic set has other problems. l Change comments and identifier names for every download? l Add innocuous statements? l Transform code, like unroll loops? Proposal: l If concerns arise, privately corroborate results. 17

The Problem l Sound analysis is not perfect anyway. l No test set can show all possible bugs, heuristics, variants, and corner cases. l How thorough should the test set be? Snake oil 18

Measurement is Multidimensional 19

SAMATE Reference Dataset http://samate.nist.gov/srd/ l Public repository for softassurance test cases l Over 60,000 cases in C, C++, Java, C#, and Python l Search and select by language, weakness, etc. l Contributions from CAS, Fortify, Defence R&D Canada, Klocwork, MIT Lincoln Laboratory, Praxis, Secure Software, etc.

Juliet 1.1 Test Suite l 81,056 small C/C++ and Java programs covering 181 weakness classes l Each case is one or two pages of code l Organized by weakness, then variant, then complexity l Described in IEEE Computer, Oct 2012 21

STONESOUP 1 cases l About 460 cases in Java and C, each a program typically 200-300 lines long l Cover weaknesses in Number Handling (e.g. integer overflow), Tainted Data (e.g. input validation, Injection (e.g. command injection, Buffer Overflow, and Null Pointer l Each case has inputs triggering the vulnerability, as well as safe inputs l Available as test suites

Kratkiewicz MIT cases l 1164 cases in C for CWE-121 Stack-Based Buffer Overflow l Created to investigate static analysis and dynamic detection methods l Each case is one of four variants: access within bounds (ok) access just outside bound (min) somewhat outside bound (med) far outside bound (large) l Code complexities: index, type, control,

Other SRD Content l Zitser, Lippmann, & Leek MIT cases 28 slices from BIND, Sendmail, WU-FTP, etc. l Fortify benchmark 112 C and Java cases l Klocwork benchmark 40 C cases l 25 cases from Defence R&D Canada l Robert Seacord, Secure Coding in C and C++ 69 cases l Comprehensive, Lightweight Application Security Process (CLASP) 25 cases l 329 cases from our static analyzer suite