Canceling an auction does not refund the current highest bidder
The cancelAuction function does not refund the current highest bidder, unlike createBid which does. A malicious borrower can cancel an auction after a bid meets the reserve price, causing the bidder to lose their funds.
bin2chen Follow with chainNue, csanuragjain and 8 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/202
Found by
bin2chen, chainNue, csanuragjain, TurnipBoy, peanuts, neila, Prefix, Jeiwan, hansfriese, 0xRajeev, minhquanym
Summary
If the collateral token owner cancels the active auction and repays outstanding debt, the current highest bidder will not be refunded and loses their funds.
Vulnerability Detail
The AuctionHouse.createBid() function refunds the previous bidder if there is one. The same logic would also be necessary in the AuctionHouse.cancelAuction() function but is missing.
Impact
If the collateral token owner cancels the active auction and repays outstanding debt (reservePrice), the current highest bidder will not be refunded and will therefore lose their funds which can also be exploited by a malicious borrower.
Potential exploit scenario: A malicious borrower can let the loan expire without repayment, trigger an auction, let bids below reserve price, and (hope to) front-run any bid >= reserve price to cancel the auction which effectively lets the highest bidder pay out (most of) the liens instead of the borrower.
Code Snippet
- https://github.com/sherlock-audit/2022-10-astaria/blob/main/lib/astaria-gpl/src/AuctionHouse.sol#L113-L116
- https://github.com/sherlock-audit/2022-10-astaria/blob/main/lib/astaria-gpl/src/AuctionHouse.sol#L210-L224
Tool used
Manual Review
Recommendation
Add the refund logic (via _handleOutGoingPayment() to the current bidder) in the cancel auction flow similar to the create bid auction flow.
Discussion
IAmTurnipBoy
Escalate for 1 USDC
Huge loss of funds for bidder. High risk
sherlock-admin
Escalate for 1 USDC
Huge loss of funds for bidder. High risk
You've created a valid escalation for 1 USDC!
To remove the escalation from consideration: Delete your comment. To change the amount you've staked on this escalation: Edit your comment (do not create a new comment).
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
Evert0x
Escalation accepted.
sherlock-admin
Escalation accepted.
This issue's escalations have been accepted!
Contestants' payouts and scores will be updated according to the changes made on this issue.
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 cancelAuction function lacks the refund logic that is present in createBid, so it does not return the current highest bid to the bidder.
Impact
The highest bidder loses their funds, and a malicious borrower can exploit this to make the bidder pay off the loan instead of the borrower.
What the attacker needed
Active auction with a highest bid; borrower can cancel auction
The fix
Add refund logic (via _handleOutGoingPayment) to the current bidder in the cancel auction flow, similar to the create bid flow.
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 an auction, when someone places a higher bid, the previous bidder gets their money back. But if the auction is cancelled, the person who currently has the highest bid does not get their money back, so they lose it. A malicious borrower can exploit this by cancelling the auction right after a bid that would have repaid the loan.
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.