Skip to content
Business logic Audit finding Advanced

An oracle deprecation might lead the protocol to sell assets for a low price

A deprecated Chainlink oracle causes calls to revert with empty error data, which the protocol misinterprets as an out-of-gas error, blocking bids during a Dutch auction. This can let a bidder buy assets at a price below market value once the oracle is updated.

0xA5DF Follow

Originally disclosed on Code4rena

Submitted by 0xA5DF

During a Dutch Auction, if a user places a bid, the trade is settled in the same transaction. As part of this process, the backing manager tries to call the rebalance() function again. The call to rebalance() is wrapped in a try-catch block, if an error occurs and the error data is empty, the function will revert.

The assumption is that if the error data is empty that means it was due to an out-of-gas error, this assumption isn’t always true as mentioned in a previous issue (that wasn’t mitigated). In the case of this issue, this can result in a case where users can’t bid on an auction for some time, ending up selling an asset for a price lower than the market price.

Impact

Protocol’s assets will be auctioned for a price lower than the market price.

Proof of Concept

Consider the following scenario:

  • Chainlink announces that an oracle will get deprecated
  • Governance passes a proposal to update the asset registry with a new oracle
  • A re-balancing is required and executed with a Dutch Auction
  • The oracle deprecation happens before the auction price reaches a reasonable value
  • Any bid while the oracle is deprecated will revert
  • Right before the auction ends the proposal to update the asset becomes available for execution (after the timelock delay has passed). Somebody executes it, bids, and enjoys the low price of the auction.

Recommended Mitigation Steps

On top of checking that the error data is empty, compare the gas before and after to ensure this is an out-of-gas error.

0xean (judge) commented:

On the fence on this one, it is based off a known issue from a previous Audit but does show a new problem stemming from the same problem of oracle deprecation.

Look forward to sponsor comment.

tbrent (Reserve) disputed and commented:

The PoC does not function as specified. Specifically, bidding on an auction does not involve the price at the time of the tx. The price is set at the beginning of the dutch auction in the init() function. Therefore, it is the starting of new auctions that will revert while the oracle is deprecated, while bids will succeed and simply fail to start the next auction.

0xA5DF (warden) commented:

Therefore, it is the starting of new auctions that will revert while the oracle is deprecated, while bids will succeed and simply fail to start the next auction.

Hey @tbrent - I didn’t quite understand the dispute here, if starting the next auction will fail/revert then the bid will revert too. bid() calls origin.settleTrade() and settleTrade() calls rebalance(). If rebalance() reverts due to a deprecated oracle then settleTrade() will revert too (rebalance() will revert with empty data, and therefore the catch block will trigger a revert here).

tbrent (Reserve) confirmed and commented:

@0xA5DF - Ah, understood now. Agree this is Medium and think it should be counted as a new finding since the consequence (dutch auction economics break) is novel.

tbrent (Reserve) commented:

Hey @0xa5df — we’re having some confusion around exactly what happens when a chainlink oracle is deprecated. Do you have details to share about what this ends up looking like?

We’re having trouble finding documentation on this, and it feels like the aggregator contract should just stay there and return a stale value. Is that not right? Has this happened in the past or has Chainlink committed to a particular approach for deprecating?

0xA5DF (warden) commented:

Hey - It’s a bit difficult to track deprecated Chainlink oracles since Chainlink removes the announcement once they’re deprecated. I was able to track one Oracle that was deprecated during the first audit, from the original issue this seems to be this one. It seems that what happens is that Chainlink sets the aggregator address to the zero address, which makes the call to latestRoundData() to revert without any data (I guess this is due to the way Solidity handles calls to a non-contract address). See also the PoC in the original issue in the January audit.

tbrent (Reserve) commented:

Got it, checks out. Thanks!

Reserve mitigated:

Add oracle deprecation check. PR: https://github.com/reserve-protocol/protocol/pull/886

Status: Mitigation confirmed. Full details in reports from 0xA5DF, ronnyx2017, and rvierdiiev - and also shared below in the Mitigation Review section.


The original report as published on Code4rena, by 0xA5DF. 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 code assumes an empty error from a failed external call means out-of-gas, but a deprecated oracle also returns empty error data, causing an unintended revert.

Impact

Protocol assets could be auctioned for a price lower than the market price, though the text notes the PoC was disputed and later confirmed as a medium-severity issue.

What the attacker needed

Chainlink oracle is deprecated; A Dutch auction is running; Governance proposal to update oracle is pending

The fix

The protocol was mitigated by adding an oracle deprecation check.

How it was found

  1. Chainlink announces an oracle will be deprecated.
  2. Governance passes a proposal to update the asset registry with a new oracle.
  3. A rebalancing is executed with a Dutch Auction.
  4. The oracle deprecation happens before the auction price reaches a reasonable value.
  5. Any bid while the oracle is deprecated reverts.
  6. Right before the auction ends, the proposal becomes executable; someone executes it, bids, and gets the low price.

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.

A Dutch auction is a sale where the price starts high and drops over time. The protocol uses an external price feed (an oracle) to decide when to start new auctions. If that oracle is switched off, the protocol's attempt to start the next auction fails, and because of a coding mistake it also blocks people from bidding. This means the auction can keep dropping until someone fixes the oracle and buys cheaply.

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.

More by 0xA5DF

View all

35 more disclosed reports, best first.

More from Reserve Core

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.