Open sherlock-admin2 opened 1 year ago
Escalate
This should be High, because the issue allows to freely (other than gas) DOS your own liquidation while keeping your account unhealthy. This opens up a lot of attack vectors and can substantially harm the protocol by creating bad debt.
In previous contests DOS'ing your liquidation was considered High.
Additionally, the user doesn't need to do this every transaction, just every 2 minutes to clear warn
, so this is very cheap, basically free compared to possible profit user can get (for example, if he has 2 reverse "positions" opened - borrow usdt against eth and borrow eth against usdt - one of them goes into bad debt he doesn't have to pay, the other will be in a profit) and possible protocol loss of funds (due to bad debt).
Considering all this, I believe this is clearly a high issue, not medium.
Escalate
This should be High, because the issue allows to freely (other than gas) DOS your own liquidation while keeping your account unhealthy. This opens up a lot of attack vectors and can substantially harm the protocol by creating bad debt.
In previous contests DOS'ing your liquidation was considered High.
Additionally, the user doesn't need to do this every transaction, just every 2 minutes to clear
warn
, so this is very cheap, basically free compared to possible profit user can get (for example, if he has 2 reverse "positions" opened - borrow usdt against eth and borrow eth against usdt - one of them goes into bad debt he doesn't have to pay, the other will be in a profit) and possible protocol loss of funds (due to bad debt).Considering all this, I believe this is clearly a high issue, not medium.
You've created a valid escalation!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
@panprog This finding requires the assumption that you can over a long period of time continuously front-run liquidation bots. You need to do it every 2 minutes.
Even if there's a small chance of 1% that the liquidation bot is faster, the chance that this DOS stays active for more than 24 hours is: 24 hours / 2 minutes = 720. Chance of 720 successful front-runs in a row: 0.99^720 = ~0.07%.
Hence this is not a High due to Low likelihood. Medium is justified.
In the previous contests front-running liquidator to prevent liquidation was considered high, even when it was required to front-run liquidator every block, for example in Symmetrical: https://github.com/sherlock-audit/2023-06-symmetrical-judging/issues/233
So for judging consistency I believe that similar issues should be judged high as well. especially since this issue requires front-running only once per 2 minutes, not once per block.
@panprog
Thanks for bringing this other issue to my attention I hadn't seen that. In that case I can see where the "High" severity is coming from.
Just want to add that due to the implied volatility calculations in Aloe there is a margin of safety built into Aloe and liquidations don't need to occur instantly, liquidations can take up to 24 hours and there should be no bad debt. I.e. the price should not be able to move within 24 hours in a way that would cause bad debt.
And based on my previous calculation, the risk of bad debt is therefore Low.
I still think this should be Medium based on the protocol-specific considerations.
@roguereddwarf I certainly understand your reasoning and it's valid. However, while this protocol has much larger safety margin, which requires longer time until bad debt can happen, this is still comparable to my reference in Symmetrical, where frontrunning liquidation required doing this every block, but bad debt could have happened sooner than here. So, number of blocks in Symmetrical and number of 2-minute intervals here are probably roughly similar.
I want to add another reason for this to be high - in the current state of the code there are the other issues (such as volatility manipulations) which can be combined with this one to make it high.
Planning to accept escalation and upgrade this issue to high.
The impact should be high because the attacker can prevent liquidation by front-running. The likelihood should be between medium and high, even if it requires many successful instances of front-running.
Result: High Has duplicates
Mitigation Review:
The auction timestamp is only reset when either the Borrower is healthy after the liquidation or the Borrower is insolvent and bad debt is erased. In both cases, the Borrower ends up in a state where it's no longer up for liquidation. The issue is therefore fixed.
panprog
high
It is possible to frontrun liquidations with self liquidation with high strain value to clear warning and keep unhealthy positions from liquidation
Summary
Account liquidation involving asset swaps requires warning the account first via
warn
. Liquidation can only happenLIQUIDATION_GRACE_PERIOD
(2 minutes) after the warning. The problem is that any liquidation clears the warning state, including partial liquidations even with very high strain value. This makes it possible to frontrun any liquidation (or just submit transactions as soon as LIQUIDATION_GRACE_PERIOD expires) by self-liquidating with very high strain amount (which basically keeps position unchanged and still unhealthy). This clears the warning state and allows account to be unliquidatable for 2 more minutes, basically preventing (DOS'ing) liquidators from performing their job.Malicious user can open a huge borrow position with minimum margin and can keep frontrunning liquidations this way, basically allowing unhealthy position remain active forever. This can easily lead to position going into bad debt and causing loss of funds for the other protocol users (as they will not be able to withdraw all their funds due to account's bad debt).
Vulnerability Detail
Borrower.warn
sets the time when the liquidation (involving swap) can happen:But
Borrower.liquidation
clears the warning regardless of whether account is healthy or not after the repayment:Impact
Very important protocol function (liquidation) can be DOS'ed and make the unhealthy accounts avoid liquidations for a very long time. Malicious users can thus open huge risky positions which will then go into bad debt causing loss of funds for all protocol users as they will not be able to withdraw their funds and can cause a bank run - first users will be able to withdraw, but later users won't be able to withdraw as protocol won't have enough funds for this.
Proof of concept
The scenario above is demonstrated in the test, add this to Liquidator.t.sol:
Code Snippet
Borrower.warn
sets the liquidation timer: https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Borrower.sol#L171Borrower.liquidate
clears it regardless of strain: https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Borrower.sol#L281This makes any liquidation (even the one which doesn't affect assets much due to high strain amount) clear the warning.
Tool used
Manual Review
Recommendation
Consider clearing "warn" status only if account is healthy after liquidation.