Skip to content
DoS Audit finding Intermediate

All AMMs have to be past nextFundingTime to update

The funding settlement routine reverts whenever any single AMM is not yet past its next funding time, so one AMM that is not ready blocks updates for every other AMM. An attacker or ordinary timing could therefore stall funding settlement across all markets until the slowest AMM's timer elapses.

0xliumin Follow

Originally disclosed on Code4rena

Submitted by 0xliumin

https://github.com/code-423n4/2022-02-hubble/blob/ed1d885d5dbc2eae24e43c3ecbf291a0f5a52765/contracts/AMM.sol#L348

settleFunding calls will revert until all AMMs are ready to be updated.

Proof of Concept

AMM 1 has a nextFundingTime of now. AMM 2 has a nextFundingTime in 30 minutes. AMM 1 won’t be able to be updated until after AMM 2’s nextFundingTime elapses.

Recommended Mitigation Steps

You shouldn’t revert at the place mentioned in the links to affected code. Just return so that the other AMMs can still get updated.

atvanguard (Hubble) confirmed and resolved


The original report as published on Code4rena, by 0xliumin. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

Likely the settlement loop reverts on a not-yet-due AMM instead of skipping it, so a single unready AMM aborts the whole batch.

Impact

Funding updates for ready AMMs are blocked until every other AMM's funding time has passed, which could delay settlement across all markets.

What the attacker needed

Multiple AMMs with differing funding times

The fix

The report recommends not reverting in that case but returning instead, so the other AMMs can still be updated; the project confirmed and resolved it.

How it was found

  1. Have one AMM whose next funding time has arrived.
  2. Have another AMM whose next funding time is still in the future.
  3. Call the funding settlement routine and observe it reverting.
  4. Note that the first AMM cannot be updated until the second AMM's time passes.

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.

Each trading market (an AMM) has a timer saying when its funding can next be recalculated. The code that updates funding loops over all markets and stops with an error if even one market's timer has not run out. That means one market that is not ready freezes the update for all the others.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0xliumin

View all

5 more disclosed reports, best first.

More from Hubble contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.