Skip to content
Access control Audit finding Intermediate

CollateralManager#commitCollateral can be called by anyone

The commitCollateral function in CollateralManager lacked access control, allowing anyone to add collateral to any bid. An attacker could front-run a lender and add a malicious token that, once paused, would block liquidations and loan repayment, enabling ransom of locked funds.

0x52 Follow with 0xbepresent, 8olidity and 26 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-03-teller-judging/issues/169

Found by

0x52, 0xbepresent, 8olidity, BAHOZ, HonorLt, Inspex, J4de, MiloTruck, PawelK, Ruhum, __141345__, cccz, cducrest-brainbot, chaduke, ctf_sec, duc, evmboi32, giovannidisiena, immeas, jpserrat, juancito, mahdikarimi, nobody2018, shaka, sinarette, ubl4nk, whoismatthewmc1, xAlismx, yshhjain

Summary

CollateralManager#commitCollateral has no access control allowing users to freely add malicious tokens to any bid

Vulnerability Detail

CollateralManager.sol#L117-L130

function commitCollateral(
    uint256 _bidId,
    Collateral[] calldata _collateralInfo
) public returns (bool validation_) {
    address borrower = tellerV2.getLoanBorrower(_bidId);
    (validation_, ) = checkBalances(borrower, _collateralInfo); <- @audit-issue no access control

    if (validation_) {
        for (uint256 i; i < _collateralInfo.length; i++) {
            Collateral memory info = _collateralInfo[i];
            _commitCollateral(_bidId, info);
        }
    }
}

CollateralManager#commitCollateral has no access control and can be called by anyone on any bidID. This allows an attacker to front-run lenders and add malicious tokens to a loan right before it is filled.

  1. A malicious user creates a malicious token that can be transferred once before being paused and returns uint256.max for balanceOf
  2. User A creates a loan for 10e18 ETH against 50,000e6 USDC at 10% APR
  3. User B decides to fill this loan and calls TellerV2#lenderAcceptBid
  4. The malicious user sees this and front-runs with a CollateralManager#commitCollateral call adding the malicious token
  5. Malicious token is now paused breaking both liquidations and fully paying off the loan
  6. Malicious user leverages this to ransom the locked tokens, unpausing when it is paid

Impact

User can add malicious collateral calls to any bid they wish

Code Snippet

CollateralManager.sol#L117-L130

CollateralManager.sol#L138-L147

Tool used

Manual Review

Recommendation

Cause CollateralManager#commitCollateral to revert if called by anyone other than the borrower, their approved forwarder or TellerV2

Discussion

ethereumdegen

Thank you to the many many auditors who discovered this vulnerability. Will fix.

ethereumdegen

Github PR : fix/sherlock/169

IAm0x52

PR: #98

IAm0x52

Fix looks good. commitCollateral can now only be called by TellerV2

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 commitCollateral function did not check who was calling it, so any address could add collateral to any bid.

Impact

An attacker could add malicious collateral to any bid, potentially blocking liquidations and repayment, and ransom the locked tokens.

What the attacker needed

Attacker can create a malicious token; attacker can front-run a lender

The fix

The function was fixed to revert if called by anyone other than the borrower, their approved forwarder, or TellerV2.

How it was found

  1. Attacker creates a malicious token that can be transferred once, then paused, and returns a huge balance.
  2. User A creates a loan asking for 10 ETH against 50,000 USDC at 10% APR.
  3. User B decides to fill the loan and calls lenderAcceptBid.
  4. Attacker front-runs by calling commitCollateral to add the malicious token to the bid.
  5. The malicious token is paused, breaking liquidations and full repayment.
  6. Attacker demands ransom to unpause the token and release the locked funds.

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.

In a lending system, collateral is what you promise to give if you don't repay. The function that records collateral could be called by anyone, not just the borrower. So an attacker could sneak in a fake token as collateral, then make that token stop working, trapping the lender's money.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by 0x52

View all

211 more disclosed reports, best first.

More from Teller

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.