patch-diff-exploit
Lets the agent find security flaws in software. It compares code versions and helps create tests. Useful for security researchers.
What it does
This tool helps find security flaws in software updates (patches). It compares different versions of a program to pinpoint where fixes were applied and assists in creating examples of how to exploit these flaws for authorized research.
When to use it
- ✓When you have a security advisory about software but don't know the exact location of the problem.
- ✓When building a practical example (proof of concept) of a vulnerability that has already been fixed, for authorized research purposes.
- ✓To check if security flaws fixed in recent updates can still be exploited on systems that haven't been updated.
Example of what to ask your AI
“I want to analyze security update KB12345 for program XYZ. Can you help me find the fixed vulnerability and create an example of how it worked before the fix?”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool compares two versions of the same software: one before the fix (vulnerable) and one after (patched). It analyzes the code differences to locate the exact part that was modified to correct the flaw.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill patch-diff-exploitOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/patch-diff-exploit/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
⚠️ AUTHORIZED USE ONLY This skill is for educational purposes or authorized security assessments only. You must have explicit, written permission from the system owner before using this tool. Misuse of this tool is illegal and strictly prohibited.
Mandatory confirmation gate Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:
- Ask the user to state the exact target URL, IP, account, or resource.
- Ask the user to confirm written authorization and the permitted scope.
- Show the exact command(s) and explain their expected effect.
- Wait for explicit confirmation in the current conversation.
Without that confirmation, remain read-only and provide defensive guidance only. Prefer a sandbox, disposable VM, or controlled lab.
When to Use
- Turning a vendor security advisory into a concrete vulnerable-function location.
- Building a proof-of-concept for a patched vulnerability in authorized research.
适用范围
当任务属于以下场景时使用本 skill:
- 已知 CVE 但无公开 PoC — 厂商公告写了"修复了 XX 组件的越界写"但没放 PoC,需要从补丁反推
- SRC / 红队打 N-day — 目标资产未及时更新,需要把刚发布的补丁差成可用的 1-day 利用
- Patch Tuesday 跟进 — 每月第二个周二微软放补丁,需要快速锁定高价值漏洞(Kernel / Win32k / AFD / CLFS)
- Linux LTS 补丁分析 — 主线 fix 已合并,但旁支或某发行版 backport 不全,找未修补面
- 驱动 / 服务的安全补丁还原 — 显卡驱动、AV 引擎、虚拟化组件等闭源软件的补丁分析
与其他 skill 的分工
| 场景 | 用什么 |
|---|---|
| 有旧版符号,迁移到新版本帮助分析 | binary-diff/ |
| 从补丁找漏洞、写 PoC 打补丁前版本 | 本 skill |
| 写出完整利用链(堆喷、ROP、提权) | pwn-chain/ |
| 把 1-day 武器化部署到目标网络 | pentest-tools/network-attack-defense/ |
| 从零逆向一个二进制 | ida-reverse/ / radare2/ |
差别的关键:binary-diff 的目标是让新版可分析(把旧符号搬过来),本 skill 的目标是找出补丁修了什么 bug 然后打补丁前的版本。前者服务防御侧 / 研究侧分析,后者服务攻击侧武器化。
核心原理
patched 二进制 (after) unpatched 二进制 (before)
↓ ↓
导入 IDA/Ghidra 导入 IDA/Ghidra
↓ ↓
└──────── BinDiff / ghidriff ──────┘
↓
函数级 diff(matched / unmatched / changed)
↓
聚焦 match score 中等的函数(0.5 - 0.9)
↓
看新增了什么:边界检查 / 锁 / 字段清零 / 整数溢出检查
↓
反推 bug class:OOB / Race / Info Leak / UAF / Integer Overflow
↓
在 unpatched 版本上写 PoC 触发
↓
验证:unpatched 崩 / patched 不崩 → 漏洞确认
补丁修复模式 → 漏洞类型反查:
| 新增内容 | 大概率的 bug class |
|---|---|
if (a + b < a) / __builtin_add_overflow |
整数溢出 |
KeAcquireSpinLock / mutex_lock |
竞争条件 (TOCTOU / double-free) |
if (idx >= MAX) / if (len > buf_size) |
越界读 / 越界写 |
RtlZeroMemory / memset(struct, 0, ...) |
未初始化内存信息泄漏 |
InterlockedDecrement + refcount 检查 |
UAF / 引用计数错误 |
ProbeForRead / ProbeForWrite |
用户态指针未校验 |
SeAccessCheck / capability 校验 |
权限校验缺失 |
删除 / 收紧 IOCTL code |
暴露面收敛(看老接口怎么打) |
工作流
5 步完整流程
Step 1: 拿 before / after 二进制
- Windows: Microsoft Update Catalog 下 MSU/MSP,用 expand.exe / dism 解包
- Linux: 从发行版 USN/RHSA 拉 .deb/.rpm,用 dpkg-deb / rpm2cpio 解包
- 第三方软件: 官网取 N-1 和 N 版本安装包
Step 2: 对齐符号
- 有 PDB 直接吃,没 PDB 时用 binary-diff skill 把 N-1 版本的符号搬到 N 版本
- Linux 内核取对应版本的 vmlinux + System.map / debuginfo
Step 3: 二进制 diff
- BinDiff: 直接给两个 IDB,看函数级匹配结果
- ghidriff: pip 一键安装,CLI 输出 markdown 报告
- Diaphora: IDA 内插件,老牌但需要 IDA Pro
Step 4: 定位变更
- 过滤 match score 0.5-0.95 的函数(完全相同的不看,完全不同的多半是新加 / 重命名)
- 重点看:新增的 if / 新增的循环边界 / 删除的代码块(删了什么也是线索)
- 用 LLM 看 before/after 伪代码反推 bug class(见 references/root-cause-and-poc.md)
Step 5: 写 PoC
- 整数溢出:构造边界值(INT_MAX-1、0xFFFFFFFF)
- 竞争:多线程 hammer,open/close + ioctl 高频并发
- UAF:spray → free → reuse pattern
- OOB:精确控制 len / index 越过边界
- 验证 patched 版本不再崩,unpatched 版本稳定崩 → bug 复现成功
工具调用顺序
下补丁 → 解包 → 加载到 IDA/Ghidra → BinDiff/ghidriff → 看 unmatched/low-match 函数
→ LLM 反推 bug class → 写 PoC → 在 unpatched 跑 → 崩 → 收工
典型场景示例
场景 1:Windows Patch Tuesday — Kernel CVE 复现
背景:2025 年 11 月 Patch Tuesday,MSRC 公告 CVE-2025-62215
Windows Kernel race condition 导致 double free,CVSS 7.0,本地提权
微软只放了补丁,没放细节,没有公开 PoC
目标:复现 PoC,验证未打补丁的 Windows 11 22H2 / 23H2 可提权
步骤:
1. Microsoft Update Catalog 搜 "2025-11" + KB 号,下两个版本:
- 22H2 build 22621.xxxx (unpatched)
- 22H2 build 22621.yyyy (patched 后)
命令:
expand.exe Windows-KB5052000-x64.msu -F:* C:\out\patched\
…
FAQ
Do I need permission to use this tool?
Yes, this tool is for educational purposes or authorized security assessments only. You must have explicit, written permission from the system owner before using it. Misuse is illegal.
What is a 'patch'?
A patch is a software update designed to fix bugs or security vulnerabilities.
What is a 'PoC' (Proof of Concept)?
A PoC is a simple example that demonstrates that a security vulnerability exists and how it can be exploited.
Details
Original description by the author
Locate vulnerability fixes in vendor patches, diff binaries across versions, and build N-day PoCs. Attack-side complement to binary-diff for authorized research.
Popularity
- GitHub stars
- 48k
- Ranking position
- #3795
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
django-security
Helps your agent implement security practices in Django applications. It focuses on authentication, authorization, and prevention against common attacks, ensuring more secure code.
affaan-m/ECC
laravel-security
Helps your agent secure Laravel applications against threats. Implements security practices for authentication, authorization, and common attack prevention.
affaan-m/ECC
module-regression
Helps your agent manage changes in large projects. Ensures code changes in one part don't break other parts.
affaan-m/ECC