Skip to content
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

Closed
sherlock-admin4 opened this issue May 4, 2024 · 1 comment
Labels
Excluded Excluded by the judge without consulting the protocol or the senior Non-Reward This issue will not receive a payout

Comments

@sherlock-admin4
Copy link

sherlock-admin4 commented May 4, 2024

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() and liquidate() in Market.sol. This may lead to users unable to pay their debt and be liquidated.

Vulnerability Detail

Functions repay() and liquidate() 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.

@github-actions github-actions bot closed this as completed May 8, 2024
@github-actions github-actions bot added the Excluded Excluded by the judge without consulting the protocol or the senior label May 8, 2024
@santipu03
Copy link
Collaborator

This issue is invalid following the Sherlock guidelines:

An admin action can break certain assumptions about the functioning of the code. Example: Pausing a collateral causes some users to be unfairly liquidated or any other action causing loss of funds. This is not considered a valid issue.

@sherlock-admin3 sherlock-admin3 changed the title Howling Violet Sparrow - Liquidation bots frontrunning users repaying debt after unpausing. Kirkeelee - Liquidation bots frontrunning users repaying debt after unpausing. May 17, 2024
@sherlock-admin3 sherlock-admin3 added the Non-Reward This issue will not receive a payout label May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Excluded Excluded by the judge without consulting the protocol or the senior Non-Reward This issue will not receive a payout
Projects
None yet
Development

No branches or pull requests

3 participants