Users can withdraw liquidated collateral
When a user is liquidated via liquidationType2, the deposit's liquidated flag is not set, so the user can still withdraw collateral and repay debt. This lets the liquidated user take collateral that has already been sent to Synthetix, likely from other users' deposits.
0x37 Follow with John44, santiellena and 4 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/696
Found by
0x37, John44, santiellena, t.aksoy, valuevalk, volodya, wellbyt3
Summary
If a user gets liquidated through liquidationType2 they will still be able to withdraw their collateral and repay their debt as depositDetail.liquidated is not set to true. This is problematic as the collateral will have already been sent to Synthethix, and the collateral that the liquidated user withdraws will most likely be taken from the collateral of other users.
Furthermore, the necessary liquidation state changes performed in liquidationType1 are omitted in the second type:
https://github.com/sherlock-audit/2024-11-autonomint/blob/0d324e04d4c0ca306e1ae4d4c65f0cb9d681751b/Blockchain/Blockchian/contracts/Core_logic/borrowLiquidation.sol#L241-L277
This is problematic as numerous parts of the protocol are reliant on this values, for example the CDS cumulative value which determines the profits/losses of CDS depositors.
Root Cause
In borrowLiquidation.liquidationType2 depositDetail.liquidated is not set to true.
https://github.com/sherlock-audit/2024-11-autonomint/blob/0d324e04d4c0ca306e1ae4d4c65f0cb9d681751b/Blockchain/Blockchian/contracts/Core_logic/borrowLiquidation.sol#L324-L366
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
- A user gets liquidated through
liquidationType2and their collateral gets transferred to Synthetix. - Even though they have been liquidated they can still withdraw their collateral as no state changes have been made to their deposit.
Impact
Liquidated users can withdraw their collateral. If that occurs the withdrawn collateral will be taken from the deposits of other borrowers.
PoC
No response
Mitigation
Perform the appropriate state changes when liquidationType2 gets called.
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 liquidationType2 function fails to update the deposit's liquidated status and other liquidation-related state variables that liquidationType1 sets.
Impact
Liquidated users can withdraw collateral that has already been sent to Synthetix, and the withdrawn amount will likely be taken from other borrowers' deposits.
What the attacker needed
User is liquidated via liquidationType2; user still has a deposit record
The fix
The protocol should perform the appropriate state changes, such as setting depositDetail.liquidated to true, when liquidationType2 is called.
How it was found
- A user gets liquidated through liquidationType2 and their collateral is transferred to Synthetix.
- Because no state changes are made to their deposit, the user can still withdraw their collateral.
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 lending protocol, when a borrower's collateral falls below a required level, the protocol can liquidate it: sell the collateral to repay the debt. This report says that one specific liquidation method forgets to mark the borrower's deposit as liquidated. Because of that missing mark, the borrower can still act as if nothing happened and withdraw collateral that has already been sold, taking funds that belong to other users.
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.