Skip to content
Business logic Audit finding Intermediate

Changing auction duration will have effect on ongoing auctions

The auction duration is stored as a global parameter, so changing it affects auctions that are already in progress. An attacker (or admin) could shorten or extend ongoing auctions, potentially causing participants to lose funds or receive unexpected outcomes.

SpicyMeatball Follow

Originally disclosed on Code4rena

Submitted by SpicyMeatball

https://github.com/code-423n4/2024-07-benddao/blob/main/src/libraries/logic/ConfigureLogic.sol#L504 https://github.com/code-423n4/2024-07-benddao/blob/117ef61967d4b318fc65170061c9577e674fffa1/src/libraries/logic/IsolateLogic.sol#L320-L321 https://github.com/code-423n4/2024-07-benddao/blob/117ef61967d4b318fc65170061c9577e674fffa1/src/libraries/logic/IsolateLogic.sol#L423-L424

Impact

Auctions created before the auction duration was changed will have their duration shortened/extended, which may catch their participants off guard.

Proof of Concept

When an isolated position reaches it’s liquidation threshold, users can put it up for auction to pay off the debt and take the collateral NFT. The auction has a fixed duration during which borrower can redeem the debt and if it doesn’t happen, the last bidder will pay off the debt and receive the NFT at the end.

The PoolAdmin can customize the auctionDuration variable with the setAssetAuctionParams function. This can be a problem because the protocol checks whether the auction has ended as follows:

      vars.auctionEndTimestamp = loanData.bidStartTimestamp + nftAssetData.auctionDuration;
      require(block.timestamp > vars.auctionEndTimestamp, Errors.ISOLATE_BID_AUCTION_DURATION_NOT_END);

      vars.auctionEndTimestamp = loanData.bidStartTimestamp + nftAssetData.auctionDuration;
      require(block.timestamp <= vars.auctionEndTimestamp, Errors.ISOLATE_BID_AUCTION_DURATION_HAS_END);

Thus, the new duration will be applied to auctions that were started before the duration change. For example, if the duration was shortened, some auctions will end prematurely, which may be unexpected for its participants.

Recommended Mitigation Steps

Consider calculating and storing the auction end time instead of the start time:

-       loanData.bidStartTimestamp = uint40(block.timestamp);
+       loanData.auctionEndTimestamp = uint40(block.timestamp) + nftAssetData.auctionDuration;

Assessed type

Timing

thorseldon (BendDAO) disputed and commented:

This is our service design as expected. We will try to avoid the adjust the parameters when some auctions going on. But maybe we want to adjust the auction duration sometimes when there’s auction triggered by some emergency cases; no one can predict the emergency cases in the future, but we keep this flexibility.

0xTheC0der (judge) commented:

Similar to my reasoning in Issue #26, I understand that the centralized aspect is intended, carefully considered and out of scope. However, on contract level these parameter changes can have implications that harm users, therefore Medium severity seems justified.

Nevertheless, I am open for further discussion (also with wardens) whether to consistently downgrade all of those DAO parameter change related issues or keep them.


The original report as published on Code4rena, by SpicyMeatball. 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

The auction end time is not stored; instead, it is recalculated using the current global auction duration, so parameter changes retroactively affect ongoing auctions.

Impact

Ongoing auctions may end prematurely or be extended unexpectedly, which could harm participants who rely on the original end time.

What the attacker needed

Admin changes auction duration; auction already in progress

The fix

The auction end time should be calculated and stored when the auction starts, rather than recalculated from the current duration.

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, an auction's end time is calculated by adding a fixed duration to the start time. If the duration setting is changed while an auction is running, the end time shifts, which can surprise bidders. This is like changing the closing time of a shop while customers are already inside.

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 SpicyMeatball

View all

18 more disclosed reports, best first.

More from BendDAO Invitational

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.