2.6 KiB
2.6 KiB
PatchDiffEngine (Binary Pre/Post Patch Comparison for Fix Verification)
Module
BinaryIndex
Status
IMPLEMENTED
Description
Compares pre-patch and post-patch binaries at multiple levels (BasicBlock, CFG, StringRefs, Semantic/KSG fingerprints) to determine if a vulnerability has been remediated. Produces structured verification results with confidence scores based on match depth. Core verification logic for the Golden Set Diff Layer.
Implementation Details
- Modules:
src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Diff/,src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Builders/ - Key Classes:
PatchDiffEngine(src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Diff/PatchDiffEngine.cs) - core engine comparing pre/post binaries usingISignatureMatcher,IFunctionFingerprintExtractor, andIFunctionDiffer; producesPatchDiffResultwith confidence scoresPatchDiffEngine(builders) (src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Builders/PatchDiffEngine.cs) - builder-level diff engineFunctionDiffer(src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Diff/FunctionDiffer.cs) - function-level comparison with semantic analysis, call-graph edge diffing, and string reference comparisonFunctionRenameDetector(src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Diff/FunctionRenameDetector.cs) - detects renamed functions between versionsVerdictCalculator(src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Diff/VerdictCalculator.cs) - computes fix verification verdict from diff results
- Models:
PatchDiffResult,PatchDiffModels,DiffEvidenceModels,DiffOptions(src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Diff/Models/) - Storage:
IDiffResultStore,InMemoryDiffResultStore(src/BinaryIndex/__Libraries/StellaOps.BinaryIndex.Diff/Storage/) - Source: SPRINT_20260110_012_004_BINDEX_golden_set_diff_verify.md
E2E Test Plan
- Submit pre-patch and post-patch binaries for a known CVE fix and verify the diff result shows patch applied
- Verify multi-level comparison: BasicBlock, CFG, StringRefs, and semantic fingerprints all contribute to confidence
- Verify
FunctionDifferwithIncludeSemanticAnalysis=truecomputes semantic similarity - Verify
FunctionRenameDetectorhandles renamed functions between versions - Verify
VerdictCalculatorproduces correct verdict (Fixed, Vulnerable, Unknown) based on diff evidence - Verify
NoPatchDetectedresult is returned when binaries are identical - Verify diff results are persistable via
IDiffResultStorewith content-addressed IDs