typestate-guided fuzzer for discovering use-after-free

21
: 2019.07.07 Typestate-Guided Fuzzer for Discovering Use-after-Free Vulnerabilities Haijun Wang, Xiaofei Xie, Yi Li, Cheng Wen, Yuekang Li, Yang Liu, Shengchao Qin, Hongxu Chen, Yulei Sui

Upload: others

Post on 23-Oct-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Typestate-Guided Fuzzer for Discovering Use-after-Free

:

2019.07.07

Typestate-Guided Fuzzer for Discovering

Use-after-Free Vulnerabilities

Haijun Wang, Xiaofei Xie, Yi Li, Cheng Wen, Yuekang Li,

Yang Liu, Shengchao Qin, Hongxu Chen, Yulei Sui

Page 2: Typestate-Guided Fuzzer for Discovering Use-after-Free

Fuzzing Techniques

➢ Fuzzing Technique

✓ Automated software testing technique

✓ Provide invalid, unexpected, or random data to a program

✓ The program is instrumented, e.g., branch coverage

✓ The most popular technique to find vulnerabilities

e.g., AFL, libFuzzer, ClusterFuzz, OSS-Fuzz

➢ Fuzzing Technique Types

✓ Generation-based fuzzing

generate inputs from templates, e.g., grammar, specification

✓ Mutation-based fuzzing

randomly mutate inputs from seed test cases

Page 3: Typestate-Guided Fuzzer for Discovering Use-after-Free

Challenges in fuzzing techniques

Page 4: Typestate-Guided Fuzzer for Discovering Use-after-Free

Solutions in Fuzzing

Whether the existing branch coverage is enough?

e.g., use-after-free vulnerability

Page 5: Typestate-Guided Fuzzer for Discovering Use-after-Free

Challenges in Fuzzing

➢ The program has a use-after-free

vulnerability

✓ Line4: allocate the memory

✓ Line7: ptr1 and ptr2 become alias

✓ Line10: the memory is freed

✓ Line14: use the freed memory

Page 6: Typestate-Guided Fuzzer for Discovering Use-after-Free

Challenges in Fuzzing

Page 7: Typestate-Guided Fuzzer for Discovering Use-after-Free

Challenges in Fuzzing

➢ To expose the use-after-free vulnerability

✓ Line: 4 7 10 14

➢ Challenges in detecting UaF

✓ How to identify the above operation

sequence?

✓ How to cover this operation sequence?

Page 8: Typestate-Guided Fuzzer for Discovering Use-after-Free

Challenges in Fuzzing

Page 9: Typestate-Guided Fuzzer for Discovering Use-after-Free

UAFL: Typestate-Guided Fuzzer for Discovering

Use-after-Free Vulnerabilities

Page 10: Typestate-Guided Fuzzer for Discovering Use-after-Free

Overview of UAFL

Page 11: Typestate-Guided Fuzzer for Discovering Use-after-Free

Static Typestate Analysis

➢ Typtestate property

➢ Static Analysis

✓ Lightweight path-insensitive static

analysis

✓ SVF: inter-procedural static value-

flow analysis

➢ Operation Sequence

✓ Line: 4 7 10 14

Page 12: Typestate-Guided Fuzzer for Discovering Use-after-Free

Program Instrumentation

➢ Operation Sequences

✓ ∀𝑠𝑖 ∈ (𝑠1, ⋯ , 𝑠𝑛 ), instrument

whether si is executed

✓ ∀𝑠𝑖 ∈ (𝑠1, ⋯ , 𝑠𝑛 ), retrieve the

execution information of ∀𝑠𝑗 ∈

𝑠1, ⋯ , 𝑠𝑖

➢ Information Flow

✓ I

Page 13: Typestate-Guided Fuzzer for Discovering Use-after-Free

Fuzzing loop

➢ Seed Selection

✓ Seeds that cover more

operation sequences

➢ Mutation Strategies

✓ Input fields related to

operation sequences are more

important

✓ Information flow analysis

based mutation

➢ Feedback

✓ Gradually cover the operation sequences

Page 14: Typestate-Guided Fuzzer for Discovering Use-after-Free

Evaluations for UAFL

Page 15: Typestate-Guided Fuzzer for Discovering Use-after-Free

Overhead of Static Analysis

Page 16: Typestate-Guided Fuzzer for Discovering Use-after-Free

Time to Expose UaF

Page 17: Typestate-Guided Fuzzer for Discovering Use-after-Free

Statistical Tests

Page 18: Typestate-Guided Fuzzer for Discovering Use-after-Free

Operation Sequence Coverage

Page 19: Typestate-Guided Fuzzer for Discovering Use-after-Free

Operation Sequence Coverage

Page 20: Typestate-Guided Fuzzer for Discovering Use-after-Free

Operation Sequence Coverage

Page 21: Typestate-Guided Fuzzer for Discovering Use-after-Free