DecompileBench
收藏资源简介:
DecompileBench是一个用于评估反编译器在真实世界场景中的性能的全面框架,包含从130个真实世界程序中提取的23,400个函数。数据集由中国科学院信息工程研究所、清华大学和北京大学的研究人员创建,旨在解决当前反编译器评估方法的局限性,提供更真实、全面的评估结果。数据集通过运行时一致性验证和基于任务的指标,对反编译器的功能正确性和可读性进行评估。DecompileBench的发布将促进反编译器研究的发展,并帮助安全专家根据具体需求选择合适的工具。
DecompileBench is a comprehensive framework for evaluating decompiler performance in real-world scenarios, containing 23,400 functions extracted from 130 real-world programs. Developed by researchers from the Institute of Information Engineering of the Chinese Academy of Sciences, Tsinghua University, and Peking University, this dataset aims to address the limitations of current decompiler evaluation methods and deliver more authentic and comprehensive evaluation results. It assesses the functional correctness and readability of decompilers through runtime consistency verification and task-based metrics. The release of DecompileBench will advance decompiler-related research and help security experts select appropriate tools tailored to their specific needs.
DecompileBench 数据集概述
数据集简介
DecompileBench 是一个用于评估反编译工具性能的数据集,支持传统反编译器和大型语言模型(LLM)的评估。
依赖项
- LLVM 18
数据准备
- 克隆
oss-fuzz项目 - 修改
base-builderDockerfile 以支持函数提取 - 构建 Docker 镜像
- 编译用于链接fuzzer的虚拟库
配置
- 默认配置文件:
config.yamloss_fuzz_path:oss-fuzz项目路径decompilers: 待评估的反编译器列表opts: 待评估的优化级别列表
函数提取
- 执行fuzzers收集覆盖函数信息
- 使用
clang和clang-extract提取函数 - 可选参数:
--worker-count指定工作线程数,--project指定特定项目
编译
- 设置环境变量:
LIBCLANG_PATH: libclang库文件路径dataset_path: 数据集输出路径
- 执行编译脚本: shell python compile_ossfuzz.py --output $dataset_path
- 输出结构:
$dataset_path/binary: 编译后的二进制文件$dataset_path/compiled_ds: 包含元数据的数据集$dataset_path/eval: 评估基准数据集
反编译
传统反编译器
- 设置反编译器服务
- 使用
declient与服务交互 - 执行反编译命令示例: shell python decompile.py --base-dataset-path $dataset_path --output $dataset_path/decompiled_ds_hexrays --decompilers hexrays
LLM反编译器
- 执行示例: shell python refine.py --dataset $dataset_path/decompiled_ds_hexrays --model gpt-4o-mini --output-file $dataset_path/gpt-4o-mini.jsonl --concurrency 30
数据集合并
- 合并多个反编译结果: shell python merge.py --base-dataset-path $dataset_path/ --decompiled-datasets $dataset_path/gpt-4o-mini.jsonl $dataset_path/decompiled_ds_ghidra/ $dataset_path/decompiled_ds_hexrays/ --output $dataset_path/decompiled_ds
评估
-
成功率评估: shell python evaluate_rsr.py --decompiled-dataset $dataset_path/decompiled_ds --decompilers hexrays
-
覆盖率评估: shell python evaluate_cer.py --dataset $dataset_path/decompiled_ds
-
代码质量评估: shell python code_quality.py --run --model your_model --dataset ./decompiled_ds_all --output your_output_path




