Protocol state machines & session languages. Erik Poll Joeri de Ruiter Aleksy Schubert

Similar documents
PDF hosted at the Radboud Repository of the Radboud University Nijmegen

Security by Construction

Automated Reverse Engineering using Lego R

Automatic modeling of SSH implementations with state machine learning algorithms

Embedded Software Security

A messy state of the union:

of SSH Implementations

Improving Protocol State Fuzzing of SSH

Model Learning and Model Checking of SSH Implementations

Auomatically Learning a Model of the SSH2 Transport Layer

Draft. Thierry ZOLLER Principal Security Consultant

SSL/TLS & 3D Secure. CS 470 Introduction to Applied Cryptography. Ali Aydın Selçuk. CS470, A.A.Selçuk SSL/TLS & 3DSec 1

Optimised to Fail: Card Readers for Online Banking

Not-quite-so-broken TLS 1.3 mechanised conformance checking

CONFORMITY TESTING OF EAC INSPECTION SYSTEMS

Security analysis of DTLS 1.2 implementations

Verfying the SSH TLP with ProVerif

Systematic Fuzzing and Testing of TLS Libraries Juraj Somorovsky

Using Frankencerts for Automated Adversarial Tes7ng of Cer7ficate Valida7on in SSL/TLS Implementa7ons

Looking at the big picture on. vulnerabilities. Network Resonance, Inc. Eric Rescorla

SSL/TLS: Still Alive? Pascal Junod // HEIG-VD

ESC/Java2 extended static checking for Java Erik Poll Radboud University Nijmegen

Revisiting SSL/TLS Implementations: New Bleichenbacher Side Channels and Attacks

Program Verification (6EC version only)

Security of NFC payments

Limitations of the stack

Application Security. Doug Ashbaugh CISSP, CISA, CSSLP. Solving the Software Quality Puzzle

Optimised to Fail: Card Readers for Online Banking

The masses will have to learn concurrent programming. But using locks and shared memory is hard and messy

System-Level Failures in Security

The Halting Problems of Network Stack Insecurity

Building on existing security

Discovering Logical Vulnerabilities in the Wi-Fi Handshake Using Model-Based Testing

Adversary Models. CPEN 442 Introduction to Computer Security. Konstantin Beznosov

Comparison of SSL/TLS libraries based on Algorithms/languages supported, Platform, Protocols and Performance. By Akshay Thorat

Records are deduplicated as they are read into the CRS but it is sometimes useful to deduplicate manually.

Using existing security infrastructures

HACL* in Mozilla Firefox Formal methods and high assurance applications for the web

Most Common Security Threats (cont.)

The World Wide Web is widely used by businesses, government agencies, and many individuals. But the Internet and the Web are extremely vulnerable to

10/02/2015. Introduction PROTOCOL EXAMPLES. e-passport. e-passports contain an RFID tag.

Black-Box Components using Abstraction

APG8205 OTP Generator

WiFuzz: Detecting and Exploiting Logical Flaws in the Wi-Fi Cryptographic Handshake

CSE P 501 Compilers. Parsing & Context-Free Grammars Hal Perkins Spring UW CSE P 501 Spring 2018 C-1

TomcatCon London 2017 Clustering Mark Thomas

Reliable programming

#30: Graph theory May 25, 2009

ESChat Dispatch Client

RAISE in Perspective

lab A.3: introduction to RoboLab vocabulary materials cc30.03 Brooklyn College, CUNY c 2006 Name: RoboLab communication tower canvas icon

Internet Geolocation and Location-Based Services. Richard Barnes BBN Technologies IETF GEOPRIV Co-Chair Emergency Services Workshop Co-Chair

Finding Vulnerabilities in Web Applications

OWASP Top David Caissy OWASP Los Angeles Chapter July 2017

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

IPv6 NAT. Open Source Days 9th-10th March 2013 Copenhagen, Denmark. Patrick McHardy

CMSC 132: OBJECT-ORIENTED PROGRAMMING II

From Crypto to Code. Greg Morrisett

ETSI ITS Security Assessment

ProxyCap Help. Table of contents. Configuring ProxyCap Proxy Labs

Convert VHS to Digital or DVD using Roxio Video Capture

A Cloud in Every Home. Host servers at home with zero sysadmin skills

(Refer Slide Time: 4:00)

Capable when run in Windows 7 or newer, but not enabled by default. Microsoft IE Desktop versions 9 and 10

TECHNICAL NOTE Vidyo Server Security Update 18 for VidyoPortal, VidyoRouter, and VidyoGateway VIDYO

TLS 1.3. Eric Rescorla Mozilla draft-ietf-tls-tls13-21 IETF 100 TLS 1

Introduction to MTP: Media Transfer Protocol by Steve Kolokowsky and Trevor Davis, Cypress Semiconductor

Taking White Hats to the Laundry: How to Strengthen Testing in Common Criteria

Verifying C & C++ with ESBMC

Memory Safety (cont d) Software Security

CSE P 501 Compilers. Parsing & Context-Free Grammars Hal Perkins Winter /15/ Hal Perkins & UW CSE C-1

Information Security CS 526

Test design: Part I. Software Testing: INF3121 / INF4121

A Roadmap for High Assurance Cryptography

Module: Future of Secure Programming

A Messy State of the Union: Taming the Composite State Machines of TLS

Neopost Security Datasheet DS-40i/64i/75i/85i/90i/95i Your security, our commitment!

CS 395T. Analyzing SET with Inductive Method

Last time. Security Policies and Models. Trusted Operating System Design. Bell La-Padula and Biba Security Models Information Flow Control

CA314 Object Oriented Analysis & Design - 7. File name: CA314_Section_07_Ver01 Author: L Tuohey No. of pages: 16

Crema. Research Briefing. Jacob Torrey & Mark Bridgman May 21, 2015

CSE 105 THEORY OF COMPUTATION

*the Everest VERified End-to-end Secure Transport. Verified Secure Implementations for the HTTPS Ecosystem mitls & Everest*

IEC61850 communication solution WinCC Channel

Certitude Functional Qualification with Formal Verification. Jean-Marc Forey November 2012

Data Security and Privacy. Topic 14: Authentication and Key Establishment

Bypassing Web Application Firewalls

Adventures in Formal Methods at W3C: Using Z Notation to Specify WSDL 2.0

CS558 Programming Languages

DoH and DoT experience. Ólafur Guðmundsson Marek Vavrusa

Specification of a transacted memory for smart cards in Java and JML

Fuzzing the Phone in your Phone. PresentaEon Overview. Background informaeon. Fuzzing Framework Results

Black Hat Webcast Series. C/C++ AppSec in 2014

File Management. Version: 04_19_04 Developed by: Department of Instructional Technology 2004 Union Institute & University

MTAT Applied Cryptography

Exercises with solutions, Set 3

CPSC 467: Cryptography and Computer Security

CSC 220: Computer Organization Unit 10 Arithmetic-logic units

On the Practical Exploitability of Dual EC in TLS Implementations

Cryptography (Overview)

Transcription:

Protocol state machines & session languages Erik Poll Joeri de Ruiter Aleksy Schubert LangSec workshop @ IEEE Security & Privacy, 2015

Input languages: messages & sessions Handling inputs involves language of input messages Often it also involves language of sessions, ie. sequences of messages Do LangSec principles also apply at this session level? when it comes to specification & implementation? 2

Session language as message sequence chart This oversimplifies the session language because it only specifies one correct, happy flow 3

Session language as protocol state machine This still oversimplifies: an implementation will have to be input-enabled, ie in every state every message may be received SSH transport layer 4

typical input enabled state machine 5

Security flaws due to broken state machines MIDPSSH Open source Java implemention of SSH for Java feature phones No protocol state machine implemented at all. [Erik Poll at al., Verifying an implementation of SSH, WITS 2007] e.dentifier2 USB-connected device for internet banking Strange sequence of USB commands by-passes user OK [Arjan Blom et al, Designed to Fail:..., NordSec 2012] TLS Flawed state machines in many TLS implementations - more to come [Benjamin Beurdouche et al, A messy State of the union, IEEE Security & Privacy 2015] 6

Typical prose specifications: SSH Once a party has sent a SSH_MSG_KEXINIT message for key exchange or reexchange, until it has sent a SSH_MSG_NEWKEYS message, it MUST NOT send any messages other than: Transport layer generic messages (1 to 19) (but SSH_MSG_ SERVICE_REQUEST and SSH_MSG_SERVICE_ACCEPT MUST NOT be sent); Algorithm negotiation messages (20 to 29) (but further SSH_MSG KEXINIT messages MUST NOT be sent); Specific key exchange method messages (30 to 49). The provisions of Section 11 apply to unrecognised messages An implementation MUST respond to all unrecognised messages with an SSH_MSG_UNIMPLEMENTED. Such messages MUST be otherwise ignored. Later protocol versions may define other meanings for these message types. Understanding state machine from prose is hard! 7

Typical implementation: openssh 8

Typical implementation: openssh /** This array contains functions to handle protocol messages. * The type of the message is an index in this array. */ dispatch_fn *dispatch[255];... server_init_dispatch_20(void){ dispatch_init(&dispatch_protocol_error); dispatch_set(ssh_msg_channel_close, &channel_input_oclose); dispatch_set(ssh_msg_channel_data, &channel_input_data); dispatch_set(ssh_msg_channel_eof, &channel_input_ieof); dispatch_set(ssh_msg_channel_extended_data, &channel_input_extended_ dispatch_set(ssh_msg_channel_open, &server_input_channel_open); dispatch_set(ssh_msg_channel_open_failure, &channel_input_open_failu dispatch_set(ssh_msg_channel_request, &server_input_channel_req); dispatch_set(ssh_msg_global_request, &server_input_global_request); dispatch_set(ssh_msg_kexinit, &kex_input_kexinit); Understanding protocol state machine from code is hard! 9

LangSec also for session languages! Protocol state machines deserve to be explicitly specified 10

Extracting protocol state machine from code We can infer a finite state machine from implementation by black box testing using state machine learning using L* algorithm, as implemented in eg. LearnLib This is effectively a form of stateful fuzzing using a test harness that sends typical protocol messages This is a great way to obtain protocol state machine without reading specs! without reading code! 11

State machine learning with L* Basic idea: compare response of a deterministic system to different input sequences, eg. 1. b 2. a ; b If response is different, then otherwise The state machine inferred is only an approximation of the system, and only as good as your set of test messages. b b a a b 12

Case study: EMV Most banking smartcards implement a variant of EMV EMV (Europay-Mastercard-Visa) defines set of protocols with lots of variants Specification in 4 books totalling > 700 pages 13

State machine learning of card 14

State machine learning of card merging arrows with identical response 15

State machine learning of card merging arrows with same start & end state We found no bugs, but lots of variety between cards. [Fides Aarts et al., Formal models of bank cards for free, SECTEST 2013] 16

State machine learning of internet banking device State machines inferred for flawed & patched device [Georg Chalupar et al.,.automated reverse engineering using Lego,.WOOT 2014] Movie at http://tinyurl/legolearn 17

Scary state machine complexity More complete state machine of the patched device, using a richer input alphabet No flaws found in patched device, but were the developers really confident that this complex behaviour is secure? Or necessary? 18

TLS state machine extracted from NSS Comforting to see this is so simple! 19

TLS state machine extracted from GnuTLS 20

TLS state machine extracted from OpenSSL 21

TLS state machine extracted from JSSE 22

Which TLS implementations are correct? or secure? [Joeri de Ruiter et al., Protocol state fuzzing of TLS implementations, Usenix Security 2015] 23

Conclusions LangSec principles not only apply to language of input messages but also for language of protocol sessions because in practice we see unclear specifications of session languages without explicit state machines messy & flawed implementations of session languages security flaws as a result of this Open question: How common is this category of security flaws? 24

Comparing session languages to message formats Bad news 1. even less likely to be rigorously specified many specs provide EBNF but no protocol state machine 2. complete specification of state machine is tricky input-enabled state machine becomes messy 3. generating code from spec is harder handling state has to be interpersed with other functionality (cf. aspect) Good news 1. we can extract state machines from code! to find flaws in program logic, but not malicious backdoors 2. bugs in state machine can cause security problems, but no weird machines? 25

26