Skip to content
Business logic Audit finding Intermediate

Epochs can be progressed during ongoing auctions to cause LP fund loss and collateral lockup

The `finalAuctionEnd` variable is set to a fixed duration (3 days) instead of an actual timestamp, so the check for auction end is incorrect. This allows epochs to be progressed during an ongoing auction, which can disrupt liquidation logic and potentially cause loss of LP funds and locked collateral.

0xRajeev Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/175

Found by

0xRajeev

Summary

The currentEpoch can be progressed while having an ongoing auction which will completely mess up the liquidation logic to potentially cause LP fund loss and collateral lockup.

Vulnerability Detail

The LiquidationAccountant.claim() function is only callable if finalAuctionEnd is set to 0 or the block.timestamp is greater than finalAuctionEnd (i.e. auction has ended). Furthermore, PublicVault.processEpoch should only be callable if there is no ongoing auction if a liquidation accountant is deployed in the current epoch.

finalAuctionEnd is set within the LiquidationAccountant.handleNewLiquidation function, which is called from the AstariaRouter.liquidate function. However, instead of providing a timestamp of the auction end, a value of 2 days + 1 days is given because COLLATERAL_TOKEN.auctionWindow() returns 2 days.

This does not achieve the intended constraint on checking for the end of the auction because it uses a fixed duration instead of a timestamp.

Impact

Epochs can be progressed during ongoing auctions to completely mess up the liquidation logic to potentially cause LP fund loss and collateral lockup.

Code Snippet

  1. https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LiquidationAccountant.sol#L67
  2. https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/PublicVault.sol#L244-L248
  3. https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/AstariaRouter.sol#L409

Tool used

Manual Review

Recommendation

Revisit the logic to use an appropriate timestamp instead of a fixed duration.

The original report as published on Sherlock, by 0xRajeev. 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

Likely, the code sets `finalAuctionEnd` to a duration (2 days + 1 day) rather than a timestamp, so the check for auction end is ineffective.

What the attacker needed

An ongoing auction; liquidation accountant deployed

The fix

The logic should be revised to use an appropriate timestamp instead of a fixed 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 smart contract system, when a loan is liquidated, an auction is started to sell the collateral. The code is supposed to prevent certain actions (like moving to a new epoch) until the auction ends. However, it mistakenly uses a fixed time period (3 days) instead of the actual end time of the auction. This means the system might think the auction has ended when it hasn't, allowing actions that can mess up the funds and lock collateral.

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

View all

61 more disclosed reports, best first.

More from Astaria

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.