Revert Lend - AMOW's results

A lending protocol specifically designed for liquidity providers on Uniswap v3.

General Information

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

Revert

Findings Distribution

Researcher Performance

Rank: 103/105

Findings: 1

Award: $3.35

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

3.3501 USDC - $3.35

Labels

bug
2 (Med Risk)
satisfactory
sufficient quality report
:robot:_45_group
duplicate-222

External Links

Lines of code

https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Vault.sol#L696-L697

Vulnerability details

Impact

Users can avoid being liquidated.

Proof of Concept

When calling V3Vault.liquidate liquidator manually inputs LiquidateParams which is further checked against debtShares of the liquitee and reverts DebtChanged in case they don't match.

    function liquidate(LiquidateParams calldata params) external override returns (uint256 amount0, uint256 amount1) {
        // liquidation is not allowed during transformer mode
        if (transformedTokenId > 0) {
            revert TransformNotAllowed();
        }

        LiquidateState memory state;

        (state.newDebtExchangeRateX96, state.newLendExchangeRateX96) = _updateGlobalInterest();

        uint256 debtShares = loans[params.tokenId].debtShares;
        if (debtShares != params.debtShares) { 
            revert DebtChanged();
        }

Unhealthy borrowers can anticipate and front-run liquidations by repaying 1 wei (or minAmount) worth of shares, thus avoid being liquidated.

Furthermore, liquidation profitability is directly proportional to the extent of unhealthiness of a position. Malicious users can call V3Vault.repay (callable by anyone) on slightly unhealthy positions of honest users to avoid them being liquidated by other liquidators thus making the position more unhealthy and eligible for higher liquidation rewards (and lower return to honest user when _cleanupLoan is called)

Tools Used

Manual review

change the check to:

       if (debtShares > params.debtShares) { 
            revert DebtChanged();
        }

Assessed type

Context

#0 - c4-pre-sort

2024-03-18T18:13:55Z

0xEVom marked the issue as sufficient quality report

#1 - c4-pre-sort

2024-03-18T18:14:43Z

0xEVom marked the issue as duplicate of #231

#2 - c4-pre-sort

2024-03-22T12:02:42Z

0xEVom marked the issue as duplicate of #222

#3 - c4-judge

2024-03-31T16:06:07Z

jhsagd76 marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter