This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
Kirkeelee - Liquidation bots frontrunning users repaying debt after unpausing. #3
Labels
Excluded
Excluded by the judge without consulting the protocol or the senior
Non-Reward
This issue will not receive a payout
Kirkeelee
medium
Liquidation bots frontrunning users repaying debt after unpausing.
Summary
Race condition may emerge between users and liquidation bots when the protocol paused and then unpauses the functions
repay()
andliquidate()
in Market.sol. This may lead to users unable to pay their debt and be liquidated.Vulnerability Detail
Functions
repay()
andliquidate()
in Market.sol have modifier "whenNotPaused" in order to prevent users from altering their positions when protocol is paused in certain situations.unpause()
function sets the pause state to false when threat is gone according to the code documentation. Positions of user may become eligible for liquidation during the paused state and after unpausing they may be liquidated before they are able to repay their debt. Most users use liquidation bots in open markets and the current protocol also has its own bot that monitors the user positions. It is certain that user cannot frontrun bots in these situations and their positions will be liquidated by bots leading to the loss of funds of the user.Impact
Users unable to pay their debt before the bots when the protocol unpauses and loose funds.
Code Snippet
https://github.com/sherlock-audit/2024-04-interest-rate-model/blob/main/protocol/contracts/Market.sol#L176-L183
https://github.com/sherlock-audit/2024-04-interest-rate-model/blob/main/protocol/contracts/Market.sol#L545-L549
Tool used
Manual Review
Recommendation
Prevent liquidation after a certain period of time when the protocol is unpaused. An example of similar issue and the fix can be found here.
The text was updated successfully, but these errors were encountered: