sigcache: prevent rangeproof cache key boundary collisions - #1603
Closed
HarshRajSinghania wants to merge 1 commit into
Closed
sigcache: prevent rangeproof cache key boundary collisions#1603HarshRajSinghania wants to merge 1 commit into
HarshRajSinghania wants to merge 1 commit into
Conversation
Member
|
Thanks - already been resolved in #1600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ComputeEntryRangeProofonmasterhashesproof || commitment || asset_commitment || scriptPubKeywithout field delimiters. BecauseproofandscriptPubKeyare variable-length fields at opposite ends of the stream, distinct argument tuples can produce the same hashed byte sequence. A positive cache hit bypasses rangeproof verification.This PR length-prefixes the four fields before hashing and adds a regression test for the proof/script boundary case. The test primes the cache with a valid proof and then verifies that a re-split, invalid tuple does not hit the same cache entry.
The current
masterimplementation was verified atc7e856fab1b0c4d37005e25c0940184d812a26a0before this change.This is the master-branch counterpart of the already-public cache-key hardening work in #1600/#1601; those changes landed on
elements-23.3.x, while this report specifically identified the same raw-concatenation construction onmaster.Testing
rangeproof_cache_key_field_boundaryregression coverage insrc/test/blind_tests.cpp.