The claim
function in the Airdrop.sol
contract do not check if the caller has a soulmate NFT, therefore anyone who isn't divorced can claim love tokens. Worst they can claim very large amount of tokens from the protocol, making them insanely rich with love.
Only soulmates should be able to claim airdrop, but there is no checks for soulmate NFT in the Airdrop.sol
claim
function.
This function only checks for the divorce status of the caller, and initially the divorce status will be false, so any user who isn't divorced can claim LoveToken,
soulmateContract.isDivorced()
will return false, if the caller is not divorced and a caller without soulmate is not divorced.
Addresses without Soulmate NFT are able to claim more LoveToken, than Addresses with Soulmate NFT, the numberOfDaysInCouple
is used to calculate the amount of token to send to the caller, for a caller with a Soulmate NFT
it start counting from the day the NFT was minted to the day he is calling the claim
function.
But for callers without Soulmate NFT, it start counting from January 1st, 1970, to the day the claim
function is being called, which is about 54years, so callers without Soulmate NFTs get to collect over 54 years of LoveTokens.
From the above test any random user can mint LoveToken as long as they are not divorced.
Add the test below to AirdropTest.t.sol
and use the command below to run the code
Unauthorized addresses can claim LoveToken from Airdrop.sol
contract, and the worst part of it is that, they can claim over 54years of LoveToken, making them extremely rich with love.
Manual Analysis and Foundry
Add checks to comfirm if the caller, has a Soulmate NFT.
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.