让大模型理解代码结构,提升反编译可编译性与正确性
HELIOS: Hierarchical Graph Abstraction for Structure-Aware LLM Decompilation
- 将二进制控制流抽象为分层文本结构,引导大模型理解程序逻辑
- 在x86_64上使Gemini 2.0的可编译率从45.0%升至85.2%,GPT-4.1 Mini达89.6%
- 无需微调即可跨六种架构保持高语法正确性,适合安全场景反向工程
大语言模型(LLMs)已用于二进制反编译,但通常将代码视为纯文本,忽略控制流图等结构性信息,导致输出语法脆弱、逻辑不一致,尤其在优化后的二进制中更为明显。本文提出 extsc{HELIOS},将基于LLM的反编译重构为结构化推理任务。该框架将二进制的控制流和函数调用归纳为分层文本表示,明确包含基本块、后继关系及循环、条件等高层模式。该表示与原始反编译输出一同输入通用大模型,可选结合编译器反馈机制,在生成代码无法编译时返回错误信息。在HumanEval-Decompile x86_64数据集上, extsc{HELIOS} 将Gemini 2.0的可编译率从45.0%提升至85.2%,GPT-4.1 Mini从71.4%提升至89.6%;加入编译器反馈后,可编译率超过94%,功能正确性最高提升5.6个百分点。在涵盖x86、ARM、MIPS的六种架构上, extsc{HELIOS} 降低了功能正确性的波动,同时保持高语法正确性,且无需微调。该特性使其成为安全领域中多目标硬件反向工程工作流的实用组件。
原文摘要 · Abstract (English)
Large language models (LLMs) have recently been applied to binary decompilation, yet they still treat code as plain text and ignore the graphs that govern program control flow. This limitation often yields syntactically fragile and logically inconsistent output, especially for optimized binaries. This paper presents \textsc{HELIOS}, a framework that reframes LLM-based decompilation as a structured reasoning task. \textsc{HELIOS} summarizes a binary's control flow and function calls into a hierarchical text representation that spells out basic blocks, their successors, and high-level patterns such as loops and conditionals. This representation is supplied to a general-purpose LLM, along with raw decompiler output, optionally combined with a compiler-in-the-loop that returns error messages when the generated code fails to build. On HumanEval-Decompile for \texttt{x86\_64}, \textsc{HELIOS} raises average object file compilability from 45.0\% to 85.2\% for Gemini~2.0 and from 71.4\% to 89.6\% for GPT-4.1~Mini. With compiler feedback, compilability exceeds 94\% and functional correctness improves by up to 5.6 percentage points over text-only prompting. Across six architectures drawn from x86, ARM, and MIPS, \textsc{HELIOS} reduces the spread in functional correctness while keeping syntactic correctness consistently high, all without fine-tuning. These properties make \textsc{HELIOS} a practical building block for reverse engineering workflows in security settings where analysts need recompilable, semantically faithful code across diverse hardware targets.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。