Closed c4-bot-1 closed 8 months ago
Picodes marked the issue as duplicate of #223
Picodes marked the issue as not a duplicate
Picodes marked the issue as duplicate of #614
This seems to be a dup of #614 although the root cause isn't clearly identified
Picodes changed the severity to 3 (High Risk)
Picodes marked the issue as not a duplicate
Picodes marked the issue as duplicate of #1021
Picodes changed the severity to 2 (Med Risk)
Picodes marked the issue as partial-50
Lines of code
https://github.com/code-423n4/2024-01-salty/blob/main/src/staking/StakingRewards.sol#L81
Vulnerability details
Impact
When calculating the virtual rewards and the total rewards when increasing shares in
StakeRewards
, the calculaculation rounds up:That could be thought to be in favour of the protocol, however, it can account rewards that are not actually inside the contract. As a result, someone can claim rewards that are basically discounted form other staker balances.
Check the Proof of concept
Proof of Concept
Setup:
Proof of Concept:
Output traces:
Tools Used
Manual review
Recommended Mitigation Steps
This attack is basically possible because the reward calculation rounds up and because it is possible to add SALT rewards without access control. From my point of view changing the reward calculation may lead to some other bugs so the best option would be adding access control to the
addSALTRewards
function. That way this function would be only callable by the Upkeep and would only provide a certain number of rewards periodically.Assessed type
Math