Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
Fuzzing the Solidity Compiler
Bhargava Shastry
Ethereum Foundation
@ibags bshastry
Fuzzing the Solidity Compiler Bhargava Shastry @ibags Ethereum - - PowerPoint PPT Presentation
Fuzzing the Solidity Compiler Bhargava Shastry @ibags Ethereum Foundation bshastry Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler 2 whoami Security engineer, Solidity team Semantic testing of Solidity compiler Find
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
@ibags bshastry
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
2
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
3
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
4
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
5
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
6
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
contract C { function foo() public { do_something(); } } contract C { fu#!3ion foo() puX^&c { do_something(); } }
7
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
8
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
9
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
Specification written in protobuf language
message Block { repeated Statement stmts; } ... message program { repeated Block blocks; }
Full spec: https://github.com/ethereum/solidity/blob/develop/test/tools/ossfuzz/yulProto.proto
10
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
11
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
12
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
13
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
Libprotobuf + mutator
{ function f() { ... } } Message func { Block b = 1; }
Protobuf specification Test program
14
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
15
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
16
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
17
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
Interpreter
MLOAD MSTORE … DATACOPY { function f() { ... } }
Test program Execution trace
18
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
Program generator Interpreter Optimizer
MLOAD MSTORE … DATACOPY MLOAD MSTORE … DATACOPY
Trace
19
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
Program Generator Custom Mutator
20
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
21
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
22
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
23
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
Found via custom mutation
24
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
{ function f() { ... } }
Test program
Antlr unparser Solidity mutator
{ function g() { g() } }
Mutation
25
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
26
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
27
Fuzzcon Europe 2020 | Fuzzing the Solidity Compiler
28
ethereum/solidity.git gitter.im/ethereum/solidity-dev