Incorrect Handling of Negative newReward
The LSTRewardsSplitter::performUpkeep
function handles the splitting of rewards between fee receivers.
From the code block above , if the newRewards
is negative , current logic tries to cast it to uint256
after multiplying by -1
. However, casting negative integers to uint256
does not make sense, and underflow can occur.
uint256
type cannot represent negative values. If a negativeint256
is cast touint256
, it will become a large positive number (since uint256
wraps around). This can lead to incorrect and dangerous behavior.
Incorrect Handling of newReward
comparison
If newRewards
is negative, casting it to uint256
here can create an extremely large positive number due to underflow, leading to an incorrect comparison with the rewardThreshold
. This would result in unintended behavior.
Manual Review
Incorrect Handling of Negative newReward
Before trying to cast, check whether the rewards are negative and handle the principal update differently to avoid underflows or incorrect conversions.
Incorrect Handling of newReward
comparison
compare the rewards before casting them to uint256
. If they are negative, don't proceed with the rewards comparison and handle it as a special case (e.g., reverting or reducing principal).
Suggested Fix
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.