Skip to content
Business logic Audit finding Intermediate

Bidders can not claim their bids if the auction creator claims the proceeds

If the auction creator claims proceeds before bidders claim their bids, the auction status changes to Claimed, and bidders can no longer claim their bids because the claim function requires the status to be Settled. This locks bidders' funds in the auction house.

cu5t0mPe0 Follow with ether_sky, hash and 3 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-03-axis-finance-judging/issues/67

Found by

cu5t0mPe0, ether_sky, hash, jecikpo, joicygiore, novaman33

Summary

Before the batch auction begins, the auction creator should prefund base tokens to the auction house. During the auction, bidders transfer quote tokens to the auction house. After the auction settles,

  • Bidders can claim their bids and either to receive base tokens or retrieve their quote tokens.
  • The auction creator can receive the quote tokens and retrieve the remaining base tokens.
  • There is no specific order for these two operations.

However, if the auction creator claims the proceeds, bidders can not claim their bids anymore. Consequently, their funds will remain locked in the auction house.

Vulnerability Detail

When the auction creator claims Proceeds, the auction status changes to Claimed.

Solidity
function _claimProceeds(uint96 lotId_)
    internal
    override
    returns (uint96 purchased, uint96 sold, uint96 payoutSent)
{
    auctionData[lotId_].status = Auction.Status.Claimed;
}

Once the auction status has transitioned to Claimed, there is indeed no way to change it back to Settled.

However, bidders can only claim their bids when the auction status is Settled.

Solidity
function claimBids(
    uint96 lotId_,
    uint64[] calldata bidIds_
)
    external
    override
    onlyInternal
    returns (BidClaim[] memory bidClaims, bytes memory auctionOutput)
{
    _revertIfLotInvalid(lotId_);
    _revertIfLotNotSettled(lotId_);   // @audit, here

    return _claimBids(lotId_, bidIds_);
}

Please add below test to the test/modules/auctions/claimBids.t.sol.

Solidity
function test_claimProceeds_before_claimBids()
    external
    givenLotIsCreated
    givenLotHasStarted
    givenBidIsCreated(_BID_AMOUNT_UNSUCCESSFUL, _BID_AMOUNT_OUT_UNSUCCESSFUL)
    givenBidIsCreated(_BID_PRICE_TWO_AMOUNT, _BID_PRICE_TWO_AMOUNT_OUT)
    givenBidIsCreated(_BID_PRICE_TWO_AMOUNT, _BID_PRICE_TWO_AMOUNT_OUT)
    givenBidIsCreated(_BID_PRICE_TWO_AMOUNT, _BID_PRICE_TWO_AMOUNT_OUT)
    givenBidIsCreated(_BID_PRICE_TWO_AMOUNT, _BID_PRICE_TWO_AMOUNT_OUT)
    givenBidIsCreated(_BID_PRICE_TWO_AMOUNT, _BID_PRICE_TWO_AMOUNT_OUT)
    givenBidIsCreated(_BID_PRICE_TWO_AMOUNT, _BID_PRICE_TWO_AMOUNT_OUT)
    givenLotHasConcluded
    givenPrivateKeyIsSubmitted
    givenLotIsDecrypted
    givenLotIsSettled
{
    uint64 bidId = 1;

    uint64[] memory bidIds = new uint64[](1);
    bidIds[0] = bidId;

    // Call the function
    vm.prank(address(_auctionHouse));
    _module.claimProceeds(_lotId);


    bytes memory err = abi.encodeWithSelector(EncryptedMarginalPriceAuctionModule.Auction_WrongState.selector, _lotId);
    vm.expectRevert(err);
    vm.prank(address(_auctionHouse));
    _module.claimBids(_lotId, bidIds);
}

Impact

Users' funds could be locked.

Code Snippet

https://github.com/sherlock-audit/2024-03-axis-finance/blob/cadf331f12b485bac184111cdc9ba1344d9fbf01/moonraker/src/modules/auctions/EMPAM.sol#L846 https://github.com/sherlock-audit/2024-03-axis-finance/blob/cadf331f12b485bac184111cdc9ba1344d9fbf01/moonraker/src/modules/Auction.sol#L556

Tool used

Manual Review

Recommendation

Allow bidders to claim their bids even when the auction status is Claimed.

Discussion

Oighty

Duplicate of #18

sherlock-admin4

The protocol team fixed this issue in the following PRs/commits: https://github.com/Axis-Fi/moonraker/pull/139

10xhash

The protocol team fixed this issue in the following PRs/commits: Axis-Fi/moonraker#139

Fixed The claimed status is replaced with a boolean. Hence the status of a settled auction will now always remain settled

sherlock-admin4

The Lead Senior Watson signed off on the fix.

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

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 claimProceeds function changes the auction status to Claimed, but claimBids only allows claiming when the status is Settled, so claiming proceeds first blocks bid claims.

Impact

Bidders' funds could be locked in the auction house if the auction creator claims proceeds first.

What the attacker needed

Auction creator claims proceeds before bidders claim; bidders have placed bids

The fix

The issue was fixed by replacing the claimed status with a boolean so that a settled auction remains settled.

How it was found

  1. Create a lot and start the auction.
  2. Place several bids.
  3. Conclude the auction, submit the private key, decrypt the lot, and settle it.
  4. Call claimProceeds as the auction house.
  5. Attempt to call claimBids and observe it reverts with Auction_WrongState.

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 a batch auction, people bid by putting in tokens, and after the auction ends they can take out what they won or get back what they put in. The person running the auction can also collect the winning bids. The bug is that if the auction runner collects first, the system changes a status flag that stops bidders from taking out their funds, so their money gets stuck.

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 cu5t0mPe0

View all

4 more disclosed reports, best first.

More from Axis Finance

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.