The calculateAverage
function in the TimeWeightedAverage library fails to validate that the queried timestamp occurs after the most recent value update (lastUpdateTime
). This allows querying historical averages while incorrectly including future updates in the calculation, corrupting time-weighted average.
The vulnerability stems from the calculateAverage
function including future updates when calculating historical averages. This violates the fundamental principle of time-weighted average calculations which should only consider values known at the query timestamp.
while current protocol implementations are not directly affected due to strict sequential updates, this vulnerability in the library's core logic poses a significant risk for future protocol components or modifications that might rely on historical average calculations, potentially leading to corrupted time-weighted values and economic exploits.
This bug affects contracts that will be using TimeWeightedAverage -calculateAverage function. for example:
FeeCollector - Incorrect reward distributions
GaugeController - Corrupted gauge weights
RAAC/RWA Gauges - Invalid emission calculations
Can add timestamp validation and revert for historical queries
Or enable historical queries by using a snapshot mechanism to Implement historical tracking for legitimate past queries
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.