The Airdrop::claim()
function lacks validations to prevent token claiming for users without a Soulbound NFT.
This enables attackers to call the claim
function and obtain tokens as if they had the first minted Soulbound NFT.
Additionally, there is a flaw in the use of the Soulmate::isDivorced
function, where the airdrop contract address is used
instead of the user's address. A divorced user can still claim a Soulbound NFT.
The isDivorced
check will always pass since it sends the msg.sender
of the contract to the function, which consistently returns false for the
Airdrop contract address.
numberOfDaysInCouple
is computed using the timestamp when the NFT was minted, but for the attacker without a minted NFT, it returns the timestamp of the first minted NFT.
An attacker lacking a Soulbound NFT can claim rewards, receiving them as if they have the first minted NFT.
Here's a test demonstrating two separate claims with a 10-day gap between each.
Output
Manual review and Foundry
Revise the Airdrop::claim
function to include a check verifying that the caller possesses a minted Soulbound NFT, and start counting from nextID = 1, so an id of 0 will be used as invalid.
Adjust the Soulmate::isDivorced
function to accurately validate the msg.sender.
Update the isDivorced
function to correctly handle the msg.sender as a parameter.
High severity, This issue is separated from the flawed `isDivorced()` check presented in issue #168 as even if that is fixed, if ownership is not checked, isDivorced would still default to false and allow bypass to claim airdrops by posing as tokenId 0 in turn resulting in this [important check for token claim is bypassed.](https://github.com/Cyfrin/2024-02-soulmate/blob/b3f9227942ffd5c443ce6bccaa980fea0304c38f/src/Airdrop.sol#L61-L66). #220 is the most comprehensive issue as it correctly recognizes both issues existing within the same function.
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.