A user can use Staking::claimRewards()
without having to lock tokens in the staking contract.
The staking contract is supposed to distribute tokens to users that lock tokens at a rate of 1 token rewarded per 1 token staked during 1 week. However, no checks are performed when staking in Staking::deposit()
regarding the time at which staking began. Therefore users can deposit and claim rewards without having to lock the tokens in the contract.
After minting NFT users, start accruing rewards without depositing, they can then call Staking::deposit()
to deposit tokens, and immediately after call Staking::claimRewards()
to claim rewards corresponding to the period since they minted the NFT, and withdraw tokens immediately after. This process can be repeated for subsequential claimRewards
, users can deposit immediately before claiming rewards and then withdraw.
Users can claim rewards of staking without having to lock tokens in the contract severely breaking the protocol and opening up to several exploits such as using a flashloan to acquire big amounts of Love Token
deposit in the staking contract call claimRewards()
, and withdraw the tokens.
Foundry
This issue can be mitigated by making it so that when users deposit tokens the Staking::lastClaim
mapping is also updated.
However, this makes it so that any pending rewards for the user are lost, so we can create an internal _claimRewards()
function to remove any pending rewards.
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.