PCodeTrans:将反编译的伪代码翻译成可编译和可执行的等价代码
PCodeTrans: Translate Decompiled Pseudocode to Compilable and Executable Equivalent
AI总结:
PCodeTrans通过反馈驱动框架解决反编译伪代码的可编译性和执行准确性问题,通过动态验证和LLM迭代修复实现高精度代码恢复。
摘要:
反编译是二进制分析的基础,但传统工具更注重人类可读性而非严格的可重新编译性和可验证的运行时正确性。尽管最近基于大语言模型(LLM)的方法试图优化反编译伪代码,但它们通常只优化可读性或依赖静态分析进行评估。这使它们容易产生“语义幻觉”,影响准确性,并无法解决实际的运行时故障。在软件现代化和漏洞修复等关键任务中,恢复的代码不仅需要能够编译,还必须复制原始二进制的行为。我们提出了PCodeTrans,一种反馈驱动的框架,它弥合了反编译、重新编译和严格函数级动态验证之间的差距。在提取最小但连贯的上下文以确保可重新编译性后,PCodeTrans使用一种原地可替换的引擎,将编译后的函数直接替换到未修改的二进制中,从而原生保留其真实的执行上下文和全局依赖。通过细粒度的差分追踪,PCodeTrans生成精确的运行时反馈,引导LLM修复语义差异。在Coreutils和Binutils上的评估表明,PCodeTrans在修正原始Hex-Rays输出时实现了前所未有的恢复性能,实现了未剥离二进制的100%函数级可编译性,以及99.55%和99.89%的测试验证行为一致性。在此过程中,它解决了76.56%和79.74%由官方测试套件暴露的逻辑错误。展现出极强的鲁棒性,PCodeTrans在完全剥离的二进制上仍能保持超过96%的行为一致性。通过显著优于所有现有基线,PCodeTrans铺平了将反编译伪代码可靠地翻译成可编译和可执行等价代码的实践路径。
英文摘要:
Decompilation is foundational to binary analysis, yet conventional tools prioritize human readability over strict recompilability and verifiable runtime correctness. While recent LLM-based approaches attempt to refine decompiled pseudocode, they typically either optimize solely for readability or rely on static analysis for evaluation. This makes them prone to "semantic hallucinations" that compromise accuracy and fail to resolve actual runtime failures. For critical tasks like software modernization and vulnerability remediation, recovered code must not only compile but replicate the original binary's behavior. We present PCodeTrans, a feedback-driven framework that bridges the gap between decompilation, recompilation, and rigorous function-level dynamic validation. After extracting a minimal yet coherent context to guarantee recompilability, PCodeTrans employs an in situ substitutable engine to hot-swap the compiled function directly into the unmodified binary, natively preserving its authentic execution context and global dependencies. Guided by fine-grained differential tracing, PCodeTrans generates precise runtime feedback to iteratively guide an LLM in repairing semantic discrepancies. Evaluated on Coreutils and Binutils, PCodeTrans achieves unprecedented recovery performance when rectifying raw Hex-Rays outputs, attaining 100% function-level compilability on unstripped binaries alongside 99.55% and 99.89% test-validated behavioral consistency, respectively. In doing so, it resolves 76.56% and 79.74% of logic errors exposed by official test suites. Exhibiting exceptional resilience, PCodeTrans maintains over 96% behavioral consistency even on fully stripped binaries. By significantly outperforming all existing baselines, PCodeTrans paves a practical path to reliably translate decompiled pseudocode into compilable and executable equivalents.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。