Model-Based Fuzzing for Security Testing



Similar documents
Automatic Test Data Generation for TTCN-3 using CTE

TECHNICAL REPORT Methods for Testing and Specification (MTS); Security Testing; Basic Terminology

Introduction to Automated Testing

Peach Fuzzer Platform

Model-Based Vulnerability Testing for Web Applications

Automating Security Testing. Mark Fallon Senior Release Manager Oracle

dominique <dot> toupin <at> ericsson <dot> com GYORGY <dot> RETHY <at> ericsson <dot> com

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

How To Test A Web Based Application Automatically

The GO4IT IPv6 Test Tool and Associated services. Alain Vouffo FOKUS (Fraunhofer Institute for Open Communication Systems)

Automated Target Testing with TTCN-3: Experiences from WiMAX Call Processing Features

Development and Industrial Application of Multi-Domain Security Testing Technologies. Innovation Sheet Model Inference Assisted Evolutionary Fuzzing

NTP-PoCT: A conformance test tool for push-to-talk over cellular network

Risk Assessment and Security Testing Johannes Viehmann 2015 of Large Scale Networked Systems with RACOMAT

Distributed Load Tests with TTCN-3

Application Code Development Standards

Introduction to TTCN-3

APPLICATION OF MULTI-AGENT SYSTEMS FOR NETWORK AND INFORMATION PROTECTION

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

Review of Mobile Applications Testing with Automated Techniques

A Brief Overview of Software Testing Techniques and Metrics

UML-based Test Generation and Execution

PERFORMANCE COMPARISON OF COMMON OBJECT REQUEST BROKER ARCHITECTURE(CORBA) VS JAVA MESSAGING SERVICE(JMS) BY TEAM SCALABLE

Compliance and Requirement Traceability for SysML v.1.0a

The Advantages of Block-Based Protocol Analysis for Security Testing

Testing automation of projects in telecommunication domain

3.4 Rikke Kuipers, Ari Takanen/ Fuzzing embedded devices

Component visualization methods for large legacy software in C/C++

Model Driven Testing AGEDIS Architecture Interfaces and Tools

What is a life cycle model?

Automated Model Based Testing for an Web Applications

Monitoring Infrastructure (MIS) Software Architecture Document. Version 1.1

Architecture Design & Sequence Diagram. Week 7

Rotorcraft Health Management System (RHMS)

Secure Web Development Teaching Modules 1. Security Testing. 1.1 Security Practices for Software Verification

Utilizing Domain-Specific Modelling for Software Testing

protocol fuzzing past, present, future

Applying 4+1 View Architecture with UML 2. White Paper

Detecting SQL Injection Vulnerabilities in Web Services

DISCOVERY OF WEB-APPLICATION VULNERABILITIES USING FUZZING TECHNIQUES

Supporting Document Mandatory Technical Document. Evaluation Activities for Stateful Traffic Filter Firewalls cpp. February Version 1.

GUI Test Automation How-To Tips

Oracle Service Bus Examples and Tutorials

Interactive Application Security Testing (IAST)

How To Develop Software

My First TTCN-3 Project with TTworkbench

Industrial Network Security and Connectivity. Tunneling Process Data Securely Through Firewalls. A Solution To OPC - DCOM Connectivity

Detection and mitigation of Web Services Attacks using Markov Model

Software Architecture Document

Static Analysis of Dynamic Properties - Automatic Program Verification to Prove the Absence of Dynamic Runtime Errors

A Framework of Model-Driven Web Application Testing

Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

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

Software Development Kit

High Level Design Distributed Network Traffic Controller

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

Test Management Tool for Risk-based Security Testing

SOA, case Google. Faculty of technology management Information Technology Service Oriented Communications CT30A8901.

Easy configuration of NETCONF devices

The Hacker Strategy. Dave Aitel Security Research

ITDUMPS QUESTION & ANSWER. Accurate study guides, High passing rate! IT dumps provides update free of charge in one year!

Basic Unix/Linux 1. Software Testing Interview Prep

business transaction information management

Requirements engineering

MODEL DRIVEN DEVELOPMENT OF BUSINESS PROCESS MONITORING AND CONTROL SYSTEMS

JOURNAL OF OBJECT TECHNOLOGY

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

Combining Security Risk Assessment and Security Testing based on Standards

Index Terms Domain name, Firewall, Packet, Phishing, URL.

Model-Based Testing of Web Applications using NModel

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

TEST AUTOMATION FRAMEWORK

ensuring security the way how we do it

Real World Web Service Testing For Web Hackers

Fuzzing in Microsoft and FuzzGuru framework

Levels of Software Testing. Functional Testing

A JDF-enabled Workflow Simulation Tool

Design by Contract beyond class modelling

Service-oriented Development of Federated ERP Systems

Technical Security in Smart Metering Devices: A German Perspective S4 SCADA Security Scientific Symposium , Miami Beach FL / USA

Model-based Testing: Next Generation Functional Software Testing

Instrumentation Software Profiling

Hillstone T-Series Intelligent Next-Generation Firewall Whitepaper: Abnormal Behavior Analysis

What is Fuzzing: The Poet, the Courier, and the Oracle

Advanced TTCN-3 Test Suite validation with Titan

Transcription:

Model-Based Fuzzing for Security Testing Ina Schieferdecker, Jürgen Großmann, Martin Schneider Fraunhofer FOKUS 21 April 2012, Montreal, Canada

My Testing Context Research and Teaching at FU Berlin Applied research at Fraunhofer FOKUS Standardization at ETSI and OMG ITEA Project DIAMONDS Titel, Datum

Outline Introduction The Project Context Behavior Fuzzing with Sequence Diagrams Data Fuzzing with TTCN-3

Do you have a feeling about security?

Terminology Security testing Testing whether a system under test meets the specified security objectives. Model-based testing Model-based testing is an umbrella of approaches that generate tests from models. Model-based security testing Is an umbrella of approaches that generate tests from model, where the tests check if a system under test meets the specified security objectives. Model-based fuzzing is one of the approaches to randomize tests in a smart manner.

Risk, Vulnerabilities and Testing

Outline Introduction The Project Context Behavior Fuzzing with Sequence Diagrams Data Fuzzing with TTCN-3

DIAMONDS Objectives Security engineering is increasingly challenged by - the openness, - dynamics, and - distribution of networked systems Most verification and validation techniques for security have been developed in the framework of static or known configurations, with full or well-defined control of each component of the system This is not sufficient in networked systems, where control and observation of remote (sub) systems are dynamically invoked over the network Combination of active and passive security testing Usage of fuzz tests (for unknown issues) and functional tests (for security measures) Combination of risk analysis and test generation Integration of automated test generation, test execution and monitoring

ITEA2 DIAMONDS Project Diamonds will enable efficient and automated security testing methods of industrial relevance for highly secure systems in multiple domains (incl. e.g. banking, transport or telecommunication) Business Value Multiple Domains Pre-Standardization Work Novel Integration of Testing, Security and Risk-Analysis Expected Results Risk-driven Security Testing Methodology Model-Based Security Test Techniques Security Test Patterns Catalogue

Model-Based Testing in a Nutshell Test models enable objective test procedures, knowledge sustainment, test quality assessment, test reuse, and technology-independence

Model-Based Testing for Security Security objectives Security targets & scenarios Hypotheses Randomization Metrics Performance & Evaluation

Combination of Approaches Security Risk Analysis and Risk-Oriented Testing Model-Based Fuzz Testing (Randomized) Model-Based Security Testing Model-Based Functional Testing (Systematic) Test Automation (Execution)

Security Testing Framework Security Test Design Patterns Catalogue Test Designer Security- Oriented Risk Analysis Risk Engineer Test Models Security Testing Framework Security Engineer Vulnerability Databases Test Automation Engineer Functional and Fuzz Security Tests Monitoring Security Property Evaluation

Outline Introduction The Project Context Behavior Fuzzing with Sequence Diagrams Data Fuzzing with TTCN-3

Fuzz Testing Fuzzing originally describes the random generation of test vectors (Miller et. al. in the early 1990s). Fuzzing is about injecting invalid or random inputs in order - to reveal unexpected behaviour - to identify errors and expose potential vulnerabilities. Ideally, fuzzers generate semi-valid input data, i.e. input data that is invalid only in small portions. specified functionality negative input space (unlimited), target of random fuzzing Depending on fuzzer s knowledge about the protocol, fuzzers can generate totally invalid to semi-valid input data. target of model based fuzzing see also: Takanen, DeMott, Miller: Fuzzing for Software Security and Quality Assurance. Artech House, 2008.

Categorization of Fuzzers dumb smart Random-based fuzzers generate randomly input data. They don t know nearly anything about the SUT s protocol. fuzzed input: HdmxH&k dd#**&% Template-based fuzzers use existing traces (files, ) and fuzz parts of the recorded data. template: GET /index.html fuzzed input: GE? /index.html, GET /inde?.html Block-based fuzzers break individual protocol messages down in static (grey) and variable (white) parts and fuzz only the variable part. GET /index.html only the (white) part gets fuzzed fuzzed input: GET /inde?.html, GET /index.&%ml Dynamic Generation/Evolution-based fuzzers learn the protocol of the SUT from feeding the SUT with data and interpreting its responses, e.g. using evolutionary algorithms. While learning the protocol, these fuzzers implicitly run fuzzing. Model-based fuzzers employ a model of the protocol. The model is executed on- or offline to generate complex interactions with the SUT. Thus, it is possible to fuzz data after passing a particular point (e. g. after authentication).

Model-Based Fuzz Testing Random fuzzing: has close to zero awareness of the tested interface Mutation-based fuzzing: mutate existing data samples to create test data, breaks the syntax of the tested interface into blocks of data, which it semi-randomly mutates. Model-based fuzz testing: - Uses models of the input domain (protocol models, e.g. context-free grammars), for generating systematic non-random test cases - In security testing purposes, the models are augmented with intelligent and optimized anomalies that will trigger the vulnerabilities in code. - Finds defects which human testers would fail to find Ari Takanen, Jared D. DeMott, and Charles Miller: Fuzzing for Software Security Testing and Quality Assurance; ISBN 978-1-59693-214-2 Copyright 2008 PROTOS project. www.ee.oulu.fi/protos

Mutation Testing & Fuzzing Mutation testing is used for two purposes: to assess a software component for anomalous inputs, to assess the quality of test cases for finding specific defects, to simulate usage situations that are difficult to test. There are two types of mutation testing: a) Data Fault Injection This is traditional data fuzzing submitting invalid or semi-valid input data to the SUT. b) Code Fault Injection on the side of the SUT Code Fault Injection is the modification of the SUT s code by adding typical programming errors. That way quality of test suites can be assessed. Besides the above-mentioned types of mutation testing, the operational interface of the SUT can be stimulated in an invalid way. This type of mutation testing is called behaviour fuzzing.

Banking Domain Case Study: Banknote Processing Machines

Banking Domain Case Study: Olymp Currency Processing Network CP = Currency Processor RS = Reconciliation Station CC = Control Center VMS = Vault Management System external peripherals external peripherals CP CP CP CC WAN LAN CC Firewall CC / GW RS RS VMS Data Flow : VMS deposit data CP configure & monitor CP CC CC Shift + Reject data updated Shift + Reject data RS RS RS

Banking Domain Case Study: TTCN-3 based Test Architecture Test Goal Integration testing of any configurable subsystem. Overview Components not part of the system under test (SUT) are replaced by the tester. The system is stimulated and observed by sending and receiving the C# objects. Challenges C/C# interoperability between tester and SUT. C# object type representation in TTCN-3 Transfer between TTCN-3 messages and C# object representations. Tester (TTCN-3) Interoperability Layer (managed C++) SA Implementation (C#) Software Bus Software Bus Comp. 3 Comp. 3 Comp. 4 Comp. 5

Banking Domain Case Study: Processing Steps Risk Analysis Modeling Test Generation TTCN-3 Code Generation Test Execution

Development: Behaviour Fuzzing of UML Sequence Diagrams In current state of the art, behaviour fuzzing is done only in small portions using state machines: - by fuzzing the message type, - by reordering messages and - by inserting, repeating and dropping messages. The motivation for behaviour fuzzing is that vulnerabilities can be revealed not only when invalid input data is accepted and processed by the SUT, but also by stimulating the SUT with invalid sequences of messages. To start with, we fuzz existing functional test cases. A real-world example is given in [Tak10] where a vulnerability in Apache web server was found by repeating the host header message in an HTTP request. [Tak10] Takahisa, K.; Miyuki, H.; Kenji, K.: "AspFuzz: A state-aware protocol fuzzer based on application-layer protocols," Computers and Communications (ISCC), 2010 IEEE Symposium on, vol., no., pp.202-208, 22-25 June 2010

Development: Behaviour Fuzzing of UML Sequence Diagrams Test cases are generated by fuzzing valid sequence diagrams, e.g. functional test cases. Behaviour fuzzing is realized by changing the order and appearance of messages in two ways: - By rearranging messages. This enables straight-lined sequences to be fuzzed. Fuzzing operations are for example remove, move or repeat a message. - By utilising control structures of UML 2 sequence diagrams, such as combined fragments, guards, constraints and invariants. This allows more sophisticated and specific behaviour fuzzing. By applying one ore more fuzzing operations to a valid sequence, invalid sequences (= behaviour fuzzing test cases) are generated. valid sequence Behaviour Fuzzing invalid sequence Client Apache Fuzzer Apache 1: GET /infotext.html HTTP/1.1 2: Host: www.example.net Repeat Message 2: Host 1: GET /infotext.html HTTP/1.1 2: Host: www.example.net 3: Host: www.example.net

Original vs. Fuzzed TTCN-3 Code Starting with Known Behaviour Original Test Case SYSTEM INITIALIZATION var integer i, v_total, v_rjc; f_mtcsetup_cp_rs(cprsstartingmode:all); AUTHENTICATION f_cp_logon("op1"); CONFIGURATION f_cp_selectprocessingmodeus ( ); f_cp_selectdenominationus ( ); f_cp_selectoperationmodeus ( ); f_cp_selectstackingmodeus ( ); COUNTING f_cp_bnprocessing( ); f_cp_bnprocessingwithbarcode ( ); f_cp_bnprocessingwithwarning ( );... COMPLETION f_cp_endshift(); Fuzzed Test Case SYSTEM INITIALIZATION var integer i, v_total, v_rjc; f_mtcsetup_cp_rs(cprsstartingmode:all); f_cp_selectstackingmodeus ( ); AUTHENTICATION f_cp_logon("op1"); CONFIGURATION f_cp_selectprocessingmodeus ( ); f_cp_selectdenominationus ( ); f_cp_selectoperationmodeus ( ); COUNTING f_cp_bnprocessing( ); f_cp_bnprocessingwithbarcode ( ); f_cp_bnprocessingwithwarning ( );... COMPLETION f_cp_endshift();

Behavior Fuzzing Banking Domain Case Study Results so far Running successfully over 30 test cases, no weaknesses found Challenges Test execution takes more than 15 minutes per test case, optimization is needed Test evaluation and assessment is difficult (system crashes, error modes, etc.) Large number of generated test cases incl. duplicates (commutative equal combinations, e.g. the combination of the fuzzing operations move message A, remove message A is equal to remove message A ) Outlook Optimized test generation (risk and security-oriented test generation, avoiding duplicates) 45000 Combination with data fuzzing methods 40000 35000 Remove Defining metrics and coverage criteria 30000 number of test cases 25000 20000 15000 10000 5000 0 1 2 3 number of fuzzing operations per test case Repeat Move Remove, Repeat Remove, Move Repeat, Move Remove, Repeat, Move

Outline Introduction The Project Context Behavior Fuzzing with Sequence Diagrams Data Fuzzing with TTCN-3

Test Execution with TTCN-3 TTCN-3: Testing and Test Control Notation Abstract test specification Data templates allow unlimited structuring and reusability of test data Matching mechanism to compare an oracle to response data Communication paradigms: message and procedure oriented ports Parallel test components Concrete test implementation adapter and codec (coder/decoder of data types) Test System Test Management (TM) Component Handling (CH) System Adapter (SA) (SA) System under Test TTCN-3 Executable (TE) Test Logging(TL) Coding Decoding (CD) Platform Adapter (PA) Official web page: http://www.ttcn-3.org Standard: http://www.ttcn-3.org/standardsuite.htm Tool: TTworkbench: http://www.testingtech.com/

TTCN-3 Multi-Part Standard ETSI ES 201 873-1 ETSI ES 201 873-2 ETSI ES 201 873-3 ETSI ES 201 873-4 ETSI ES 201 873-5 ETSI ES 201 873-6 ETSI ES 201 873-7 ETSI ES 201 873-8 ETSI ES 201 873-9 ETSI ES 201 873-10 TTCN-3 Core Language (CL) TTCN-3 Tabular Presentation Format (TFT) TTCN-3 Graphical Presentation Format (GFT) TTCN-3 Operational Semantics TTCN-3 Runtime Interface (TRI) TTCN-3 Control Interfaces (TCI) Integration of ASN.1 Integration of IDL Integration of XML TTCN-3 Documentation TTCN-3 Extension packages ETSI ES 202 78x - Advanced Parametrization - Behaviour Types - Configuration and Deployment Support - Performance and Real Time Testing - Extended Runtime Adaptation Standard available for download at http://www.ttcn-3.org Also standardized by the ITU-T as ITU-T Z.140

TTCN-3 designed for interface, service, protocol,, system testing System Under Test (SUT) TTCN-3 Test Case Port Port.send(Stimulus) Port.receive(Response) Assignment of a Test Verdict

TTCN-3 static and dynamic test configurations SUT TTCN-3 Test Case create start TC MTC TCs start create TC create start

Major language elements of TTCN-3 notation (1) Module Definitions Imports Data Types Test Data Test Configuration Test Behavior Importing definitions from other modules defined in TTCN-3 or other languages User defined data types (messages, PDUs, information elements, ) Test data transmitted/expected during test execution (templates, values) Definition of the test components and communication ports Specification of the dynamic test behavior

Major language elements of TTCN-3 notation (2) Type definitions: boolean, integer, float, bitstring, charstring, octectstring, hexstring record, set, enumeration, union Programming constucts: message: send/receive procedure: call/getcall, reply/getreply, raise/catch if-then-else, loops: for, while, do-while functions, alternatives component/port/timer control Predefined functions: type conversion, lengthof (string), sizeof (records), Overview: e.g. TTCN-3 Quick Reference Card xxx relevant for data fuzzing

TTCN-3 Template Define test data for information sent to and received from the SUT - Type-based templates - Signature templates - Global and local templates - Inline templates - Modified templates - Template matching mechanisms 34

Main TTCN-3 Matching Mechanisms 35

General Considerations Providing a light-weight extension for TTCN-3 to maximize the usability of the extension for existing TTCN-3 users Matching mechanisms can be used with a new special mechanisms fuzz( ) for templates to be sent Supporting repeatability of fuzz test cases performed via TTCN-3 a seed can be used to support repeatability when generating fuzzed data

New Mechanism fuzz( ) fuzz can be used instead of values to define a list of values or templates Only for templates to be sent A single value will be selected when sending a template or invoking the valueof operation Has one or two arguments: 1. shall be of the type return by fuzz and can be a concrete value or a matching mechanism 2. optional charstring denoting a fuzzing generator or operator. Loop to repeat a test case with different fuzz data to be realized in the module control part

New Mechanism fuzz( ) Example: type record mydata { charstring field1, octetstring field2, integer field3 } template mytype mydata := { field1 := fuzz(?, UnicodeUtf8ThreeCharGenerator"), field2 := '12AB'O, field3 := fuzz(123) } field1 retrieves a value that is generated by UnicodeUtf8ThreeCharGenerator field3 retrieves a value generated by applying appropriate fuzzing operators to the number 123

Maintaining Repeatability of Test Cases Fuzz data is often randomly generated which interferes with repeatability of test cases. In order to maintain repeatability of test cases, a seed is used for randomly generated or mutated fuzz testing values: The seed is optional. It can be read and set using two predefined functions getseed and setseed.

Data Fuzzing Approach Make traditional data fuzzing widely available - allow an easy integration into tools - without deep knowledge about fuzz data generation Allow data fuzzing without the need for - making familiar with a specific fuzzing tool - integrating further fuzzing tools into the test process Approach: - don t reinvent the wheel, use the potential of existing fuzzing tools: Peach Sulley OWASP WebScarab - extract their fuzzing generators and operators into a library (reimplementation in Java)

Data Fuzzing Library with TTCN-3 Allows generation and mutation-based fuzzing Platform independent: the library is implemented on Java running on many platforms Language independent: the library provides an XML-based interface Efficient: the user can decide - which fuzzing operators shall be used allows adjusting of the library to fit specific requirements, e.g. only generate fuzz testing values based on valid values (for instance taken from functional testing) - how many values shall be generated by the library avoids transmission of billions of values at once Communicative: the fuzzing library tells you which fuzzing operators are used, so you can request more values only from this fuzzing operator if one fuzz testing value generated by a specific fuzzing operator found bugs in your software

Tool Architecture

Generators and Operators Generators Peach Sulley StringCaseMutator O UnicodeStringsMutator G UnicodeBomMutator G UnicodeBadUtf8Mutator G UnicodeUtf8ThreeCharMutator G StringMutator G PathMutator G HostnameMutator G FilenameMutator G BadIpAddress G BadNumbers G BadDate G BadTime G FiniteRandomNumbersMutator G String Repetition O SQL Injection G Command Injection G Format String G Generators Peach Sulley OWASP WebScarab Delimiter RegExExpander Numerical Edge Case Mutator G G Numerical Variance Mutator LongString G G/O O G

DataFuzzing Banking Domain Case Study Results yet to come

Summary Security testing - Is needed and challenging - Requires additional approaches for MBT - Ongoing work Systematic and automated security testing - Model-based fuzzing using models on the data and behaviour that is being mutated in such a way that the number of test cases are significantly reduced our approach is to fuzz functional tests - Risk-oriented testing uses risk analysis results for test identification, test selection and test assessment to prioritize and optimize the test process our approach is to extend CORAS and combine it with Fokus!MBT - Security test pattern catalogue capturing expert knowledge on what to test in which context (kind of system, security goal) and allow the reuse of this knowledge within a slightly different context our approach is to relate vulnerabilities and test patterns

Selected References A. Takanen, J. DeMott, Ch. Miller (2008). Fuzzing for Software Security Testing and Quality Assurance. Artech House. J. DeMott, R. Enbody, W. Punch. (2007) Revolutionizing the Field of Grey-box Attack Surface Testing with Evolutionary Fuzzing. A. Takanen. (2009) Fuzzing: the Past, the Present and the Future. SSTIC 09. Y. Hsu, G. Shu and D. Lee. A Model-based Approach to Security Flaw Detection of Network Protocol Implementation, IEEE ICNP, 2008. Sh. Becker, H. Abdelnur, R. State, Th. Engel. An Autonomic Testing Framework for IPv6 Configuration Protocols. AIMS 2010: 4th International Conference on Autonomous Infrastructure, Management and Security, pp. 65-76. S. Bekrar, C. Bekrar, R. Groz, L. Mounier. Finding Software Vulnerabilities by Smart Fuzzing. 2011 Fourth IEEE International Conference on Software Testing, Verification and Validation

Thank you for your attention! Further Questions?

Contact Prof. Dr.-Ing. Ina Schieferdecker Phone: +49 30 34 63 7241 Mobile: +49 175 260 30 21 Email: ina.schieferdecker@ fokus.fraunhofer.de FOKUS Fraunhofer Institute for Open Communication Systems FOKUS Kaiserin-Augusta-Allee 31 10589 Berlin, Germany Tel: +49 (30) 34 63 7000 Fax: +49 (30) 34 63 8000 Web: www.fokus.fraunhofer.de