Binary Diffing and Symbolic Execution: Matching Functions and Solving for Inputs
A match between two functions is a claim made by one signature with one quality, and a solved input is one model of one path condition; this lesson builds both and checks them against radiff2, Ghidra, angr, and z3.
150 minutesBuildPython, C, x86-64 assembly, Java (one Ghidra script)Members
Learning Objectives
- Build five function signatures from an object and its listing: exact bytes, bytes with relocation fields masked, mnemonic sequence, flow-graph shape, and symbol name.
- Run a staged greedy matcher in the BinDiff style, where a signature matches only when it is unique on both sides, and record the stage and quality behind every match.
- Reproduce the case where two byte-identical functions fail a byte correlator on loaded images and pass it after masking, with the relocation arithmetic that explains the four changed bytes.
- Reproduce radiff2's similarity ratios from the Levenshtein distance and explain why one ratio only appears when the comparison uses the 82 bytes radare2 reached.
- Enumerate the paths of a function over a small IR, carry a condition per path, and solve each leaf for inputs with a bounded search.
- Measure path explosion on a loop with a symbolic bound and compare the counts, classes, and models with angr 10.0.3 and z3 5.1.0.