Closed c4-bot-5 closed 8 months ago
othernet-global (sponsor) disputed
Final claimAllRewards is not reverting as mentioned.
Picodes marked the issue as unsatisfactory: Insufficient proof
Picodes removed the grade
Picodes marked the issue as duplicate of #1021
Picodes marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L81 https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L114-L118 https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L243
Vulnerability details
Impact
Occasionally, the claiming of rewards may be reversed due to rounding.
Proof of Concept
For the sake of this discussion, let's assume that the price of
DAI
is equal to that ofETH
.Alice
initiates a deposit of(10100, 10100)
into theWETH/DAI
pool.20,000
SALT
rewards for this pool. This is solely for testing purposes. Actual rewards are emitted from theRewardsEmitter
. The result isBob
deposits the same liquidity into theWETH/DAI
pool. He cannot receive any rewards, but his virtual rewards have increased.Log is
Charlie
deposits(19800, 19800)
into theWETH/DAI
pool.Bob
withdraws20,000
liquidity. In this case,Bob
can receive1 wei
due to rounding.Alice
aims to claim her reward, but the transaction will revert due to an exact lack of1 wei
in the balance.The PoC for this is as below:
Tools Used
Recommended Mitigation Steps
If the rewards exceed the balance, we can send the entire available balance.
Assessed type
Token-Transfer