Attackers could drain rewards meant for other transcoders.
The key vulnerable code is in the reward() function:<https://github.com/code-423n4/2023-08-livepeer/blob/a3d801fa4690119b6f96aeb5508e58d752bda5bc/contracts/bonding/BondingManager.sol#L881-L882>
This uses the transcoder’s total stake (earningsPool.totalStake) and the total active stake (currentRoundTotalActiveStake) to determine the transcoder’s portion of the rewards.
An attacker who is a transcoder could temporarily increase their stake before calling reward() by bonding more tokens or transferring bonds from another account they control. This would increase earningsPool.totalStake and get them a larger portion of the totalRewardTokens.
Then in updateTranscoderWithRewards(), the attacker’s cumulative rewards are increased by the full amount of _rewards: t.cumulativeRewards = t.cumulativeRewards.add(transcoderRewardStakeRewards).add(transcoderCommissionRewards);
After claiming the rewards, the attacker could decrease their stake back to the original amount. This would allow them to unfairly claim a larger portion of rewards than they should based on their true stake
Manual
A snapshot of the total active stake should be taken before reward() is called, and that snapshot value should be used in the reward calculation instead of currentRoundTotalActiveStake.
Other
The text was updated successfully, but these errors were encountered:
All reactions