FuzzFlesh: Randomised Testing of Decompilers Via Control Flow Graph-based Program Generation
Remote
Decompilation is the process of translating compiled code into high-level code. Control flow recovery is a challenging part of the process. `Misdecompilations’ can occur, whereby the decompiled code does not accurately represent the semantics of the compiled code, despite it being syntactically valid. This is problematic because it can mislead users who are trying to reason about the program.
We present CFG-based program generation: a novel approach to randomised testing that aims to improve the control flow recovery of decompilers. CFG-based program generation involves randomly generating control flow graphs (CFGs) and paths through each graph. Inspired by prior work in the domain of GPU computing, CFG-path pairs are `fleshed’ into test programs. Each program is decompiled and recompiled. The test oracle verifies whether the actual runtime path through the graph matches the expected path. Any difference in the execution paths after recompilation indicates a possible misdecompilation. A key benefit of this approach is that it is largely independent of the source and target languages in question because it is focused on control flow. The approach is therefore applicable to numerous decompilation settings. The trade-off resulting from the focus on control flow is that some other misdecompilation bugs (relating e.g. to arithmetic operations) are out of scope.
We have implemented this approach in FuzzFlesh, an open-source randomised testing tool. FuzzFlesh can be easily configured to target a variety of low-level languages and decompiler toolchains because most of the CFG-path generation process is language-independent. At present, FuzzFlesh supports testing decompilation of Java bytecode, .Net assembly and x86 machine code. In addition to program generation, FuzzFlesh also includes an automated test-case reducer that operates on the CFG rather than the program, which means that it can be applied to any of the target languages.
We present a large experimental campaign applying FuzzFlesh to a variety of decompilers, leading to the discovery of 11 previously-unknown bugs across two language formats, six of which have been fixed. We present experiments comparing our generic FuzzFlesh tool to two state-of-the-art decompiler testing tools targeted at specific languages. As expected, the coverage our generic FuzzFlesh tool achieves on a given decompiler is lower than the coverage achieved by a tool specifically designed for the input format of that decompiler. However, due to its focus on control flow, FuzzFlesh is able to cover sections of control flow recovery code that the targeted tools cannot reach, and identify control flow related bugs that the targeted tools miss.
Wed 2 JulDisplayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change
14:00 - 15:45 | |||
14:00 21mTalk | Event Race Detection for Node.js Using Delay Injections Technical Papers Pre-print | ||
14:21 21mTalk | FuzzFlesh: Randomised Testing of Decompilers Via Control Flow Graph-based Program GenerationRemote Technical Papers | ||
14:42 21mTalk | PoTo: A Hybrid Andersen's Points-to Analysis for Python Technical Papers Ingkarat Rak-amnouykit Rensselaer Polytechnic Institute, Ana Milanova Rensselaer Polytechnic Institute, Guillaume Baudart Inria, Martin Hirzel IBM Research, Julian Dolby IBM Research | ||
15:03 21mTalk | Wastrumentation: Portable WebAssembly Dynamic Analysis with Support for Intercession Technical Papers Aäron Munsters Vrije Universiteit Brussel, Angel Luis Scull Pupo Sofware Languages Lab, Vrije Universiteit Brussel, Elisa Gonzalez Boix Vrije Universiteit Brussel | ||
15:24 21mTalk | WebGlitch: A Randomised Testing Tool for the WebGPU API Technical Papers |