Closed sherlock-admin2 closed 9 months ago
1 comment(s) were left on this issue during the judging contest.
takarez commented:
invalid
Invalid, there seems to be some misunderstanding here, you can only terminate early when bidder bids exceed debt in auction as seen in comments here
anya
medium
Premature earlyTerminate Flag Setting in auctionRepay Function in LendinPool.sol
Summary
The auctionRepay function sets the earlyTerminate flag to true before fully verifying if the debt has been fully repaid. This potentially leads to inconsistencies and unexpected behaviour depending on _settleLiquidationHappyFlow and other dependent functions handle this flag.
Vulnerability Detail
Premature Flag Setting: The earlyTerminate flag is set to true based on the comparison accountDebt <= amount. However, the actual debt repayment (using _withdraw) occurs later in the function.
Potential Issues: Depending on the implementation of _settleLiquidationHappyFlow, setting the flag prematurely could lead to:
Impact
Code Snippet
https://github.com/sherlock-audit/2023-12-arcadia/blob/main/lending-v2/src/LendingPool.sol#L500-L510
Tool used
Manual Review
Recommendation
Move earlyTerminate Flag Setting: Set the earlyTerminate flag after successfully completing the debt repayment using _withdraw. This ensures accurate reflection of the final state.