Skip to content
Business logic Audit finding Intermediate

Owner can steal all Basket funds during auction

The Factory contract owner can change auction parameters at any time, allowing them to set the token requirement to near zero during an auction. This lets the owner acquire all underlying tokens from a Basket without transferring the required pending tokens.

0xsanson Follow

Originally disclosed on Code4rena

Submitted by 0xsanson

Impact

The owner of Factory contract can modify the values of auctionMultiplier and auctionDecrement at any time. During an auction, these values are used to calculate newRatio and thereby tokensNeeded: specifically, it’s easy to set the factory parameters so that tokensNeeded = 0 (or close to zero) for every token. This way the owner can participate at an auction, change the parameters, and get the underlying tokens from a Basket without transferring any pending tokens.

Proof of Concept

https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Auction.sol#L89-L99

Tools Used

editor

Recommended Mitigation Steps

Consider adding a Timelock to these Factory functions. Otherwise a way to not modify them if an auction is ongoing (maybe Auction saves the values it reads when startAuction is called).

frank-beard (Kuiper) confirmed and disagreed with severity:

the owner for this is intended to be a dao that acts in support of the protocol, however this is a good point to the centralization concerns for the protocol, we will most likely manage this by adding a timelock to these function

Alex the Entreprenerd (judge) commented:

Agree with the finding from the warden, highly recommend the sponsor to add these possibilities in their docs to make it easy for users to understand them.

That said, a possible remediation would also be to add checks in the setters, to avoid for these specific edge cases.

Because the exploit is dependent on an external condition (setting to a specific value by governance), the finding is of medium severity

The original report as published on Code4rena, by 0xsanson. 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 auction parameters are read from the Factory contract during the auction and can be changed by the owner at any time, with no timelock or check to prevent modification while an auction is active.

Impact

The owner could steal all funds from a Basket by manipulating auction parameters, though this depends on the owner acting maliciously or being compromised.

What the attacker needed

Owner is malicious or compromised; auction is active

The fix

The fix should add a timelock to the Factory functions or prevent modification of these parameters while an auction is ongoing, for example by having the Auction contract save the values when startAuction is called.

How it was found

  1. The owner participates in an auction.
  2. The owner changes the Factory parameters so that tokensNeeded becomes zero or near zero.
  3. The owner obtains the underlying tokens from the Basket without transferring pending tokens.

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.

In this system, a 'Factory' contract controls settings for auctions. The owner can change two numbers that decide how many tokens someone must put in to win an auction. If the owner sets those numbers so the required amount becomes almost zero, they can win the auction and take all the valuable tokens without paying the fair price.

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 0xsanson

View all

8 more disclosed reports, best first.

More from Kuiper contest

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.