AuctionBurnReserveSkew.getPegDeltaFrequency() Wrong implementation can result in an improper amount of excess Liquidity Extension balance to be used at the end of an auction
The function getPegDeltaFrequency() divides by auctionAverageLookback even when fewer observations exist, producing a smaller value than intended. This inaccurate result feeds into the burn budget calculation, potentially causing an improper amount of excess Liquidity Extension balance to be used and even depleted to zero.
Submitted by WatchPug
function getPegDeltaFrequency() public view returns (uint256) {
uint256 initialIndex = 0;
uint256 index;
if (count > auctionAverageLookback) {
initialIndex = count - auctionAverageLookback;
}
uint256 total = 0;
for (uint256 i = initialIndex; i < count; ++i) {
index = _getIndexOfObservation(i);
total = total + pegObservations[index];
}
return total * 10000 / auctionAverageLookback;
}
When count < auctionAverageLookback, at L131, it should be return total * 10000 / count;. The current implementation will return a smaller value than expected.
The result of getPegDeltaFrequency() will be used for calculating realBurnBudget for auctions. With the result of getPegDeltaFrequency() being inaccurate, can result in an improper amount of excess Liquidity Extension balance to be used at the end of an auction.
0xScotch (sponsor) confirmed and disagreed with severity:
I actually think this should be higher severity. This bug could manifest in liquidity extension being depleted to zero which could have catastrophic consequences downstream.
Alex the Entreprenerd (judge) commented:
Agree with the finding, this is an incorrect logic in the protocol, which can limit it’s functionality and as the sponsor says:
could have catastrophic consequences downstreamas such I’ll increase the severity to high.Mitigation seems to be straightforward
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
Root cause
The function always divides by auctionAverageLookback instead of the actual number of observations when count is less than auctionAverageLookback.
Impact
The incorrect value could cause an improper amount of excess Liquidity Extension balance to be used, potentially depleting it to zero with catastrophic downstream consequences.
What the attacker needed
Count < auctionAverageLookback
The fix
The function should divide by count instead of auctionAverageLookback when count is less than auctionAverageLookback.
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 a function calculates an average but divides by the wrong number when there are not enough data points. That makes the average too small, which then causes the auction to use too much of a reserve fund, possibly emptying it.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.