[論文レビュー] Automatically Mitigating Vulnerabilities in Binary Programs via Partially Recompilable Decompilation
本稿では、バイナリプログラムから脆弱性のある関数のみを再コンパイル可能なソースコードにデコンパイルする新規手法である部分再コンパイル可能デコンパイル(PRD)を提案する。この手法により、ソースレベルの修復ツールを用いた自動パッチ適用が可能になる。PRDは92.9%のテスト同等性を達成し、個々の関数に対して70–89%のデコンパイル成功率を示し、全バイナリデコンパイル(1.7%の成功率)を上回る性能を発揮。また、APRツールがCGCバイナリを、全ソースツールと同等の性能でパッチ処理できるようにする。
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 misdecompilation bugs that do not relate to control flow (e.g. bugs that involve specific 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 and 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 low-level 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 12 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.
研究の動機と目的
- ソースコードが入手できない状況、特にデプロイ後のバイナリにおいてソフトウェア脆弱性をパッチする課題に対処すること。
- スケーラビリティと再コンパイルの問題により失敗する全バイナリデコンパイルの限界を克服すること。
- 部分的かつ再コンパイル可能なデコンパイルを通じて、バイナリプログラムに対して高精度なソースレベルの自動プログラム修復(APR)ツールを活用できるようにすること。
- わずか数関数のデコンパイルされたソースコードが、効果的でテスト同等のバイナリパッチを可能にするかを検証すること。
- PRDがバイナリのみの入力に対して、全ソースツールと同等の性能を発揮するAPRツールを実現できることを示すこと。
提案手法
- 脆弱性を含む可能性の高い関数を特定するために、バイナリ障害局所化(CGFL)を用いる。
- タイプ回復と関数境界の特定に焦点を当て、懸念される関数のみを高レベルの再コンパイル可能なC/C++ソースコードにリフトアップするデコンパイラを適用する。
- 実行の意味論を保持するため、デコンパイルされたソースと元のバイナリ間の統合を可能にするバイナリ-ソースインターフェースを構築する。
- ソースレベルのAPRツール(例:Prophet, GenProg)を用いて、デコンパイルされたソースコード上でパッチを生成する。
- バイナリリライトと再コンパイル技術を用いて、パッチが適用されたソースコードを元のバイナリに統合し、テスト同等性を保証する。
- 完全で整合的なタイプ推論に依存するのを減らすために、オフセットと参照タイプのみを回復する最小限のタイプ推論を活用する。
実験結果
リサーチクエスチョン
- RQ1バイナリから個々の関数をデコンパイルすることで、文法的・コンパイル制限なしに再コンパイル可能なソースコードを生成できるか?
- RQ2部分的デコンパイルを通じて、ソースレベルのAPRツールをバイナリプログラムに効果的に適用できる範囲はどの程度か?
- RQ3PRDは、元のバイナリとパッチ適用後のバイナリとの間で動作同等性をどの程度保持できるか?
- RQ4PRDにより、APRツールがバイナリに対して、全ソースコードを対象とした場合と同等の性能を発揮できるか?
- RQ5PRDは実世界のバイナリ、異なるプログラミング言語(C/C++)、多様な脆弱性タイプに一般化可能か?
主な発見
- 十分なタイプ回復が達成された場合、PRDは個々の関数を70–89%の割合で正しくデコンパイル・再コンパイルでき、全Cバイナリの1.7%の成功率を大きく上回る。
- デコンパイルが成功した場合、PRDは92.9%の確率でテスト同等のバイナリを生成し、動作の整合性が保たれていることを確認した。
- PRD統合済みのAPRツールは、DARPA CGCバイナリの148件の脆弱性のうち85件を是正し、全ソースAPRツールと同等またはそれ以上の性能を発揮した。
- PRDを活用したAPRツールは、トップCGCチームが生成したパッチよりも品質の高いパッチを生成したケースもあり、修復品質の競争力が示された。
- 本手法は、CGC、Rode0Day、MITRE CVEといった複数のデータセットに一般化可能であり、C++およびストリップドバイナリ(デコンパイラ対応時)をサポートする。
- 関数オフセットと参照タイプに限定したタイプ推論により、完全なタイプ推論への依存を減らし、スケーラビリティと実用性を高めた。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。