Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)48k · #4033

binary-diff

Skill này làm gì

Công cụ này so sánh hai phiên bản của một chương trình để tìm các hàm và thông tin tương ứng, ngay cả khi tên gốc đã mất. Nó giúp chuyển chú thích và tên hàm từ phiên bản cũ sang phiên bản mới.

Khi nào nên dùng

  • ✓Khi một chương trình được cập nhật và bạn cần giữ lại các chú thích cũ.
  • ✓Khi cần tìm các hàm đã thay đổi giữa hai phiên bản của chương trình mà không có thông tin gốc.
  • ✓Khi cần khôi phục tên hàm đã mất sau một lần cập nhật phần mềm.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/binary-diff/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/binary-diff/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“So sánh phiên bản cũ của chương trình này với phiên bản mới và cho tôi biết vị trí các hàm đã được di chuyển hoặc đổi tên.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ lấy mã từ hai phiên bản chương trình, dùng một mô hình ngôn ngữ để so sánh các phần và tạo bản đồ tương ứng. Bản đồ này sau đó được dùng để đổi tên hoặc chú thích các hàm trong phiên bản mới.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

跨版本符号迁移 (Binary Diff)

When to Use

  • A program updated and old annotations/symbols must be migrated to the new build.
  • Recovering changed functions between two versions of a stripped binary.

适用范围

当任务属于以下场景时使用本 skill:

  1. 内核/驱动缺 PDB — 有旧版 ntoskrnl.exe 的符号,新版 PDB 被微软下架,需要用旧版符号推导新版非导出函数地址
  2. 程序更新后符号迁移 — 曾经逆向过某个程序,程序更新了,不想重新逆一遍,用旧版结果批量迁移
  3. 保护机制更新 — 旧版有完整逆向结果,新版需要快速定位同一函数的新偏移
  4. 任何"有旧版符号 + 新版无符号"的二进制对比场景

与其他 skill 的分工

场景 用什么
从零开始逆向一个二进制 ida-reverse/ 或 radare2/
有旧版结果,迁移到新版 本 skill
两个完全不同的二进制对比 BinDiff / Diaphora(传统工具)

核心优势

相比传统方案:

方案 200 个函数成本 时间 准确率
人工开两个 IDA 窗口对比 免费但耗命 数小时 高
BinDiff 自动匹配 免费 快 中(结构变化大时失效)
完全交给 Agent(CC/Codex) 50-100 元 慢 高
本 skill(LLM 批量比对) ~1 元 ~10 秒/函数 高

核心原理

旧版函数(有符号)          新版同一函数(无符号)
    ↓                              ↓
导出反汇编 + 伪代码          导出反汇编 + 伪代码
    ↓                              ↓
    └──────── LLM 结构化比对 ────────┘
                    ↓
         输出 YAML(符号映射表)
                    ↓
         程序化解析 → 批量应用到新版 IDB

关键点:

  • prompt 是固定模板,程序化填充
  • 输入输出格式确定,程序化解析
  • LLM 只负责"看两段代码,找出对应关系"这一步
  • 时间成本和 token 成本极低

Prompt 模板

标准比对 Prompt

I have disassembly outputs and procedure code of the same function.

This is the function for reference:

**Disassembly for Reference**
```c
{disasm_for_reference}

Procedure code for Reference

{procedure_for_reference}

This is the function you need to reverse-engineering:

Disassembly to reverse-engineering

{disasm_code}

Procedure code to reverse-engineering

{procedure}

What you need to do is to collect all references to "{symbol_name_list}" in the function you need to reverse-engineering and output those references as YAML.

Example:

found_vcall: # This is for indirect call to virtual function or virtual function pointer fetching.
  - insn_va: '0x180777700' # Always be the instruction with displacement offset
    insn_disasm: call [rax+68h] # Always be the instruction with displacement offset
    vfunc_offset: '0x68'
    func_name: ILoopMode_OnLoopActivate
  - insn_va: '0x180777778' # Always be the instruction with displacement offset
    insn_disasm: mov rax, [rax+80h] # Always be the instruction with displacement offset
    vfunc_offset: '0x80'
    func_name: INetworkMessages_GetNetworkGroupCount

found_call: # This is for direct call to non-virtual regular function.
  - insn_va: '0x180888800'
    insn_disasm: call sub_180999900
    func_name: CLoopMode_RegisterEventMapInternal
  - insn_va: '0x180888880'
    insn_disasm: call sub_180555500
    func_name: CLoopMode_SetSystemState

found_funcptr: # This is for non-virtual regular function pointer.
  - insn_va: '0x180666600' # Must load/reference the function pointer target address
    insn_disasm: lea rdx, sub_15BC910 # Must load/reference the function pointer target address
    funcptr_name: CLoopMode_OnClientPollNetworking

found_gv: # This is for reference to global variable.
  - insn_va: '0x180444400'
    insn_disasm: mov rcx, cs:qword_180666600 # Must load/reference the global variable
    gv_name: g_pNetworkMessages
  - insn_va: '0x180333300'
    insn_disasm: lea rax, unk_180222200 # Must load/reference the global variable
    gv_name: s_EventManager

found_struct_offset: # This is for reference to struct offset. NOTE THAT virtual function pointer should not be here! virtual function pointer should ALWAYS be in found_vcall !
  - insn_va: '0x1801BA12A' # Always be the instruction with displacement offset
    insn_disasm: mov rcx, [r14+58h] # Always be the instruction with displacement offset
    offset: '0x58'
    size: 8
    struct_name: CResourceService
    member_name: m_pEntitySystem

If nothing found, output an empty YAML. DO NOT output anything other than the desired YAML. DO NOT collect unrelated symbols.


### 变量说明

| 变量 | 来源 | 说明 |
|------|------|------|
| `{disasm_for_reference}` | 旧版 IDA 导出 | 有符号的反汇编 |
| `{procedure_for_reference}` | 旧版 IDA 导出 | 有符号的伪代码 |
| `{disasm_code}` | 新版 IDA 导出 | 无符号的反汇编 |
| `{procedure}` | 新版 IDA 导出 | 无符号的伪代码 |
| `{symbol_name_list}` | 从旧版提取 | 需要在新版中定位的符号列表 |

## 工作流

### 完整流程

```text
Step 1: 准备数据
  - 旧版二进制加载到 IDA(有 PDB/符号)
  - 新版二进制加载到 IDA(无符号)
  - 找到两个版本中相同的锚点函数(导出函数、字符串引用等)

Step 2: 批量导出
  - 从旧版导出:锚点函数的反汇编 + 伪代码(含符号名)
  - 从新版导出:同一锚点函数的反汇编 + 伪代码(无符号名)

Step 3: LLM 比对
  - 用 prompt 模板填充数据

…
Câu hỏi thường gặp

“PDB” là gì?

PDB (Program Database) là các tệp chứa thông tin gỡ lỗi và ký hiệu của chương trình. Chúng giúp hiểu mã, nhưng đôi khi không có sẵn cho các phiên bản phần mềm mới.

Tại sao dùng công cụ này thay vì so sánh thủ công?

So sánh thủ công có thể mất hàng giờ và dễ sai sót. Công cụ này tự động hóa quá trình, nhanh hơn và chính xác hơn trong việc tìm điểm tương ứng giữa các phiên bản.

“Stripped binary” nghĩa là gì?

Nghĩa là chương trình được biên dịch theo cách loại bỏ thông tin giúp nhận diện tên hàm và biến, khiến việc phân tích khó hơn.

Chi tiết

Mô tả gốc của tác giả

Cross-version binary symbol migration: diff updated binaries, recover function names without PDBs, and propagate annotations after software updates using BinDiff-style tooling.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4033
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự