|
1 | | -# New Main Branch |
| 1 | +<p align='center'> |
| 2 | +<img src="" width=60% > |
| 3 | +</p> |
| 4 | + |
| 5 | +<!-- |
| 6 | +<img align="center" src="https://img.shields.io/github/stars/pwnfuzz/DiffRays?style=for-the-badge"> |
| 7 | +<img align="center" src="https://img.shields.io/github/forks/pwnfuzz/DiffRays?style=for-the-badge"> |
| 8 | +--> |
| 9 | + |
| 10 | +# DiffRays - IDA Pro Binary Diffing Engine |
| 11 | + |
| 12 | +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. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## ✨ Features |
| 17 | + |
| 18 | +- 🔎 **Patch Diffing**: Compare functions across different binary versions to identify code changes. |
| 19 | +- 🧩 **IDA Pro Integration**: Uses IDA Pro and the IDA Domain API for accurate pseudocode extraction. |
| 20 | +- 📂 **SQLite Output**: Stores diff results in a SQLite database for easy reuse and analysis. |
| 21 | +- 🌐 **Web Interface**: Built-in server mode to browse, search, and visualize diff results interactively. |
| 22 | +- 📊 **Research-Ready**: Designed to support vulnerability research and exploit development workflows. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## 🛠️ Requirements |
| 27 | + |
| 28 | +- [IDA Pro Version](https://hex-rays.com/ida-pro/) |
| 29 | + - The IDA Domain library requires IDA Pro 9.1.0 or later. |
| 30 | +- [IDA Domain API](https://github.com/HexRaysSA/ida-domain) |
| 31 | +- Python 3.8+ |
| 32 | +- Additional Python dependencies |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## ⚙️ Setup |
| 37 | + |
| 38 | +1. **Clone the repository** |
| 39 | + ```bash |
| 40 | + git clone https://github.com/pwnfuzz/diffrays |
| 41 | + cd diffrays |
| 42 | + ``` |
| 43 | + |
| 44 | +2. **Install dependencies** |
| 45 | + ```bash |
| 46 | + pip install . |
| 47 | + ``` |
| 48 | + |
| 49 | +3. **Setup IDADIR environment variable to point to your IDA installation directory:** |
| 50 | + |
| 51 | + ```bash |
| 52 | + Windows: |
| 53 | + set IDADIR="[IDA Installation Directory]" |
| 54 | + |
| 55 | + Linux: |
| 56 | + export IDADIR="[IDA Installation Directory]" |
| 57 | + ``` |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## 🚀 Usage |
| 62 | + |
| 63 | +Command-Line Help |
| 64 | + |
| 65 | +```bash |
| 66 | +> diffrays --help |
| 67 | + |
| 68 | +______ _ __ ________ |
| 69 | +| _ (_)/ _|/ _| ___ \ |
| 70 | +| | | |_| |_| |_| |_/ /__ _ _ _ ___ |
| 71 | +| | | | | _| _| // _` | | | / __| |
| 72 | +| |/ /| | | | | | |\ \ (_| | |_| \__ \ |
| 73 | +|___/ |_|_| |_| \_| \_\__,_|\__, |___/ |
| 74 | + __/ | |
| 75 | + |___/ v1.0 Kappa |
| 76 | + |
| 77 | +usage: diffrays [-h] {diff,server} ... |
| 78 | + |
| 79 | +Binary Diff Analysis Tool - Decompile, Compare, and Visualize Binary Changes |
| 80 | + |
| 81 | +positional arguments: |
| 82 | + {diff,server} Command to execute |
| 83 | + diff Analyze two binaries and generate differential database |
| 84 | + server Launch web server to view diff results |
| 85 | + |
| 86 | +options: |
| 87 | + -h, --help show this help message and exit |
| 88 | + |
| 89 | +Examples: |
| 90 | + diffrays diff old_binary.exe new_binary.exe |
| 91 | + diffrays diff old.so new.so -o custom_name.sqlite --log |
| 92 | + diffrays server --db-path result_old_new_20231201.sqlite --debug |
| 93 | + |
| 94 | +For more information, visit: https://github.com/pwnfuzz/diffrays |
| 95 | + |
| 96 | +``` |
| 97 | + |
| 98 | +1. **Run Patch Diffing in IDA** |
| 99 | + |
| 100 | +Load your binaries in IDA and run DiffRays to generate diff results: |
| 101 | +```bash |
| 102 | +python diffrays.py diff <path_to_old_binary> <path_to_new_binary> |
| 103 | +``` |
| 104 | + |
| 105 | +2. **Start the DiffRays Server** |
| 106 | + |
| 107 | +Once you have a .sqlite file, launch the web interface to explore the diffs: |
| 108 | +```bash |
| 109 | +python diffrays.py server --db-path diff_results.sqlite |
| 110 | +``` |
| 111 | +Open your browser at http://localhost:5555 to view results. |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 🔬 Example Workflow - Diffing CVE-2025-29824 |
| 116 | + |
| 117 | +1. **Collect target binaries** |
| 118 | + - CVE-2025-1246 affects the **Common Log File System driver (`Clfs.sys`)**. |
| 119 | + - Download the two versions of the driver from Microsoft’s update packages (via WinBIndex or your preferred source): |
| 120 | + - Vulnerable build: **Clfs.sys 10.0.22621.5037** → [download here](https://msdl.microsoft.com/download/symbols/clfs.sys/4A2750956f000/clfs.sys) |
| 121 | + - Patched build: **Clfs.sys 10.0.22621.5189** → [download here](https://msdl.microsoft.com/download/symbols/clfs.sys/68C175656f000/clfs.sys) |
| 122 | + - Save them into a working directory: |
| 123 | + ```bash |
| 124 | + curl -L -o clfs_10.0.22621.5037.sys https://msdl.microsoft.com/download/symbols/clfs.sys/4A2750956f000/clfs.sys |
| 125 | + curl -L -o clfs_10.0.22621.5189.sys https://msdl.microsoft.com/download/symbols/clfs.sys/68C175656f000/clfs.sys |
| 126 | + ``` |
| 127 | + |
| 128 | +2. **Run DiffRays** |
| 129 | + ```bash |
| 130 | + python diffrays.py diff clfs_10.0.22621.5037.sys clfs_10.0.22621.5189.sys |
| 131 | + ``` |
| 132 | + |
| 133 | +3. **Start the web server** |
| 134 | + ```bash |
| 135 | + python diffrays.py server --db-path clfs_diff.sqlite |
| 136 | + ``` |
| 137 | + |
| 138 | +4. **Browse interactively** |
| 139 | +Open http://127.0.0.1:5555 |
| 140 | + |
| 141 | +<IMG>ADD HERE</IMG> |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## 📖 Use Cases |
| 146 | + |
| 147 | +- Researching Microsoft Patch Tuesday vulnerabilities |
| 148 | +- Identifying security fixes introduced in new software versions |
| 149 | +- Supporting exploit development by analyzing patched vs. unpatched code paths |
| 150 | +- Reverse engineering software updates |
| 151 | + |
| 152 | +--- |
| 153 | + |
| 154 | +## 💡 Inspired By |
| 155 | + |
| 156 | +DiffRays takes inspiration from prior research and tools in the binary diffing space, including: |
| 157 | + |
| 158 | +- [BinDiff](https://github.com/google/bindiff) - Quickly find differences and similarities in disassembled code. |
| 159 | +- [Diaphora](https://github.com/joxeankoret/diaphoraDiaphora) - Diaphora, the most advanced Free and Open Source program diffing tool. |
| 160 | +- [Ghidriff](https://github.com/clearbluejar/ghidriff) - Python Command-Line Ghidra Binary Diffing Engine |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## ⚠️ Disclaimer |
| 165 | + |
| 166 | +This project is intended for educational and research purposes only. |
| 167 | +The author does not condone or encourage malicious use of this tool. |
| 168 | + |
| 169 | +--- |
| 170 | + |
| 171 | +## 📜 License |
| 172 | + |
| 173 | +This project is licensed under the MIT License - see the [LICENSE](https://github.com/pwnfuzz/DiffRays/blob/main/LICENSE) file for details. |
0 commit comments