Platform: Code4rena
Start Date: 04/03/2024
Pot Size: $88,500 USDC
Total HM: 31
Participants: 105
Period: 11 days
Judge: ronnyx2017
Total Solo HM: 7
Id: 342
League: ETH
Rank: 104/105
Findings: 1
Award: $3.35
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: kfx
Also found by: 0x175, 0xAlix2, 0xjuan, AMOW, Aymen0909, CaeraDenoir, Giorgio, JCN, JecikPo, JohnSmith, Norah, SpicyMeatball, alexander_orjustalex, atoko, erosjohn, falconhoof, givn, grearlake, jnforja, kinda_very_good, lanrebayode77, nmirchev8, shaka, web3Tycoon, zxriptor
3.3501 USDC - $3.35
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L696-L698
A user undergoing the liquidation process can front-run a call to the V3Vault.sol::liquidate
by manipulating debtShares
variable. This is possible due to the equality requirement of user's loan debtShares
and LiquidateParams.debtShares
at lines 696-698:
if (debtShares != params.debtShares) { revert DebtChanged(); }
To achieve that, a user can repay their loan with a minimal amount of tokens by calling V3Vault.sol::repay()
function. This will cause debtShares
update as can be seen in lines 990-991.
uint256 loanDebtShares = loan.debtShares - shares; loan.debtShares = loanDebtShares;
In this manner, a user can evade liquidation an unlimited number of times as long as it remains economically viable for them, potentially leading to bad debt for the protocol.
debtShares
of the loan as it is last seen on V3Vault contract.repay
transaction with several wei of the token and a higher gas price. This leads debtShares
of the loan to change (move down).Manual review.
Remove debtShares
equality check and rely solely on the loan health status.
Other
#0 - c4-pre-sort
2024-03-18T18:14:01Z
0xEVom marked the issue as sufficient quality report
#1 - c4-pre-sort
2024-03-18T18:15:04Z
0xEVom marked the issue as duplicate of #231
#2 - c4-pre-sort
2024-03-22T12:02:52Z
0xEVom marked the issue as duplicate of #222
#3 - c4-judge
2024-03-31T14:47:29Z
jhsagd76 changed the severity to 2 (Med Risk)
#4 - c4-judge
2024-03-31T16:06:34Z
jhsagd76 marked the issue as satisfactory