Firstly, the Airdrop::claim
function possesses a public visibility specifier
. Given that the function isn't invoked from any other dependent contract, it ought to have an external visibility specifier
.
The concerning aspect of the Airdrop::claim
function is its allowance for anyone to claim One Love Token Per Day
, irrespective of their relationship status. This behavior is severely detrimental and deviates from the protocol's intended functionality.
Please expand to see details
by clicking on it.
Place the following test code snippet into the test/unit/soulmateTest.t.sol
file. Put it at the very bottom but before the last closing semicolon }
.
Open Your Bash Terminal
and execute the following command...
Some output might appear upon executing the above command. Take a look at that output.
Now it's clear that anyone no matter of their relationship status, they can claim One Love Token Per Day
.
Individuals with knowledge of this vulnerability can exploit it to steal One Love Token
per day. They may be willing to wait for a day to claim tokens, even without having a soulmate. This vulnerability compromises the entire functionality of the Protocol, facilitates fund theft, and undermines the integrity of the Protocol.
Foundry Framework (Solidity, Rust)
Mitigation is simple, We can employ an if check
to check whether a person has a soulmate.
Update src/Airdrop.sol
file like below...
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.