The signature verification functions in LibMuon use abi.encodePacked without type prefixes, allowing different data structures to produce the same hash. An attacker could reuse a valid signature from one function as a signature for another, potentially bypassing checks and using illegal values.
In LibMuon , all signatures do not distinguish between type prefixes, and abi.encodePacked is used when calculating the hash
Cause when abi.encodePacked, if there is a dynamic array, different structures but the same hash value may be obtained
Due to conflicting hash values, signatures can be substituted for each other, making malicious use of illegal signatures possible
$ forge test -vvv
Running 1 test for test/Counter.t.sol:CounterTest
[PASS] test() (gas: 4991)
Logs:
verifyPrices == verifyPartyAUpnlAndPrice: true
Test result: ok. 1 passed; 0 failed; finished in 11.27ms
From the above test example, we can see that the verifyPrices and verifyPartyAUpnlAndPrice signatures can be used interchangeably
If we get a legal verifyPartyAUpnlAndPrice , it can be used as the signature of verifyPrices ()
Use partyANonces as upnl, etc
Impact
Signatures can be reused due to hash collisions, through illegal signatures, using illegal unpl, etc
This issue and duplicate are invalid:
These issues suggest that a collision is possible between hashes being used in verifyPrices and verifyPartyAUpnlAndPrice.
The original report as published on Sherlock, by bin2chen. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely the use of abi.encodePacked without type prefixes or separators allows different data structures to produce identical hashes.
Impact
Signatures could be reused across functions due to hash collisions, allowing an attacker to use illegal signatures and manipulate values such as upnl.
What the attacker needed
A valid signature for one function
The fix
The code was fixed by adding a type prefix to the hash input or using abi.encode instead of abi.encodePacked.
How it was found
Obtain a valid signature for verifyPartyAUpnlAndPrice.
Use that signature as if it were for verifyPrices, because the hashes collide.
The contract accepts the signature and processes the call with manipulated values.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
When a program checks a digital signature, it creates a hash of the data. If two different sets of data produce the same hash, a signature for one set can be used for the other. Here, the code did not clearly separate different types of data before hashing, so a signature meant for one function could be accepted by another.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.