The reward system is dependent on the userStakes[msg.sender]
value, there is no check within the smart contract to record when these funds were deposited.
so a user can deposit 1 LoveToken for a week and just before they claimReward
, they can increase their stake to 5 LoveToken, so they claim 6 LoveToken instead of 1.
This is because the amountToClaim
is dependent on the current userStakes[msg.sender]
which can be updated anytime
The malicious user can also leverage Flashloans, by pulling a large amount of LoveTokens from lending contracts to cheat the protocol,
A malicious user can stake 1 LoveToken for a week, just before they claimReward
they can borrow large amounts of tokens from a lending protocol (e.g 10000 LoveTokens), and claim 10001 LoveTokens instead of 1 LoveTokens, They will do all these in a single Transaction.
##Proof of concept
Staking pool has 1M LoveTokens
A malicious user Bob has one LoveToken
Bob stake for 1 week
But before Bob claims his rewards he writes a malicious code to flashloan of 1M LoveToken
In one Transaction Bob borrows 1M LoveToken, deposit
1M LoveToken, and claimReward
of 1M LoveToken From the protocol
The protocol Balance is now 0, and Bob made 1M from 1 LokenToken stake.
The protocol will lose a lot of funds and potentially drain the whole funds in the staking contract.
Manual Analysis
Prevent users who have already deposited from redepositing again i.e if userStakes[msg.sender]
> 0 the deposit
should revert
User should not be able to deposit and Claim Reward in the same transaction
StakingPositions Should be Implemented has ERC721, which has the amount of funds staked, the lastClaimed
Time
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.