GASP: a Generic Approach to Secure network Protocols Olivier - - PowerPoint PPT Presentation

gasp a generic approach to secure network protocols
SMART_READER_LITE
LIVE PREVIEW

GASP: a Generic Approach to Secure network Protocols Olivier - - PowerPoint PPT Presentation

GASP: a Generic Approach to Secure network Protocols Olivier Levillain May 13th 2020 O. Levillain GASP 1/39 Agenda Introduction The Need for Robust Parsers A Platform for Binary Parser Generators Animating Protocols Fuzzing


slide-1
SLIDE 1

GASP: a Generic Approach to Secure network Protocols

Olivier Levillain May 13th 2020

  • O. Levillain

GASP 1/39

slide-2
SLIDE 2

Agenda

Introduction The Need for Robust Parsers A Platform for Binary Parser Generators Animating Protocols Fuzzing implementations Next steps

slide-3
SLIDE 3

Agenda

Introduction The Need for Robust Parsers A Platform for Binary Parser Generators Animating Protocols Fuzzing implementations Next steps

slide-4
SLIDE 4

Introduction

Project Outline

GASP, a Generic Approach to Secure Protocols ◮ Project funded by the ANR 2019 call (ANR Jeune) ◮ 4 ans (2019-10-01 – 2023-09-30) Three main research directions ◮ Network protocol observation in the field ◮ Protocol description to derive reference implementation ◮ Tests on existing implementations using a grey- or whitebox approach Ressourcess ◮ 1 PhD student (ATR) + 3 interns (incl. SN) ◮ 20 ke for servers/laptops ◮ 25 ke for travel/conferences

  • O. Levillain

GASP 4/39

slide-5
SLIDE 5

Introduction

Partners

Télécom SudParis ◮ Olivier Levillain, principal investigator ◮ Aina Toky Rasoamanana, PhD student ANSSI (software security lab) ◮ Arnaud Fontaine ◮ Aurélien Deharbe Collegues from Rennes ◮ Georges Bossert (Sekoia), pylstar developer ◮ Guillaume Hiet (CentraleSupélec) Other people involved ◮ Karthik Bhargavan (Inria Paris, Prosecco) ◮ Pascal Lafourcade (UCA) ◮ Graham Steel (Cryptosense)

  • O. Levillain

GASP 5/39

slide-6
SLIDE 6

Introduction

Deliverables and tasks (1/2)

WP0 Project management and dissemination D0.* Yearly progress reports WP1 Network protocol observation in the field WP1.1 Specification of a message description language WP1.2 Development of compilers to derive parsers WP1.3 Measurement campaigns D1.1 Intermediate report on the message language and compilers D1.2 Final report on the message language and compilers D1.3 Campaigns results (tools, data and analyses) WP2 Protocol description to derive reference implementations WP2.1 Specification of a protocol description languages WP2.2 Development of compilers to derive reference implementations D2.1 Intermediate report on the languages and compilers D2.2 Final report on the languages and compilers WP3 Tests on existing implementations using a grey- or whitebox approach WP3.1 Test tools derived from the description languages WP3.2 Program introspection to explore implementation behaviour D3.1 Intermediate report on test tools D3.2 Final report on test tools D3.3 Report on implementation introspection

  • O. Levillain

GASP 6/39

slide-7
SLIDE 7

Introduction

Deliverables and tasks (2/2)

Year 1 Year 2 Year 3 Year 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 WP0 D0.1 D0.2 D0.3 D0.4 WP1 D1.1 D1.2 D1.3 WP1.1 WP1.2 WP1.3 WP2 D2.1 D2.2 WP2.1 WP2.2 WP3 D3.1 D3.2 D3.3 WP3.1 WP3.2

Internship (WP1.1 & WP1.2) PhD Thesis (WP2 & WP3) Internship (WP1.3) Internship (WP3) Server purchase Workshop on message description languages Workshop on automata description languages

  • O. Levillain

GASP 7/39

slide-8
SLIDE 8

Agenda

Introduction The Need for Robust Parsers A Platform for Binary Parser Generators Animating Protocols Fuzzing implementations Next steps

slide-9
SLIDE 9

The Need for Robust Parsers

Network protocols and file formats

◮ To understand a specification, you should try and implement it ◮ Often, the devil in the detail

◮ how to encode integers in ASN.1, tar files or protobuf ◮ the direction to fill in bit fields ◮ fuzzy specifications

◮ Binary parsers are a basic block for a lot of programs ◮ They are often a fragile part of the software (look at CVEs for Wireshark for example)

  • O. Levillain

GASP 9/39

slide-10
SLIDE 10

The Need for Robust Parsers

Where it all began : SSL/TLS campaigns

◮ Analysis of SSL/TLS connections in the wild (ACSAC 2012)

◮ for each 443/tcp open port, we record the answer to a given stimulus ◮ 200 GB of raw data per stimulus

◮ Problems to handle and dissect these data

◮ TLS is composed of complex structured messages ◮ data can be corrupted (in many ways) ◮ 443/tcp can host other protocols (usually HTTP or SSH) ◮ more subtle errors in messages

  • O. Levillain

GASP 10/39

slide-11
SLIDE 11

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ?

  • O. Levillain

GASP 11/39

slide-12
SLIDE 12

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA

  • O. Levillain

GASP 11/39

slide-13
SLIDE 13

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA B ECDH-ECDSA-AES128-SHA

  • O. Levillain

GASP 11/39

slide-14
SLIDE 14

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA B ECDH-ECDSA-AES128-SHA C an alert

  • O. Levillain

GASP 11/39

slide-15
SLIDE 15

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA B ECDH-ECDSA-AES128-SHA C an alert D something else (RC4_MD5)

  • O. Levillain

GASP 11/39

slide-16
SLIDE 16

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA B ECDH-ECDSA-AES128-SHA C an alert D something else (RC4_MD5) Actually, it is easy to explain

  • O. Levillain

GASP 11/39

slide-17
SLIDE 17

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA (0x002f) B ECDH-ECDSA-AES128-SHA C an alert D something else (RC4_MD5) Actually, it is easy to explain ◮ a ciphersuite is represented by a 16-bit integer ◮ for almost a decade, all suites had their first byte equal to 00

  • O. Levillain

GASP 11/39

slide-18
SLIDE 18

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA (0x002f) B ECDH-ECDSA-AES128-SHA (0xc005) C an alert D something else (RC4_MD5) (0x0005) Actually, it is easy to explain ◮ a ciphersuite is represented by a 16-bit integer ◮ for almost a decade, all suites had their first byte equal to 00

  • O. Levillain

GASP 11/39

slide-19
SLIDE 19

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA (0x002f) B ECDH-ECDSA-AES128-SHA (0xc005) C an alert D something else (RC4_MD5) (0x0005) Actually, it is easy to explain ◮ a ciphersuite is represented by a 16-bit integer ◮ for almost a decade, all suites had their first byte equal to 00 ◮ why bother to inspect this byte ?

  • O. Levillain

GASP 11/39

slide-20
SLIDE 20

The Need for Robust Parsers

Home-made SSL/TLS stacks

What should a client expect when they propose the following ciphersuites : AES128-SHA et ECDH-ECDSA-AES128-SHA ? A AES128-SHA B ECDH-ECDSA-AES128-SHA C an alert D something else (RC4_MD5) E an otherwise correct message, where the field is missing

  • O. Levillain

GASP 11/39

slide-21
SLIDE 21

The Need for Robust Parsers

Parsifal, a brochure

◮ A tool to write parsers from concise descriptions ◮ Efficience of the compiled programs ◮ Robustness of the developed tools ◮ Development methodology adapted to an incremental approach to produce flexible parsers

  • O. Levillain

GASP 12/39

slide-22
SLIDE 22

The Need for Robust Parsers

Parsifal, a brochure

◮ A tool to write parsers from concise descriptions ◮ Efficience of the compiled programs ◮ Robustness of the developed tools ◮ Development methodology adapted to an incremental approach to produce flexible parsers ◮ Parsifal also allows to dump/unparse the objects ◮ Example : a simple DNS client in 200 lines

  • O. Levillain

GASP 12/39

slide-23
SLIDE 23

The Need for Robust Parsers

Parsifal base concept : the PType

The objects to analyse are described using PTypes ◮ an OCaml type ◮ a parse function ◮ a dump function Differentes sorts of PTypes ◮ base PTypes (uint, binstring, etc.) ◮ Parsifal constructions using keywords (enum, struct, etc.) ◮ hand-written PTypes

  • O. Levillain

GASP 13/39

slide-24
SLIDE 24

The Need for Robust Parsers

Exemple : structure d’une image PNG (1/3)

s tr u ct p n g _ f i l e = { png_magic : magic ( "\x89\x50\ x4e \x47\x0d\x0a\x1a\x0a " ) ; png_content : b i n s t r i n g ; }

  • O. Levillain

GASP 14/39

slide-25
SLIDE 25

The Need for Robust Parsers

Exemple : structure d’une image PNG (2/3)

s tr u ct png_chunk = { chunk_size : uint32 ; chunk_type : s t r i n g ( 4 ) ; data : b i n s t r i n g ( chunk_size ) ; crc : uint32 ; }

  • O. Levillain

GASP 15/39

slide-26
SLIDE 26

The Need for Robust Parsers

Exemple : structure d’une image PNG (2/3)

s tr u ct png_chunk = { chunk_size : uint32 ; chunk_type : s t r i n g ( 4 ) ; data : b i n s t r i n g ( chunk_size ) ; crc : uint32 ; } s tr u ct p n g _ f i l e = { png_magic : magic ( "\x89\x50\ x4e \x47\x0d\x0a\x1a\x0a " ) ; chunks : l i s t

  • f

png_chunk ; }

  • O. Levillain

GASP 15/39

slide-27
SLIDE 27

The Need for Robust Parsers

Exemple : structure d’une image PNG (3/3)

s tr u ct image_header = { . . . } union chunk_content [ e n r i c h ] ( UnparsedChunkContent ) = | "IHDR" −> ImageHeader

  • f

image_header | "IDAT" −> ImageData

  • f

b i n s t r i n g | "IEND" −> ImageEnd | "PLTE" −> ImagePalette

  • f

l i s t

  • f

a r r a y (3)

  • f

uint8

  • O. Levillain

GASP 16/39

slide-28
SLIDE 28

The Need for Robust Parsers

Exemple : structure d’une image PNG (3/3)

s tr u ct image_header = { . . . } union chunk_content [ e n r i c h ] ( UnparsedChunkContent ) = | "IHDR" −> ImageHeader

  • f

image_header | "IDAT" −> ImageData

  • f

b i n s t r i n g | "IEND" −> ImageEnd | "PLTE" −> ImagePalette

  • f

l i s t

  • f

a r r a y (3)

  • f

uint8 s tr u ct png_chunk = { chunk_size : uint32 ; chunk_type : s t r i n g ( 4 ) ; data : c o n t a i n e r ( chunk_size )

  • f

chunk_content ( chunk_type ) ; crc : uint32 ; }

  • O. Levillain

GASP 16/39

slide-29
SLIDE 29

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ?

  • O. Levillain

GASP 17/39

slide-30
SLIDE 30

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

  • O. Levillain

GASP 17/39

slide-31
SLIDE 31

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

◮ 0x02 0x04 0x0a (len=2) ◮ 0x01 0x0a (len=1)

  • O. Levillain

GASP 17/39

slide-32
SLIDE 32

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

◮ 0x02 0x04 0x0a (len=2) ◮ 0x01 0x0a (len=1)

◮ as the object length in ASN.1 (DER) ?

  • O. Levillain

GASP 17/39

slide-33
SLIDE 33

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

◮ 0x02 0x04 0x0a (len=2) ◮ 0x01 0x0a (len=1)

◮ as the object length in ASN.1 (DER) ?

◮ 0x82 0x04 0x0a (long format, len=2) ◮ 0x0a (short format, implicit len=1)

  • O. Levillain

GASP 17/39

slide-34
SLIDE 34

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

◮ 0x02 0x04 0x0a (len=2) ◮ 0x01 0x0a (len=1)

◮ as the object length in ASN.1 (DER) ?

◮ 0x82 0x04 0x0a (long format, len=2) ◮ 0x0a (short format, implicit len=1)

◮ as a tag in ASN.1 (DER)

  • O. Levillain

GASP 17/39

slide-35
SLIDE 35

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

◮ 0x02 0x04 0x0a (len=2) ◮ 0x01 0x0a (len=1)

◮ as the object length in ASN.1 (DER) ?

◮ 0x82 0x04 0x0a (long format, len=2) ◮ 0x0a (short format, implicit len=1)

◮ as a tag in ASN.1 (DER)

◮ 0b11111 0b10001000 0b00001010 (long format, last 7-bit chunk signaled by msb) ◮ 0b01010 (short format, implicit len=1)

  • O. Levillain

GASP 17/39

slide-36
SLIDE 36

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

◮ 0x02 0x04 0x0a (len=2) ◮ 0x01 0x0a (len=1)

◮ as the object length in ASN.1 (DER) ?

◮ 0x82 0x04 0x0a (long format, len=2) ◮ 0x0a (short format, implicit len=1)

◮ as a tag in ASN.1 (DER)

◮ 0b11111 0b10001000 0b00001010 (long format, last 7-bit chunk signaled by msb) ◮ 0b01010 (short format, implicit len=1)

◮ as the file size (or any integer) in TAR ?

  • O. Levillain

GASP 17/39

slide-37
SLIDE 37

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

◮ 0x02 0x04 0x0a (len=2) ◮ 0x01 0x0a (len=1)

◮ as the object length in ASN.1 (DER) ?

◮ 0x82 0x04 0x0a (long format, len=2) ◮ 0x0a (short format, implicit len=1)

◮ as a tag in ASN.1 (DER)

◮ 0b11111 0b10001000 0b00001010 (long format, last 7-bit chunk signaled by msb) ◮ 0b01010 (short format, implicit len=1)

◮ as the file size (or any integer) in TAR ?

◮ the string "00000002012" ◮ the string "00000000012"

  • O. Levillain

GASP 17/39

slide-38
SLIDE 38

The Need for Robust Parsers

Interlude : integer representation

How to represent 1034 (0b010000001010, 0x40a) and 10 (0b1010, 0xa) ? ◮ as an ASN.1 integer (DER) ?

◮ 0x02 0x04 0x0a (len=2) ◮ 0x01 0x0a (len=1)

◮ as the object length in ASN.1 (DER) ?

◮ 0x82 0x04 0x0a (long format, len=2) ◮ 0x0a (short format, implicit len=1)

◮ as a tag in ASN.1 (DER)

◮ 0b11111 0b10001000 0b00001010 (long format, last 7-bit chunk signaled by msb) ◮ 0b01010 (short format, implicit len=1)

◮ as the file size (or any integer) in TAR ?

◮ the string "00000002012" (octal representation) ◮ the string "00000000012"

  • O. Levillain

GASP 17/39

slide-39
SLIDE 39

Agenda

Introduction The Need for Robust Parsers A Platform for Binary Parser Generators Animating Protocols Fuzzing implementations Next steps

slide-40
SLIDE 40

A Platform for Binary Parser Generators

Parsifal Limitations

Parsifal drawbacks ◮ OCaml adherence... ◮ and in particular to camlp4 ◮ rather unsound handling of non linear constructions ◮ lack of a cool interpreter to help discovery New ideas ◮ look ar other languages, e.g. Rust (and its Nom library) ◮ enrich the DSL (domain-specific language) to reason on PTypes ◮ better handle constraints on fields ◮ better isolate parsing from semantic interpretation

  • O. Levillain

GASP 19/39

slide-41
SLIDE 41

A Platform for Binary Parser Generators

Other Tools and Languages

A lot of competitors, including ◮ Hammer (C) ◮ Scapy (Python) ◮ Hachoir (Python) ◮ Parsifal (OCaml) ◮ Netzob (Python) ◮ Nail (C) ◮ Nom (Rust) ◮ RecordFlux (Ada) ◮ Everparse (F⋆)

  • O. Levillain

GASP 20/39

slide-42
SLIDE 42

A Platform for Binary Parser Generators

Other Tools and Languages

A lot of competitors, including ◮ Hammer (C) ◮ Scapy (Python) ◮ Hachoir (Python) ◮ Parsifal (OCaml) ◮ Netzob (Python) ◮ Nail (C) ◮ Nom (Rust) ◮ RecordFlux (Ada) ◮ Everparse (F⋆) How to compare these tools ? ◮ expressiveness ◮ robustness ◮ simplicity

  • O. Levillain

GASP 20/39

slide-43
SLIDE 43

A Platform for Binary Parser Generators

Our Platform

This is a very young Work-In-Progress, to test tools on specifications, with regards to several properties.

  • O. Levillain

GASP 21/39

slide-44
SLIDE 44

A Platform for Binary Parser Generators

Our Platform

This is a very young Work-In-Progress, to test tools on specifications, with regards to several properties. Tools ◮ Hammer ◮ Nail ◮ Nom ◮ Parsifal

  • O. Levillain

GASP 21/39

slide-45
SLIDE 45

A Platform for Binary Parser Generators

Our Platform

This is a very young Work-In-Progress, to test tools on specifications, with regards to several properties. Tools ◮ Hammer ◮ Nail ◮ Nom ◮ Parsifal Specifications ◮ trivial structures (to document how to handle basic fields) ◮ DNS ◮ PNG (and Mini-PNG)

  • O. Levillain

GASP 21/39

slide-46
SLIDE 46

A Platform for Binary Parser Generators

Our Platform

This is a very young Work-In-Progress, to test tools on specifications, with regards to several properties. Tools ◮ Hammer ◮ Nail ◮ Nom ◮ Parsifal Specifications ◮ trivial structures (to document how to handle basic fields) ◮ DNS ◮ PNG (and Mini-PNG) Properties ◮ sample validation ◮ parsing speed (not implemented yet) ◮ robustness (not implemented yet)

  • O. Levillain

GASP 21/39

slide-47
SLIDE 47

A Platform for Binary Parser Generators

DNS on the Platform (1/2)

Various samples : ◮ valid requests and answers... ◮ including modern features ◮ truncated messages ◮ corrupted messages with invalid pointers

  • O. Levillain

GASP 22/39

slide-48
SLIDE 48

A Platform for Binary Parser Generators

DNS on the Platform (1/2)

Various samples : ◮ valid requests and answers... ◮ including modern features ◮ truncated messages ◮ corrupted messages with invalid pointers Tool Lines Features Hammer 254 Limited fields Nail 141 Compression, Zone description Nom 88 Basic message structure Parsifal 234 Various message types, Compression

  • O. Levillain

GASP 22/39

slide-49
SLIDE 49

A Platform for Binary Parser Generators

DNS on the Platform (2/2)

Lessons learned from the behaviours of the different tools ◮ original and current specifications are in conflict (reserved field) ◮ DNS Extensions are not recognized by some implementations ◮ some field values are hardcoded in the proposed specs ◮ DNS compression is not always implemented, and usually requires specific hand-written code

  • O. Levillain

GASP 23/39

slide-50
SLIDE 50

A Platform for Binary Parser Generators

DNS on the Platform (2/2)

Lessons learned from the behaviours of the different tools ◮ original and current specifications are in conflict (reserved field) ◮ DNS Extensions are not recognized by some implementations ◮ some field values are hardcoded in the proposed specs ◮ DNS compression is not always implemented, and usually requires specific hand-written code Sebastien Naud, intern at TSP, is currently working on DNS and Nail. ◮ Short presentation at R3S Seminar next week (May 20th)

  • O. Levillain

GASP 23/39

slide-51
SLIDE 51

A Platform for Binary Parser Generators

One important goal for GASP

We would like to propose a new DSL (domain-specific language) that would take the best of everything if possible ◮ concision ◮ expressiveness ◮ language-agnostic

Source : https://xkcd.com/927/

The approach would be to design a language and to implement compilers towards interesting programming languages or other DSLs

  • O. Levillain

GASP 24/39

slide-52
SLIDE 52

A Platform for Binary Parser Generators

A new vision for structs

s tr u ct png_chunk = { chunk_size : uint32 ; chunk_type : s t r i n g ( 4 ) ; chunk_data : chunk_content ; chunk_crc : uint32 ; } c o n s t r a i n t s { chunk_size = l e n ( chunk_data ) ; chunk_crc = crc32 ( chunk_type ^ chunk_data ) ; chunk_type = d i s c r i m i n a n t ( chunk_data ) }

  • O. Levillain

GASP 25/39

slide-53
SLIDE 53

A Platform for Binary Parser Generators

A new vision for structs

s tr u ct png_chunk = { chunk_size : uint32 ; chunk_type : s t r i n g ( 4 ) ; chunk_data : chunk_content ; chunk_crc : uint32 ; } c o n s t r a i n t s { chunk_size = l e n ( chunk_data ) ; chunk_crc = crc32 ( chunk_type ^ chunk_data ) ; chunk_type = d i s c r i m i n a n t ( chunk_data ) }

◮ We define functional relations useful for parsing and dumping ◮ To produce a valid png_chunk only requires the data field

◮ chunk_data = ImageHeader ... implies that... ◮ chunk_size is computable ◮ chunk_type is "IHDR" ◮ chunk_crc is computable

  • O. Levillain

GASP 25/39

slide-54
SLIDE 54

Agenda

Introduction The Need for Robust Parsers A Platform for Binary Parser Generators Animating Protocols Fuzzing implementations Next steps

slide-55
SLIDE 55

Animating Protocols

State machine description

Similarly to message formats, we would like a DSL to capture state machines and protocol contexts

  • O. Levillain

GASP 27/39

slide-56
SLIDE 56

Animating Protocols

State machine description

Similarly to message formats, we would like a DSL to capture state machines and protocol contexts Currently, very little animation done with Parsifal ◮ picodig, a trivial DNS client ◮ simple TLS state machines

◮ a decryption tool using SSLKEYLOG files ◮ a proxy routing records depending on the first packets

More work is needed (WP2) before we can abstract out what is needed

  • O. Levillain

GASP 27/39

slide-57
SLIDE 57

Agenda

Introduction The Need for Robust Parsers A Platform for Binary Parser Generators Animating Protocols Fuzzing implementations Next steps

slide-58
SLIDE 58

Fuzzing implementations

Principle of L⋆

L⋆ is an algorithm to infer automata ◮ original paper : Dana Anglui — Learning Regular Sets from Queries and Countermeasures, 1987 ◮ initial scope is very limited since it requires to have a way to decide the equivalence with an ideal implementation ◮ approximations are possible to infer a state machine in a black box situation with reasonnable precision

  • O. Levillain

GASP 29/39

slide-59
SLIDE 59

Fuzzing implementations

Application to protocol implementations

To interact with the implementation to test (as a black box), we need to ◮ concretize the messages to send ◮ abstract the received messages ◮ the algorithm will drive the request to explore the state machine In practice, different kinds of received messages ◮ real message ◮ error ◮ time out

  • O. Levillain

GASP 30/39

slide-60
SLIDE 60

Fuzzing implementations

Some references about this approach

TLS ◮ de Ruiters and Poll, – Protocol State Fuzzing of TLS Implementations (USENIX Security 2015) ◮ https://www.usenix.org/node/190893 H2 ◮ Georges Bossert – Comparaisons et attaques sur le protocole HTTP2 (SSTIC 2016) ◮ https://www.sstic.org/2016/presentation/comparaisons_attaques_http2/ SSH ◮ Fiterau-Brostean et al. – Model Learning and Model Checking of SSH Implementations (SPIN’17) ◮ https://www.cs.ru.nl/E.Poll/papers/learning_ssh.pdf

  • O. Levillain

GASP 31/39

slide-61
SLIDE 61

Fuzzing implementations

Example of a discovered flaw (1/2)

Observable state automata of the RSA BSAFE JAVA stack (version 6.1.1) ◮ 5 states clearly form the expected “happy flow” ◮ the 2 state is the error state ◮ Source : de Ruiters and Poll, Usenix Security 2015

  • O. Levillain

GASP 32/39

slide-62
SLIDE 62

Fuzzing implementations

Example of a discovered flaw (2/2)

Observable state automata of GNU TLS 3.3.8 ◮ the automata contains 12 states ◮ states 8 to 10 form a shadow flow, a Heartbeat leading to a reset ◮ Source : de Ruiters and Poll, Usenix Security 2015

  • O. Levillain

GASP 33/39

slide-63
SLIDE 63

Fuzzing implementations

Ideas to improve and extend L⋆

Performance improvements ◮ timeout detections by introspection ◮ freeze/fork/restart to speed up the number of test cases

  • O. Levillain

GASP 34/39

slide-64
SLIDE 64

Fuzzing implementations

Ideas to improve and extend L⋆

Performance improvements ◮ timeout detections by introspection ◮ freeze/fork/restart to speed up the number of test cases Alphabet extension ◮ use more detailed messages ◮ add corrupted/invalid messages ◮ take into account the time spent ◮ application : automatic detection of Bleichenbacher attacks in TLS implementations

  • O. Levillain

GASP 34/39

slide-65
SLIDE 65

Fuzzing implementations

Ideas to improve and extend L⋆

Performance improvements ◮ timeout detections by introspection ◮ freeze/fork/restart to speed up the number of test cases Alphabet extension ◮ use more detailed messages ◮ add corrupted/invalid messages ◮ take into account the time spent ◮ application : automatic detection of Bleichenbacher attacks in TLS implementations More on this next week (R3S Seminar, May 20th), with a presentation by Aina Toky Rasoamanana, PhD student

  • O. Levillain

GASP 34/39

slide-66
SLIDE 66

Agenda

Introduction The Need for Robust Parsers A Platform for Binary Parser Generators Animating Protocols Fuzzing implementations Next steps

slide-67
SLIDE 67

Next steps

Next steps (1/3)

Binary Parsers Platform ◮ stabilize the platform with 5-6 tools and several specs ◮ invite tool developers to join ◮ include performance tests

  • O. Levillain

GASP 36/39

slide-68
SLIDE 68

Next steps

Next steps (1/3)

Binary Parsers Platform ◮ stabilize the platform with 5-6 tools and several specs ◮ invite tool developers to join ◮ include performance tests L⋆ ◮ better understand pylstar ◮ or implement a new version of L⋆ ? ◮ improve the performance with a grey-box approach

  • O. Levillain

GASP 36/39

slide-69
SLIDE 69

Next steps

Next steps (2/3)

Use the message parsers to work on several ecosystems (network scans, implementation tests) ◮ TLS (as a benchmark) ◮ QUIC ◮ SSH ◮ H2 ◮ ...

  • O. Levillain

GASP 37/39

slide-70
SLIDE 70

Next steps

Next steps (3/3)

DSL to describe protocol messages ◮ Language design ◮ Compiler implementations

  • O. Levillain

GASP 38/39

slide-71
SLIDE 71

Next steps

Next steps (3/3)

DSL to describe protocol messages ◮ Language design ◮ Compiler implementations Protocol animation ◮ implement protocol stacks for different protocols ◮ abstract out a way to describe these implementations ◮ derive reference implementations

  • O. Levillain

GASP 38/39

slide-72
SLIDE 72

Questions ?

Thank you for your attention Do not hesitate to speak up if you are interested to contribute !

slide-73
SLIDE 73

Backup slides

slide-74
SLIDE 74

Backup slides

Parsifal : implemented formats

X.509 rather complete description SSL/TLS most TLS < 1.3 messages rudimentary TLS 1.0 implementation Kerberos PKINIT messages BGP/MRT tool to extract the prefixes announced DNS tutorial + picodig NTP several messages TAR tutorial PNG tutorial OpenPGP packet structure DVI simple dissection

  • O. Levillain

GASP 41/39