sherlock-audit / 2023-10-aloe-judging

9 stars 6 forks source link

0xReiAyanami - Liquidation process is flawed. missing incentive to call warn #145

Open sherlock-admin2 opened 1 year ago

sherlock-admin2 commented 1 year ago

0xReiAyanami

medium

Liquidation process is flawed. missing incentive to call warn

Summary

Aloe´s Liquidation process s flawed in the way, that there is no incentive for Liquidators to call the warn function, which is required before liquidations.

Vulnerability Detail

The Aloe protocol has a Liquidation process, which involves a grace period for the Borrower. This means, there is a warn function, that has to be called, that is setting a unleashLiquidationTime. A Liquidation can only be executed when this time is reached.

Problem is, there is no incentive for anyone to call the warn function. Only the actual liquidate function is inventiviced by giving a 5% incentive in Tokens, if there is a swap required, and always giving a small amount of ETH (ANTE) to cover the gas cost.

A Liquidator that calls the warn function has no guarantee, that he is the one, that actually can call liquidate, when the time has come. Therefore it would be a waste of Gas to call the warn function.

This might result in a situation where nobody is willing to call warn, and therefore the borrower will not get liquidated at all, which could ultimately lead to a loss of Funds for the Lender, when the Borrower starts to accrue bad Debt.

Impact

Code Snippet

https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Borrower.sol#L148-L173

Tool used

Manual Review

Recommendation

Incentivice the call of warn, to at least pay a small amount of eth (similiar to the ANTE), to ensure liquidation is going to happen.

sherlock-admin2 commented 1 year ago

3 comment(s) were left on this issue during the judging contest.

panprog commented:

borderline low/medium, but indeed there is no incentive for anyone to call warn

MohammedRizwan commented:

valid

chrisling commented:

the best incentive in this case is that liquidators can liquidate after they call warn. The recommendation will only introduce a lot more issues (e.g. malicious actors exploiting the incentive by spamming warn)

haydenshively commented 1 year ago

Fixed in https://github.com/aloelabs/aloe-ii/pull/209

roguereddwarf commented 12 months ago

Mitigation Review:

The Borrower.warn() function as well as the Borrower.unwarn() function are now incentivized with address(this).balance / 5 and address(this).balance / 4 respectively.

There is still no guarantee that this amount is actually sufficient to cover gas costs in all scenarios.

In fact it's quite possible that the ante balance is drained (intentionally or unintentionally) by repeated warn() / unwarn() cycles which then might lead to a lack of incentives when the Borrower is underwater for a longer time and is at risk of accruing bad debt.

Still, the lack of incentives as such is fixed now.