Fuzzing JavaScript Engines with Aspect-preserving Mutation
Soyeon Park, Wen Xu, Insu Yun, Daehee Jang, Taesoo Kim
Fuzzing JavaScript Engines with Aspect-preserving Mutation Soyeon - - PowerPoint PPT Presentation
Fuzzing JavaScript Engines with Aspect-preserving Mutation Soyeon Park, Wen Xu, Insu Yun, Daehee Jang, Taesoo Kim Everyone uses web browser (+ JS engine) 4,000,000,000 2 New Tab https://gts3.org/ Bank Private Password account data
Soyeon Park, Wen Xu, Insu Yun, Daehee Jang, Taesoo Kim
2
4,000,000,000
New Tab
https://gts3.org/
S&P’20!
3
Private data Bank account Password
5
2017 2018 2019 2020
443K
6
8
Parser / Interpreter JIT compiler Executor JS engine
9 2016 2017 2018 2019 Year 5 10 15 20 25 # of Bugs
JIT-OOB JIT-Type confusion JIT-Memory corruption Parser/Interpreter
1 Google Project Zero issue trackers and commits of ChakraCore for security updates by Aug 2019
Simple & shallow bugs Complex & deep bugs
10
11
12
13
14
which are embedded in the Proof-of-Concept of existing bugs
15
Assign float values to an array and order of the instructions Type confusion
which are embedded in the Proof-of-Concept of existing bugs
16
For loop to invoke JIT compiler Assign float values to an array and order of the instructions
which are embedded in the Proof-of-Concept of existing bugs
17
For loop to invoke JIT compiler Arrow function to assign object value to the same array Assign float values to an array and order of the instructions
21
22
Original Seeds
Preprocessing Input generation Execution Crash! Feedback
Dynamic & Static analysis
Typed-AST
w/ instrumented JS engine Code coverage
JS file
23
Original Seeds
Preprocessing Input generation Execution Crash! Feedback
Dynamic & Static analysis
Typed-AST
w/ instrumented JS engine Code coverage
JS file Instrument Dynamic Analysis
Type analysis
NUM NUM ARRAYwhile
== a [] 1
NUM NUM IMMUTABL ETyped-AST Type Information
AST
+
Static Analysis
Pre-Processing
Input generation
24
recordType() var n = 3 recordType() var array = new Array(n) recordType()
Corpus
25
recordType() var n = 3 recordType() var array = new Array(n) recordType()
Corpus
26
recordType() var n = 3 recordType() var array = new Array(n) recordType()
Corpus
n : number
27
recordType() var n = 3 recordType() var array = new Array(n) recordType()
Corpus
n : number array: numberArray
28
Type Information
recordType() var n = 3 recordType() var array = new Array(n) recordType()
Corpus
n : number n : number array: numberArray
29
Type Information
while == a [] 1
AST
30
Type Information
while == a [] 1
AST
while == a [] 1
NUM NUM ARRAY NUM NUM IMMUTABLE
Typed-AST
31
Original Seeds
Preprocessing Input generation Execution Crash! Feedback
Dynamic & Static analysis
Typed-AST
w/ instrumented JS engine Code coverage
JS file Mutated Seeds
Generation Engine Mutation Engine
Mutated Typed-AST
Mutate (Aspect-preserving)
NUM ARRAYwhile
== a [] .
NUM NUM IMMUTABL Ea [] a
“length”
NUM ARRAY NUM NUM NUM ARRAYInput Generation
NUM NUM ARRAYwhile
== a [] 1
NUM NUM IMMUTABL ETyped-AST
32
For loop to invoke JIT compiler Arrow function to assign object value to the same array Assign float values to an array and order of the instructions
33 Generation Engine
while == a [] 1
Typed-AST
NUM NUM ARRAY NUM NUM IMMUTABLE
Type Information
+
34 Generation Engine Mutation Engine
while == a [] 1
Typed-AST
NUM NUM ARRAY NUM NUM IMMUTABLE
a . length a []
NUM typed node
Type Information
+
35 Generation Engine Mutation Engine
while == a [] 1
Typed-AST
NUM NUM ARRAY NUM NUM IMMUTABLE
while == a []
Mutated Typed-AST
NUM ARRAY NUM NUM IMMUTABLE
a . length a [] a . length a []
NUM ARRAY NUM NUM NUM typed node
Type Information
+
36
while == a [] 1
Typed-AST
NUM NUM ARRAY NUM NUM IMMUTABLE
Mutation Engine
37
while == a [] 1
Typed-AST
NUM NUM ARRAY NUM NUM IMMUTABLE
Mutation Engine
38
Original Seeds
Crash! Preprocessing Input generation Execution Feedback
Dynamic & Static analysis
Typed-AST
w/ instrumented JS engine Code coverage
JS file Coverage Feedback
Instrumented JS Engines
Execute
Execution/Feedback
Distributed Fuzzing Platform Mutated Seeds
Input generation
39
3,677 lines of TypeScript 222 lines of Python 10,545 lines of TypeScript 2,333 lines of TypeScript 453 lines of C 205 lines of TypeScript 1,419 lines of Python and Shell Script 492 lines of Python 19,346 lines of code
Fuzzing JS engines with DIE in the wild ... and extra information to understand the techniques applied on DIE
40
41
42
Preserved aspect Bug Crash Structure & Type 14/28 (50.00%) 40/84 (47.62%) Structure-only 12/28 (42.86%) 32/84 (42.86%) Total 22/28 (92.86%) 72/84 (90.48%)
43
Generation w/ type information Mutation (type preserving) Mutation (structure preserving)
generated inputs and seed files
44
Die Diet Superion CodeAlchemist 25 50 75 100 125 150 175 200 Optimization Invocation Rate (%)
Forward FGPeeps FGBuild Backward CaptureByteCodeRegUse BackEnd DeadStore GlobOpt Etc
DIEt : DIE without structure-preserving (type preserving only)
vanilla
45
Vanilla Diec Die Superion CodeAlchemist jsfunfuzz
10 20 30 40 Error Rate (%) SyntaxError ReferenceError TypeError RangeError
DIEc : DIE without coverage feedback Original corpus
for 24 hours
47
JS engine DIE DIEt Superion CodeAlchemist ChakraCore 1.11.10 17 7 3 JavaScriptCore 2.24.2 2 V8 7.7.100 2 1 1 DIEt : DIE without structure-preserving (type preserving only)
existing bugs achieved by type and structure preserving
48
Q & A
49