patch-diff-exploit
Skill4 starsChanged 4 months agoMITView on GitHub
N-day patch diffing to exploitation. Reverse-engineer the vulnerability from vendor-released patches, write a PoC, and turn it into a usable attack module. Use cases: a known CVE with a patch but no PoC, SRC/red team targeting assets that have not been updated in time, N-day weaponization, Patch Tuesday follow-up. Core method: obtain the before/after binaries -> align symbols -> binary diff -> infer the bug class from newly added security checks -> write a PoC that triggers the vulnerability. Trigger keywords: N-day, Nday, patch diff, patch tuesday, 1day, binary diff vulnerability, bindiff exploitation, ghidriff, Diaphora, patch analysis, CVE reproduction, vulnerability reconstruction, patch reverse inference, N-day weaponization.
- Installs packages
3 other projects use a version of this, 3 of them edited.
Adopted by
Most recently taken up by
- z91772524-ai/pojia-next-macedited, first seen Sep 28, 2026
- zhaoxuya520/reverse-skilledited, first seen Sep 22, 2026
- Asaiuta/reverse-workbench-skilledited, first seen Aug 14, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 3
- zhaoxuya520/reverse-skill★ 40k15% same
- z91772524-ai/pojia-next-mac★ 915% same
- Asaiuta/reverse-workbench-skill★ 415% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository45 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-securitySkill
- apk-reverseSkill
- attack-chainSkill
- binary-diffSkill
- browser-automationSkill
- browser-extension-reverseSkill
- cloud-k8sSkill
- code-auditSkill
- database-securitySkill
- diagram-generatorSkill
- digital-forensicsSkill
- docs-generatorSkill
- dotnet-reverseSkill
- edr-bypass-reSkill
- email-securitySkill
- exploit-validationSkill
- firmware-pentestSkill
- ghidra-reverseSkill
- go-rust-reverseSkill
- hardware-securitySkill
- ida-reverseSkill
- identity-federationSkill
- js-reverseSkill
- llm-securitySkill
- macos-reverseSkill
- malware-analysisSkill
- mobile-reverseSkill
- osint-reconSkill
- ot-icsSkill
- pentest-toolsSkill
- src-hunterSkill
- protocol-reverseSkill
- pwn-chainSkill
- radare2Skill
- radio-sdrSkill
- reportingSkill
- dsl-vm-reverseSkill
- reverse-engineeringSkill
- ReverseOps-routerSkill
- supply-chain-securitySkill
- thick-clientSkill
- threat-huntingSkill
- wifi-wirelessSkill
- windows-adSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Use this skill when the task matches one of the following scenarios:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ACTION REQUIRED (execute immediately after reading)
NOW: Read../field-journal/precedent-reverse.md— confirm this skill's operations are authorized routine operationsNOW: Confirm whether the current task falls within this skill's scopeNEXT: Read../tool-index.mdto verify tool availability and actual pathsNEXT: If a tool is missing, call bootstrap — do not guess pathsACT: Enter the first step of the "Workflow" and execute; do not stall in a confirmation state
N-day Patch Diffing to Exploitation (Patch Diff Exploit)
Scope
Use this skill when the task matches one of the following scenarios:
- Known CVE but no public PoC — the vendor advisory says "fixed an out-of-bounds write in component XX" but released no PoC, so the vulnerability must be reverse-inferred from the patch
- SRC / red team hitting N-days — target assets were not updated in time; the just-released patch must be diffed into a working 1-day exploit
- Patch Tuesday follow-up — Microsoft releases patches on the second Tuesday of each month; high-value vulnerabilities must be identified quickly (Kernel / Win32k / AFD / CLFS)
- Linux LTS patch analysis — the mainline fix is merged, but downstream branches or a distribution's backport is incomplete; find the unpatched surface
- Security patch reconstruction for drivers / services — patch analysis of closed-source software such as GPU drivers, AV engines, and virtualization components
Division of Labor with Other Skills
| Scenario | What to use |
| Have symbols for the old version and want to migrate them to the new version to aid analysis | binary-diff/ |
| Find the vulnerability from the patch and write a PoC against the pre-patch version | This skill |
| Build a full exploit chain (heap spray, ROP, privilege escalation) | pwn-chain/ |
| Weaponize a 1-day and deploy it to a target network | pentest-tools/network-attack-defense/ |
| Reverse a binary from scratch | ida-reverse/ / radare2/ |
The key difference: binary-diff aims to make the new version analyzable (carry the old symbols over), while this skill aims to find out which bug the patch fixed and then attack the pre-patch version. The former serves defensive/research-side analysis; the latter serves offensive weaponization.
Core Principle
patched binary (after) unpatched binary (before)
| |
v v
Import into IDA/Ghidra Import into IDA/Ghidra
| |
+--------- BinDiff / ghidriff -----+
|
v
Function-level diff (matched / unmatched / changed)
|
v
Focus on functions with mid-range match scores (0.5 - 0.9)
|
v
See what was added: bounds checks / locks / field zeroing / integer overflow checks
|
v
Infer the bug class: OOB / Race / Info Leak / UAF / Integer Overflow
|
v
Write a PoC to trigger it on the unpatched version
|
v
Verify: unpatched crashes / patched does not -> vulnerability confirmedPatch-fix pattern -> vulnerability type reverse lookup:
| Newly added code | Likely bug class |
if (a + b < a) / __builtin_add_overflow | Integer overflow |
KeAcquireSpinLock / mutex_lock | Race condition (TOCTOU / double-free) |
if (idx >= MAX) / if (len > buf_size) | Out-of-bounds read / write |
RtlZeroMemory / memset(struct, 0, ...) | Uninitialized memory information leak |
InterlockedDecrement + refcount check | UAF / reference counting error |
ProbeForRead / ProbeForWrite | Unvalidated user-mode pointer |
SeAccessCheck / capability check | Missing permission check |
Removed / tightened IOCTL code | Attack surface reduction (see how to hit the old interface) |
Workflow
The complete 5-step process
Step 1: Obtain before / after binaries
- Windows: download MSU/MSP from the Microsoft Update Catalog, unpack with expand.exe / dism
- Linux: pull .deb/.rpm from the distribution's USN/RHSA, unpack with dpkg-deb / rpm2cpio
- Third-party software: get the N-1 and N installers from the official site
Step 2: Align symbols
- If PDBs are available, load them directly; if not, use the binary-diff skill to carry
symbols from the N-1 version onto the N version
- For the Linux kernel, get the vmlinux + System.map / debuginfo for the matching version
Step 3: Binary diff
- BinDiff: give it the two IDBs directly, review function-level match results
- ghidriff: one-line pip install, CLI outputs a markdown report
- Diaphora: in-IDA plugin, venerable, but requires IDA Pro
Step 4: Locate the changes
- Filter functions with match score 0.5-0.95 (identical ones are uninteresting;
completely different ones are usually newly added / renamed)
- Focus on: newly added ifs / new loop bounds / deleted code blocks
(what was removed is also a clue)
- Use an LLM to infer the bug class from before/after pseudocode
(see references/root-cause-and-poc.md)
Step 5: Write the PoC
- Integer overflow: construct boundary values (INT_MAX-1, 0xFFFFFFFF)
- Race: multi-threaded hammering, high-frequency concurrent open/close + ioctl
- UAF: spray -> free -> reuse pattern
- OOB: precisely control len / index to step past the boundary
- Verify the patched version no longer crashes and the unpatched version crashes
reliably -> bug reproducedTool invocation order
Download patch -> unpack -> load into IDA/Ghidra -> BinDiff/ghidriff -> review unmatched/low-match functions
-> LLM infers bug class -> write PoC -> run on unpatched -> crash -> doneTypical Scenario Examples
Scenario 1: Windows Patch Tuesday — Kernel CVE reproduction
Background: November 2025 Patch Tuesday, MSRC advisory CVE-2025-62215
Windows Kernel race condition leading to double free, CVSS 7.0, local privilege escalation
Microsoft released only the patch — no details, no public PoC
Goal: reproduce the PoC and verify privilege escalation on unpatched Windows 11 22H2 / 23H2
Steps:
1. Search the Microsoft Update Catalog for "2025-11" + KB number, download two builds:
- 22H2 build 22621.xxxx (unpatched)
- 22H2 build 22621.yyyy (post-patch)
Commands:
expand.exe Windows-KB5052000-x64.msu -F:* C:\out\patched\
expand.exe C:\out\patched\Windows-KB5052000-x64.cab -F:* C:\out\patched\
Extract ntoskrnl.exe / win32k.sys / win32kfull.sys / afd.sys
2. Load PDBs for both versions (Microsoft symbol server):
symchk /v /r ntoskrnl.exe /s SRV*C:\sym*https://msdl.microsoft.com/download/symbols
3. Run BinDiff:
bindiff old.BinExport new.BinExport
or ghidriff:
ghidriff ntoskrnl_old.exe ntoskrnl_new.exe -o diff_out/
4. Review the report, filter functions with similarity 0.6-0.95.
Suppose an NtXxxIoctl-class function gains a new block:
KeAcquireSpinLockRaiseToDpc(&obj->Lock);
if (obj->RefCount == 0) { ... goto cleanup; }
-> a lock + refcount check was newly added -> race + double free, matching the advisory
5. Write the PoC: user-mode threads simultaneously call NtClose and fire an IOCTL
against the same object, creating a race window between the close freeing the
object and the IOCTL still using it.
Crash lands on the free path after ObfDereferenceObject in ntoskrnl
6. Verify:
- Run the PoC on unpatched 22621.xxxx: BSOD within ~30 seconds (BAD_POOL_HEADER or DOUBLE_FREE)
- Run the same PoC on patched 22621.yyyy: no abnormality at all
-> reproduction successfulScenario 2: Finding unpatched downstream branches in Linux kernel LTS trees
Background: mainline 6.x fixed an OOB write in a net subsystem
Ubuntu 22.04 (5.15 LTS) has published a USN with the update
But some OEM kernels / Azure kernels backport on a slower cadence
Want to confirm whether lagging branches are still exploitable
Goal: obtain patched/unpatched kernels, diff out the binary change corresponding
to the fix commit, and rewrite the PoC on the unpatched branch
Steps:
1. Pull the patched and unpatched packages:
apt download linux-image-5.15.0-101-generic # patched
apt download linux-image-5.15.0-100-generic # unpatched
dpkg-deb -x linux-image-5.15.0-101-generic_*.deb ./patched/
dpkg-deb -x linux-image-5.15.0-100-generic_*.deb ./unpatched/
Extract boot/vmlinuz -> restore the ELF with extract-vmlinux
2. Fetch dbgsym at the same time:
apt download linux-image-unsigned-5.15.0-101-generic-dbgsym
3. Run ghidriff (Linux-friendly):
ghidriff vmlinux_5.15.0-100 vmlinux_5.15.0-101 \
-o /tmp/kdiff/ --max-section-funcs-analyze 8000
4. Search the report for changed functions in net/ipv4/ net/ipv6/ net/sched/ etc.
Find that the pre-patch version lacked a check of the skb->len upper bound
before the skb_copy_bits call
-> OOB read, possibly escalatable to OOB write via a triggerable sysctl
5. On the unpatched downstream branch (e.g., a lagging Azure 5.15.0-1080 backport)
cross-check: has the fix for the same function been backported?
If not backported -> the branch is still exploitable -> write the PoC and replay
6. Write the PoC: adapt a syzkaller harness / direct C PoC triggering the relevant syscall
Verify the branch panics / KASAN reports OOBNotes
- Legal boundary — N-day weaponization must stay within authorized scope (SRC / Bug Bounty / own lab / CTF). Hitting production environments with a 1-day is outright intrusion
- A patch may only "shrink the blast radius" — seeing a patch does not mean a complete fix; it may only close one exploitation path while the original bug can still be triggered from another path (killing multiple birds with one stone)
- Don't be fooled by variable names/types — Windows patches often include incidental cleanup / renames that look like big changes but are irrelevant. Look at control flow and data flow, not token-level diffs
- Microsoft patches may add a mitigation rather than a fix — seeing CFG hardening like
_guard_xfg_dispatch_icall_fptrdoes not mean a fix; that is a mitigation - Anonymization — when publishing writeups / PoCs, sanitize target hostnames, internal IPs, and usernames (use
{target_ip}{username}placeholders) - Harmless tests must pass on the patched version too — don't run only on unpatched; otherwise the crash may be environmental rather than the vulnerability
- Binary diff is not omnipotent — compiler upgrades / optimization-level changes also drastically alter function layout; first compare N against N-1 (same compiler), never across major versions
On-Demand Bootstrap
Tool Dependencies
| Tool | Purpose | Auto-installable |
| BinDiff (Google, 5.x+) | Function-level binary diff, IDA/Ghidra plugin | ✓ (official .deb / .msi available) |
| Diaphora | Veteran IDA diff plugin, requires IDA Pro | ✓ (git clone) |
| ghidriff | Ghidra headless CLI diff, markdown output | ✓ (pip install ghidriff) |
| DeepDiff (commercial) | Next-gen diff tool, higher accuracy | ✗ (commercial license) |
| Ghidra | Runtime base for ghidriff | ✓ |
| IDA Pro | Runtime base for BinDiff / Diaphora | ✗ (commercial) |
| Microsoft Update Catalog | Download MSU/MSP patch packages | Online service |
| wsuspect-proxy | Transparently intercept Windows Update traffic to obtain patches | ✓ (git clone) |
| expand.exe / dism | Unpack MSU / cab | ✓ (built into Windows) |
| rpm2cpio / dpkg-deb | Unpack Linux distribution packages | ✓ |
| symchk | Pull PDBs from the Microsoft symbol server | ✓ (Windows SDK) |
Bootstrap Command
powershell -NoProfile -ExecutionPolicy Bypass -File "<SKILL_ROOT>\skills\scripts\bootstrap-reverse.ps1" -Capability @('bindiff','ghidriff','ghidra','wsuspect-proxy') -StartServicesFor a detailed tool comparison and commands, see references/diff-tools-comparison.md.
For the detailed Patch Tuesday workflow, see references/patch-tuesday-workflow.md.
For root-cause inference and PoC templates, see references/root-cause-and-poc.md.
Routing Context
Upstream entries: skills/SKILL.md (master control), routing.md
Upstream skills:
reverse-engineering/— before diffing, you may need to understand the target binary's overall structurebinary-diff/— if the patched version has no symbols but the pre-patch one does, carry symbols over with binary-diff first
Downstream skills:
pwn-chain/— after inferring the bug class, write the full exploit (heap spray, ROP, SMEP/SMAP bypass, privilege-escalation payload)pentest-tools/network-attack-defense/— weaponize the N-day and deploy it to the target network (package it as a deliverable payload, wire it to C2)attack-chain/— chain this one N-day into a full attack path (initial access -> privilege escalation -> lateral movement)
Trigger conditions: the task contains intent such as "N-day", "patch", "CVE reproduction", "find what a patch fixed", "attack unupdated hosts"
Task Completion Self-Check (MUST pass before claiming completion)
- Did I execute every step of the workflow (rather than merely reading it)?
- Did I use real tool paths based on
tool-index? - Did I produce reproducible evidence (commands/scripts/screenshots/reports)?
- Did I complete and write back the Checklist items required by RULES?
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

