arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.08670cs.SE
收藏

通过细粒度依赖分析与LLM辅助语义恢复增强智能合约反编译器输出

Augmenting Smart Contract Decompiler Output through Fine-grained Dependency Analysis and LLM-facilitated Semantic Recovery

Zeqin Liao, Yuhong Nan, Zixu Gao, Henglong Liang, Sicheng Hao, Peifan Reng, Zibin Zheng

AI总结:

SmartHalo结合静态分析与大语言模型,通过依赖图和语义恢复增强智能合约反编译器输出,显著提升方法边界、变量类型和合约属性的精确率。

摘要:

反编译器是一种专门类型的逆向工程工具,广泛用于程序分析任务,特别是在程序理解和漏洞检测中。然而,当前Solidity智能合约反编译器在重建原始源代码方面面临显著限制。特别是,最先进反编译器的瓶颈在于方法识别不准确、变量类型恢复错误以及合约属性缺失。这些缺陷阻碍了下游任务和对程序逻辑的理解。为了解决这些挑战,我们提出了SmartHalo,一种新框架,通过结合静态分析(SA)和大语言模型(LLM)来增强反编译器输出。SmartHalo利用SA在控制和数据流分析方面的准确性以及LLM在语义预测方面的能力的互补优势。更具体地,SmartHalo构建了一种新的数据结构——依赖图(DG),通过静态分析提取语义依赖。然后,它利用DG为LLM优化创建提示。最后,通过符号执行和形式化验证来验证LLM输出的正确性。在由465个随机选择的智能合约方法组成的数据集上的评估表明,与最先进的反编译器(如Gigahorse)相比,SmartHalo显著提高了反编译代码的质量。值得注意的是,将GPT-4o与SmartHalo集成进一步增强了其性能,在方法边界、变量类型和合约属性上分别实现了87.39%、90.39%和80.65%的精确率。

英文摘要:

Decompiler is a specialized type of reverse engineering tool extensively employed in program analysis tasks, particularly in program comprehension and vulnerability detection. However, current Solidity smart contract decompilers face significant limitations in reconstructing the original source code. In particular, the bottleneck of SOTA decompilers lies in inaccurate method identification, incorrect variable type recovery, and missing contract attributes. These deficiencies hinder downstream tasks and understanding of the program logic. To address these challenges, we propose SmartHalo, a new framework that enhances decompiler output by combining static analysis (SA) and large language models (LLM). SmartHalo leverages the complementary strengths of SA's accuracy in control and data flow analysis and LLM's capability in semantic prediction. More specifically, \system{} constructs a new data structure - Dependency Graph (DG), to extract semantic dependencies via static analysis. Then, it takes DG to create prompts for LLM optimization. Finally, the correctness of LLM outputs is validated through symbolic execution and formal verification. Evaluation on a dataset consisting of 465 randomly selected smart contract methods shows that SmartHalo significantly improves the quality of the decompiled code, compared to SOTA decompilers (e.g., Gigahorse). Notably, integrating GPT-4o with SmartHalo further enhances its performance, achieving precision rates of 87.39% for method boundaries, 90.39% for variable types, and 80.65% for contract attributes.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑