The LSTRewardsSplitter contract has a vulnerability in the splitRewards function that can cause the transaction to revert when there are a large number of fees configured. From the loop in the _splitRewards function, which iterates over all the fees and transfers the reward amounts. If the total gas consumed by the loop exceeds the gas limit, the transaction will revert, and the reward distribution will fail.
The issue is in the _splitRewards function, which is called by splitRewards. The _splitRewards function iterates over all the fees stored in the fees array and transfers the reward amounts to the respective fee receivers using lst.safeTransfer. If there are a significant number of fees, the loop will execute many iterations, consuming gas for each calculation and token transfer. If the total gas consumed exceeds the gas limit of the transaction, the transaction will revert, and the reward distribution will fail.
LSTRewardsSplitter.sol# https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/core/lstRewardsSplitter/LSTRewardsSplitter.sol#L173-L183
The splitRewards function is called to distribute the rewards among the fee receivers.
Inside the splitRewards function, the _splitRewards function is invoked with the calculated reward amount.
The _splitRewards function contains a loop that iterates over all the fees stored in the fees array.
For each fee, the function calculates the reward amount based on the fee's basis points and transfers the amount to the fee receiver using lst.safeTransfer.
If there are a large number of fees configured, the loop will execute many iterations, and each iteration will consume gas for the calculations and token transfers.
If the total gas consumed by the loop exceeds the gas limit of the transaction, the transaction will revert, and the reward distribution will fail.
This bug affects users because if the splitRewards function fails due to exceeding the gas limit, the rewards will not be distributed to the fee receivers as intended. Users who are expecting to receive their share of the rewards will not receive them.
Vs Code
Instead of processing all fees in a single transaction, break them down into smaller batches that can be processed within the gas limit.
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.