The exchange rate is updated by rate = rate * (supply + fee) / supply. Because this is integer arithmetic,
the step is always zero when the fee is small relative to total supply (or exactly 0). Since the function
reverts when the rate cannot strictly increase, any such call bounces — taking the whole flashloan (or v1
deposit) with it.
updateExchangeRate uses round-down division with a strict-increase requirement. Any operation whose oracle
fee fails to shift the rate (fee == 0, or fee * rate < supply) reverts the entire external call, including
state-changing flows where the fee is not the point of the transaction.
Likelihood: Medium-High. Any low-fee borrow (fee of a few wei against a large supply), borrow of a
cheap-priced token, borrow pushed below the rounding threshold by an oracle price crush (see the oracle
finding), or v1 deposit in those states hits the revert — with no way for the caller to opt out.
Impact:
Flash loans below a value-dependent threshold are permanently blocked; in v1, LP onboarding (deposit)
is blocked for those tokens too (a first, zero-supply deposit with fee==0 also hits the div-by-zero panic).
Constrained by the oracle price, an attacker can deliberately crush the price to force the fee to round to
0, DoSing every flash loan on a token until the pool price recovers.
test/poc/PocExchangeRateDoS.t.sol (real code, both tests PASS):
Run: forge test --match-contract PocExchangeRateDoS -vv (both tests PASS).
In updateExchangeRate, return early (or no-op, with a bounded delay) when the fee is zero or would round to
zero, instead of reverting:
if (fee == 0) return; and compute the step with a + 1 guard or a scaled numerator so a tiny fee can never
hard-fail an unrelated operation.
Call updateExchangeRate only when fee > 0, and in v1 remove the fee-step from deposit entirely.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.