Skip to content
DoS Audit finding Intermediate

Blacklisted creditor can block all repayment besides emergency closure

The fee transfer to the creditor during loan repayment reverts if the creditor is blacklisted for the hold token, preventing all repayments and forcing the borrower to default. Lenders can only recover funds after default and emergency closure.

0x52 Follow with ArmedGoose, Bauer and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-10-real-wagmi-judging/issues/83

Found by

0x52, ArmedGoose, Bauer, tsvetanovv

After liquidity is restored to the LP, accumulated fees are sent directly from the vault to the creditor. Some tokens, such as USDC and USDT, have blacklists the prevent users from sending or receiving tokens. If the creditor is blacklisted for the hold token then the fee transfer will always revert. This forces the borrower to defualt. LPs can recover their funds but only after the user has defaulted and they request emergency closure.

Vulnerability Detail

https://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/abstract/LiquidityManager.sol#L306-L315

        address creditor = underlyingPositionManager.ownerOf(loan.tokenId);
        // Increase liquidity and transfer liquidity owner reward
        _increaseLiquidity(cache.saleToken, cache.holdToken, loan, amount0, amount1);
        uint256 liquidityOwnerReward = FullMath.mulDiv(
            params.totalfeesOwed,
            cache.holdTokenDebt,
            params.totalBorrowedAmount
        ) / Constants.COLLATERAL_BALANCE_PRECISION;

        Vault(VAULT_ADDRESS).transferToken(cache.holdToken, creditor, liquidityOwnerReward);

The following code is executed for each loan when attempting to repay. Here we see that each creditor is directly transferred their tokens from the vault. If the creditor is blacklisted for holdToken, then the transfer will revert. This will cause all repayments to revert, preventing the user from ever repaying their loan and forcing them to default.

Impact

Borrowers with blacklisted creditors are forced to default

Code Snippet

LiquidityManager.sol#L223-L321

Tool used

Manual Review

Recommendation

Create an escrow to hold funds in the event that the creditor cannot receive their funds. Implement a try-catch block around the transfer to the creditor. If it fails then send the funds instead to an escrow account, allowing the creditor to claim their tokens later and for the transaction to complete.

Discussion

fann95

Fixed: https://github.com/RealWagmi/wagmi-leverage/commit/3c17a39e8a69a8912e6f87e84a19f55889353328

IAm0x52

Fix looks good. Fee collection has been made generic instead of specific to protocol fees. Creditor fees are now cached and collected.

The original report as published on Sherlock, by 0x52. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The contract directly transfers fees to the creditor without handling the case where the transfer fails due to a blacklist, causing the entire repayment to revert.

Impact

Borrowers with blacklisted creditors are forced to default, and lenders can only recover funds after emergency closure.

What the attacker needed

Creditor address is blacklisted for the hold token; borrower attempts to repay the loan

The fix

The fix makes fee collection generic and caches creditor fees for later collection, avoiding direct transfers that could revert.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Some tokens like USDC can block specific addresses from sending or receiving them. If the person who provided the loan is blocked, the system cannot send them their fees, so the repayment fails and the borrower is stuck. The borrower then has to default, which is bad for their credit.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0x52

View all

211 more disclosed reports, best first.

More from Real Wagmi #2

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.