Closed c4-bot-8 closed 8 months ago
Picodes marked the issue as primary issue
othernet-global (sponsor) disputed
This is acceptable. Users can claim all the rewards they are entitled to after depositing liquidity.
Invalidating as this is by design
Picodes marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L166-L167
Vulnerability details
Impact
A depositor can deposit a low amount into pool and claim all rewards immediately by avoiding the
cooldownExpiration
.Proof of Concept
The exploit is done in
claimAllRewards()
becuase this method has no cool down like_decreaseUserShare()
, it transfers the rewards directly to the claimer without checkinguser.cooldownExpiration
like in_decreaseUserShare()
function.In claimAllRewards() a direct transfer is made:
but in _decreaseUserShare() there is a cool down expiration check:
Alice Attack Scenario 1- The protocol will Add SALT rewards let's say a value of 10000000000000000000 SALT (10 ether) = 10e18. 2- Alice will deposit 0.000000001 ether, 0.000000001 ether for token A and B which is 1000000000 = 1e9. 3- Alice will claim all rewards immediately after her previous deposit by calling
claimAllRewards()
because there is no Cool down time to hold her claim. 4- Bob and Charile will deposit different amounts of Token A,B after Alice but will not gain any rewards since all rewards already been out of the pool (check POC)POC - foundry:
To Run The Test:
Code: (add this code as filename.t.sol under "./src/staking/tests" folder)
Tools Used
Manual Review VS + Foundry
Recommended Mitigation Steps
claimAllRewards()
just like_decreaseUserShare()
Assessed type
Other