The Airdrop contract in the current LoveToken ecosystem is designed to allow holders of Soulmate NFTs to claim LoveTokens on a daily basis, underpinning a unique engagement model that rewards sustained relationships. However, the absence of an explicit ownership check for Soulmate NFTs within the claim
function permits any address to trigger the airdrop claim process, potentially leading to unauthorized LoveToken acquisition.
The core issue resides in the claim
function, which lacks a crucial verification step to ensure that the caller is indeed the owner of a Soulmate NFT. The function soulmateContract.isDivorced()
is invoked to check the divorce status of a couple but fails to ascertain if the caller possesses a Soulmate NFT. This oversight allows any user to execute the claim
function, disregarding the intended restriction that only Soulmate NFT owners are eligible for the daily LoveToken airdrop.
This vulnerability could lead to several adverse outcomes, including but not limited to:
Dilution of LoveToken value due to unauthorized claim and distribution.
Erosion of trust among legitimate NFT holders regarding the exclusivity and benefits of holding Soulmate NFTs.
Potential depletion of the LoveToken reserves allocated for the airdrop, denying rightful claims by actual NFT owners.
Manual code review.
To mitigate this vulnerability and prevent unauthorized LoveToken claims, implement an ownership verification step within the claim
function. This can be achieved by adding a check to confirm that the caller owns a Soulmate NFT before proceeding with the claim process. Also, minting ids should start from 1, Here's an enhanced version of the critical part of the claim
function:
It's important to ensure that the ownerToId
function in the ISoulmate
contract accurately reflects ownership of Soulmate NFTs, returning a non-zero identifier only for legitimate owners. This modification introduces an additional gas cost for the ownership check but significantly enhances the security and integrity of the airdrop mechanism.
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.