Airdrop.sol::claim() Because there's no check on whether the caller has a soulmate, it results in an incorrect calculation of the reunion duration, draining all tokens
Due to the lack of a check on whether the caller has a soulmate, and because a caller without a soulmate has idToCreationTimestamp
as 0, the calculation on line 56 of the code for 'How long soulmates are reunited' results in an error, which is the current block.timestamp
divided by daysInSecond
. This creates an attack vector for draining the entire vault of love tokens.
Add this test to SoulmateTest.t.sol and run forge test --match-test test_DistortFirstCoupleMessage -vvvv
the issue
From logs output, it can be seen that the attacker has obtained 1707725828 / 86400
(current block.timestamp / daysInSecond) tokens
attack vector for draining the entire vault of love tokens
manual review
Add an error at line 16 in Airdrop.sol
Add a conditional check in the claim
function to revert if there is no Soulmate call
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.