The staking protocol intends to provide 1 token per staking token per week. However, a vulnerability was found where a user could claim the reward right after staking, provided that the user never claimed the reward previously and at least one week has passed since the user's Soulmate NFT token was created.
The fundamental cause of this is related to the highlighted code in Staking::claimRewards
below. Instead of using the actual stake deposit time, it uses the NFT creation time as the staked time if the user never claimed the rewards.
This leads to a vulnerability where a user could receive the stake reward even without staking for the minimum duration of one week. The PoC shown below can be added to StakingTest.t.sol
to demonstrate this issue.
The overall flow of this PoC is summarized below:
A user is assigned to a soulmate and mints a Soulmate NFT.
The user claims LoveToken airdrops after a few weeks (e.g., 5 weeks in this example).
The user stakes the LoveTokens and claims the stake rewards without having to wait at least a week, which is the minimum required staking time.
The user gets the reward based on the Soulmate NFT creation timestamp.
The impact of this vulnerability is HIGH because the protocol does not work as intended. Literally, a user can get the stake reward without having to stake for the required duration.
Foundry
When a user calls Staking::claimRewards
, use the actual stake deposit time to calculate the stake reward.
High severity, this allows users to claim additional rewards without committing to intended weekly staking period via multi-deposit/deposit right before claiming rewards.
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.