The Patch Hunter: Automating 1-Day Exploits with DiffRays and IDA Pro
DiffRays is a research-oriented tool for binary patch diffing, designed to aid in vulnerability research, exploit development, and reverse engineering. It leverages IDA Pro and the IDA Domain API to extract pseudocode of functions and perform structured diffing between patched and unpatched binaries.
Features
- Patch Diffing: Compare functions across different binary versions to identify code changes.
- IDA Pro Integration: Uses IDA Pro and the IDA Domain API for accurate pseudocode extraction.
- SQLite Output: Stores results in a SQLite database for easy reuse and analysis.
- Web Interface: Built-in server mode to browse, search, and visualize diff results interactively.
- AutoDiff: Automatically fetches vulnerable and patched binaries (via CVE, file, or month) and runs the diff end-to-end.
- Research-Ready: Designed to support vulnerability research and exploit development workflows.
Usage
[pastacode lang=”markup” manual=”%3E%20diffrays%20–help%0A______%20_%20%20__%20%20________%0A%7C%20%20_%20%20(_)%2F%20_%7C%2F%20_%7C%20___%20%5C%0A%7C%20%7C%20%7C%20%7C_%7C%20%7C_%7C%20%7C_%7C%20%7C_%2F%20%2F__%20_%20_%20%20%20_%20___%0A%7C%20%7C%20%7C%20%7C%20%7C%20%20_%7C%20%20_%7C%20%20%20%20%2F%2F%20_%60%20%7C%20%7C%20%7C%20%2F%20__%7C%0A%7C%20%7C%2F%20%2F%7C%20%7C%20%7C%20%7C%20%7C%20%7C%20%7C%5C%20%5C%20(_%7C%20%7C%20%7C_%7C%20%5C__%20%5C%0A%7C___%2F%20%7C_%7C_%7C%20%7C_%7C%20%5C_%7C%20%5C_%5C__%2C_%7C%5C__%2C%20%7C___%2F%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20__%2F%20%7C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7C___%2F%20%20%20%20%20%20v2.0%20Tau%0A%0Ausage%3A%20diffrays%20%5B-h%5D%20%7Bdiff%2Cserver%2Cautodiff%7D%20…%0A%0ABinary%20Diff%20Analysis%20Tool%20-%20Decompile%2C%20Compare%2C%20and%20Visualize%20Binary%20Changes%0A%0Apositional%20arguments%3A%0A%20%20%7Bdiff%2Cserver%2Cautodiff%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Command%20to%20execute%0A%20%20%20%20diff%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Analyze%20two%20binaries%20and%20generate%20differential%20database%0A%20%20%20%20server%20%20%20%20%20%20%20%20%20%20%20%20%20%20Launch%20web%20server%20to%20view%20diff%20results%0A%20%20%20%20autodiff%20%20%20%20%20%20%20%20%20%20%20%20Auto-download%20binaries%20(via%20CVE%20or%20manual%20input)%20and%20run%20diff%0A%0Aoptions%3A%0A%20%20-h%2C%20–help%20%20%20%20%20%20%20%20%20%20%20%20show%20this%20help%20message%20and%20exit%0A%0AExamples%3A%0A%20%20diffrays%20autodiff%20–cve%20CVE-2025-29824%0A%20%20diffrays%20autodiff%20-f%20clfs.sys%20-m%202025-09%0A%20%20diffrays%20autodiff%20-f%20clfs.sys%20-m%202025-09%20-w%202023-H2%0A%20%20diffrays%20diff%20old_binary.exe%20new_binary.exe%0A%20%20diffrays%20diff%20old.so%20new.so%20-o%20custom_name.sqlite%20–log%0A%20%20diffrays%20server%20–db-path%20result_old_new_20231201.sqlite%20–debug%0A%0AFor%20more%20information%2C%20visit%3A%20https%3A%2F%2Fgithub.com%2Fpwnfuzz%2Fdiffrays” message=”” highlight=”” provider=”manual”/]
AutoDiff – Automatic Binary Collection & Diffing
The autodiff command streamlines patch analysis by automatically fetching binaries (via CVE or manual parameters) and running a diff without manual downloads.
This works only for Windows components, not for other third-party products.
Example 1: Run by CVE
diffrays autodiff –cve CVE-2025-29824
This will:
- Automatically locate vulnerable and patched binaries related to the CVE with the help of Winbindex.
- Run the diff engine.
- Generate a results database.
Example 2: Run by File + Month
diffrays autodiff -f clfs.sys -m 2025-09
This will:
- Download
clfs.sysfrom the September 2025 update. - Locate its prior version and run a diff automatically.
- Provide a fallback when
--cvedoesn’t correctly identify the vulnerable component (which can happen if the CVE affects multiple binaries or metadata is incomplete).
Manual Binary Diffing
- Run Patch Diffing in IDA
python diffrays.py diff old_binary.exe new_binary.exe
- Start the DiffRays Server
python diffrays.py server –db-path diff_results.sqlite
- Open your browser at http://localhost:5555 to view results.
Analyzing Binaries Without Symbols
When diffing binaries that contain no symbols or are stripped, you can enable heuristic matching. With heuristic mode, functions are matched based on code patterns and structural similarity rather than function names.
Note: Heuristic matching does not guarantee 100% accurate function matches, but it generally works well and continues to improve.
python diffrays.py diff old_binary.exe new_binary.exe –heuristic
Install
Support Our Threat Intelligence
If you find our technology report and cybersecurity news helpful, consider supporting our work.