The FeeConversionKeeper contract's checkUpkeep
function is vulnerable to a Denial of Service (DoS) attack due to unbounded iteration over markets and their associated fees. An attacker could create multiple markets with small fees just above the minimum threshold, causing the function to consume excessive gas and potentially making the keeper operations unfeasible.
The vulnerability exists in the checkUpkeep
function where there's no limit on the number of markets and fees that can be processed:
The root cause is:
No limit on the number of markets that can be processed
No batch size restriction for fee processing
Nested loops that can lead to quadratic complexity
Array initialization with potentially large sizes (liveMarketIds.length * 10
)
The vulnerability could lead to:
Failed keeper operations due to excessive gas consumption
Delayed or stuck fee conversions
System becoming unusable as the number of markets and small fees grows
Potential DoS of the entire fee conversion mechanism
Test Results:
Manual code review
Implement a maximum batch size for processing:
Add pagination support:
Implement minimum thresholds per asset to prevent spam with small amounts
Add a maximum limit on the number of assets per market
Consider implementing a queue system for fee processing to ensure fair ordering
Add emergency functions to handle edge cases where the system becomes congested
here is a link to a similar issue
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.