FidelityGPT:利用检索增强生成修正反编译失真
FidelityGPT: Correcting Decompilation Distortions with Retrieval Augmented Generation
AI总结:
针对反编译输出存在的保真度问题,提出结合RAG与动态语义强度、变量依赖算法的FidelityGPT框架,在闭源场景下显著提升反编译代码的检测准确率与修复效果。
摘要:
反编译将机器代码转换为人类可读的形式,使得无需源代码即可进行分析和调试。然而,保真度问题通常会降低反编译输出的可读性和语义准确性。现有方法(如变量重命名或结构简化)仅能实现部分改进,但缺乏鲁棒的检测与修正能力,尤其是针对复杂的闭源二进制文件。我们提出FidelityGPT,这一框架通过系统地检测并修正语义失真,提升反编译代码的准确性与可读性。FidelityGPT引入了适配闭源场景的失真感知提示模板,并将检索增强生成(Retrieval-Augmented Generation, RAG)与动态语义强度算法相结合,以定位失真代码行,并从数据库中检索语义相似的代码。变量依赖算法通过分析冗余变量并将其依赖关系整合到提示上下文中,进一步缓解了长上下文限制。在来自一个二进制相似性基准的620个函数对上进行评估,FidelityGPT取得了89%的平均检测准确率和83%的精确率。与当前最优的DeGPT(修复率83%,校正后修复率37%)相比,FidelityGPT达到了94%的修复率(FR)和64%的校正后修复率(CFR),在准确性和可读性上展现出显著提升。这些结果凸显了其推动基于大语言模型(LLM)的反编译与逆向工程发展的潜力。
英文摘要:
Decompilation converts machine code into human-readable form, enabling analysis and debugging without source code. However, fidelity issues often degrade the readability and semantic accuracy of decompiled output. Existing methods, such as variable renaming or structural simplification, provide partial improvements but lack robust detection and correction, particularly for complex closed-source binaries. We present FidelityGPT, a framework that enhances decompiled code accuracy and readability by systematically detecting and correcting semantic distortions. FidelityGPT introduces distortion-aware prompt templates tailored to closed-source settings and integrates Retrieval-Augmented Generation (RAG) with a dynamic semantic intensity algorithm to locate distorted lines and retrieve semantically similar code from a database. A variable dependency algorithm further mitigates long-context limitations by analyzing redundant variables and integrating their dependencies into the prompt context. Evaluated on 620 function pairs from a binary similarity benchmark, FidelityGPT achieved an average detection accuracy of 89% and a precision of 83%. Compared to the state-of-the-art DeGPT (Fix Rate 83%, Corrected Fix Rate 37%), FidelityGPT attained 94% FR and 64% CFR, demonstrating significant gains in accuracy and readability. These results highlight its potential to advance LLM-based decompilation and reverse engineering.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。