Triggering liquidations ahead of expected time leads to loss and lock of funds
Liquidations can be triggered for a collateral after a lien expires but before the auction window at epoch end. The liquidation logic skips decreasing the lien count and setting up the liquidation accountant, so auction proceeds go directly to lien owners and the epoch cannot advance, causing loss and lock of funds.
Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/167
Found by
0xRajeev
Summary
Triggering liquidations for a collateral after one of its liens has expired but before the auction window (default 2 days) at epoch end leads to loss and lock of funds.
Vulnerability Detail
Liquidations are allowed to be triggered for a collateral if any of its liens have exceeded their loan duration with outstanding payments. However, the liquidation logic does not execute the decrease of lien count and setting up of liquidation accountant if the time to epoch end is greater than the auction window (default 2 days). The auction proceeds nevertheless.
Impact
If liquidations are triggered before the auction window at epoch end, they will proceed to auctions without decreasing epoch lien count, without setting up the liquidation accountant for the lien and other related logic. This will, at a minimum, lead to auction proceeds going to lien owners directly instead of via the liquidation accountants (loss of funds) and the epoch unable to proceed to the next on (lock of funds and protocol halt).
Code Snippet
1.https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/AstariaRouter.sol#L388-L415
Tool used
Manual Review
Recommendation
Revisit the liquidation logic and its triggering related to the auction window and epoch end.
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 liquidation function does not check whether the current time is within the auction window before performing critical state updates, so it proceeds without decreasing the lien count or setting up the liquidation accountant.
Impact
Auction proceeds could go directly to lien owners instead of via liquidation accountants, and the epoch may be unable to proceed, locking funds and halting the protocol.
What the attacker needed
A lien has expired with outstanding payments; liquidation triggered before auction window
The fix
The liquidation logic and its triggering should be revisited to ensure it only proceeds when the auction window conditions are met, so that lien count and liquidation accountant are properly updated.
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, loans are backed by collateral and grouped into time periods called epochs. If a borrower misses a payment, anyone can start a liquidation to sell the collateral. The bug is that if you start this sale too early, some important bookkeeping steps are skipped, so the money from the sale goes to the wrong place and the system 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.