Amount distributed can be inaccurate when updating weights
When pool weights are updated, only the changed pool is checkpointed, so other pools use an outdated total weight for the entire period since their last checkpoint, leading to incorrect token distribution. This can cause users to lose part of their claims or too many tokens to be distributed, preventing some from claiming.
Submitted by Picodes
Impact
When updating pool inflation rates, other pools see their currentRate being modified without having poolCheckpoint called, which leads to false computations.
This will lead to either users losing a part of their claims, but can also lead to too many tokens could be distributed, preventing some users from claiming due to the totalAvailableToNow requirement in Minter.
Proof of Concept
Imagine you have 2 AMM pools A and B, both with an ammPoolWeight of 100, where poolCheckpoint has not been called for a moment. Then, imagine calling executeAmmTokenWeight to reduce the weight of A to 0.
Only A is checkpointed here, so when B will be checkpointed it will call getAmmRateForToken, which will see a pool weight of 100 and a total weight of 100 over the whole period since the last checkpoint of B, which is false, therefore it will distribute too many tokens. This is critical has the minter expects an exact or lower than expected distribution due to the requirement of totalAvailableToNow.
In the opposite direction, when increasing weights, it will lead to less tokens being distributed in some pools than planned, leading to a loss for users.
Mitigation Steps
Checkpoint every LpStakerVault, KeeperGauge or AmmGauge when updating the weights of one of them.
chase-manning (Backd) confirmed, but disagreed with severity and commented:
We think this should be Medium as impact is quite minor.
Alex the Entreprenerd (judge) decreased severity to Medium and commented:
Because
getAmmRateForTokenuses thetotalAmmTokenWeight, then all Gauges will need to bepoolCheckpointed at the time the weight is changed-This is because for systems that accrue points over time, any time the multiplier changes, the growth of points has changed, and as such a new accrual needs to be performed.
I believe there are 3 ways to judge this finding:
- It’s Medium as the Admin is using their privilege to change the points, potentially to their favour or to someones detriment.
- It’s High because the math is wrong and the code fails (by a way of lack of approximation) to properly allocate the resources.
- It’s Medium because while the finding is correct in a vacuum, anyone can call
poolCheckpoint, as such if a true concern for fairness is made, anyone can front-run and back-run the update of weights with the goal of offering the most accurate math possible.Given those considerations, I want to emphasize that not calling
poolCheckpointcan cause potentially drastic leaks of value, in a way similar to the original Sushi MasterChef’s lack ofmassUpdatePoolscould.That said, I believe the finding is of medium severity as any individual could setup a bot to monitor and prevent this and it would require the weights to be changed by governance and impact can be quite minor as long as the pools are used.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
This could cause users to lose part of their claims or lead to too many tokens being distributed, preventing some users from claiming due to the totalAvailableToNow requirement; the judge noted the impact is minor as long as pools are used and anyone can call poolCheckpoint to mitigate.
What the attacker needed
Governance changes pool weights; pools not recently checkpointed
The fix
Checkpoint every LpStakerVault, KeeperGauge or AmmGauge when updating the weights of one of them.
How it was found
- Have two AMM pools A and B with equal weights and no recent checkpoints.
- Call executeAmmTokenWeight to reduce the weight of pool A to zero.
- Only pool A is checkpointed; pool B remains unchecked.
- Later, when pool B is checkpointed, it uses the old total weight for the entire period, distributing too many tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a smart contract bug where changing one pool's weight affects how rewards are calculated for other pools. Because the system doesn't update the reward calculation for all pools at the same time, some pools get too many or too few tokens. Users might lose rewards or be unable to claim them.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.