getMessageHash(address reciever)
dependent on MESSAGE_TYPEHASH
which contains a typo that will provide a faulty bytes32 representation, thus causing SnowmanAirdrop::_isValidSignature()
to fail signature validation everytimeDescription:
In SnowmanAirdrop.sol
on line 49 there is the following statement with a typo in "addres":
So when MESSAGE_TYPEHASH
is used in getMessageHash()
as shown below it encodes the misspelling into bytes32, this bytes 32 value is used later to verify the signature, this incorrectly encoded value will not match a valid signature (unless that valid signature was also encoded with the typo intentionally)
getMessageHash()
is called on line 80 of SnowmanAirdrop.sol
as shown below:
The issue is that the keccak256 hash of the misspelled line is not the same as the corrected version of the same line:
These two unencoded statments will result in different encoded bytes32 values:
Meaning that in this instance, the user would not be able to claim their snowman via SnowmanAirdrop::claimSnowman()
Impact:
MESSAGE_TYPEHASH
is required when the call to getMessageHash()
is made on line 80 in SnowmanAirdrop.sol
for the _isValidSignature
check. When the misspelled line (49) is encoded on line 120 in SnowmanAirdrop.sol
it gets encoded with the misspelling into bytes32 format, this bytes32 value is then used to verify the validity of the signature.
Thus the message hash will be generated incorrectly everytime, meaning that no user will be able to claim their snowman.
A comparison of the corrected and misspelled hash are above.
Proof of Concept:
PROCESS:
To compare the Correct and incorrect typehash I made a function isPassing()
which takes the correct and incorrect typehash and identically keccak256 encodes them into a bytes32 representation, this bytes32 representation is then compared in the require()
statement which will throw an error and cancel the request if the two typehash's don't match.
Even if i rebuilt the merkle tree from the provided flakes I would still have a discrepency between any bytes32 values that we're encoded from MESSAGE_TYPEHASH
and those that were encoded from CORRECT_MESSAGE_TYPEHASH
Recommended Mitigation:
Fix the typo in the line below, replace:
A typo in the `MESSAGE_TYPEHASH` variable of the `SnowmanAirdrop` contract will prevent signature verification claims. Used `addres` instead of `address`
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.