Closed sherlock-admin closed 8 months ago
1 comment(s) were left on this issue during the judging contest.
takarez commented:
invalid: in acutionRepay the call should revert because the debt has already been paid as described by the watson.
Invalid, given front-running is not possible on base chain, arbitrum and optimism. This also seems to be describing how a liquidation mechanism works given if liquidation thresholds is reached, than user should be subjected liquidation, no issue here.
NentoR
medium
LendingPool::repay()
can be frontran and lead to losses for account owner due to missing auction checkSummary
It is possible for account owners to call
LendingPool::repay()
while the account's outstanding debt is auctioned. If the account happens to reach the liquidation threshold just before the owner repays their debt, a malicious actor could come in, frontrun the repayment, bid at once and still snipe the account's collateral.Vulnerability Detail
When an account reaches the liquidation threshold, anyone can auction it to start covering the losses incurred.
LendingPool::repay()
lacks a check for whether the account is already auctioned, which opens the door for a frontrunning attack. Here is an example scenario:Liquidator::liquidateAccount()
.LiquidationPool
.Coded POC (
test/fuzz/Liquidator/Bid.fuzz.t.sol
):Impact
Account Owner burns the debt of the account and brings it back to a healthy state but can easily be frontrun by malicious actors who initiate an auction for it before that. Eventually, the account owner loses the collateral held in the account as well as any buffer amount used during the repayment.
Code Snippet
https://github.com/sherlock-audit/2023-12-arcadia/blob/main/lending-v2/src/LendingPool.sol#L464-L475
Tool used
Manual Review
Recommendation
An
if
statement should be added at the beginning ofLendingPool::repay()
that checks whether the account has already been auctioned. If so, it should revert.