Cave Finder is a command line tool that searches for code caves in a PE file (EXE, DLL or driver). A code cave is a run of null bytes (0x0) inside a section, with enough space you can write a shellcode.
It reads the file without loading it, and every access is checked against the file size, so a malformed PE file produces an error message instead of a crash. The same code base handles x86 and x64 files.
Demo.mp4
Scan
- Every section of the PE file is scanned for caves of a minimum size
- Works on x86 and x64 files
Report
- Section where the cave resides and size of the cave
- Start / End file offset of the cave
- Start / End virtual address of the cave
- Permissions on the cave (
EXECUTE | READ | WRITE)
miner.exe <pe_file> <cave_size> [--pause]
<cave_size>is the minimum size of the caves to report, in bytes--pausewaits for a key press before exiting
Note Example:
miner.exe miner.exe 16scans the tool itself for caves of at least 16 bytes.
The program returns 0 on success and -1 if the arguments are invalid, or if the file cannot be read or is not a valid PE file.
- Open
Code Cave Miner.slnin Visual Studio (C++17). - Build in Release (x86 or x64).
- Output: every configuration is already set up, the executable is named
miner.exe - Architecture: the x86 build can parse x86 and x64 PE files, and so can the x64 build
- CMake: a
CMakeLists.txtis provided for other IDEs,cmake -S . -B buildthencmake --build build --config Release
This project is licensed under the GNU GPLv3.