Skip to content
Access control Audit finding Intermediate

Malicious user can abuse UpdateCommitment to create commitments for other users

The updateCommitment function checks that the caller is the original lender but does not verify that the new lender in the updated commitment is the same as the original. An attacker can create a commitment, update it to set a different lender, and then use malicious loan parameters to steal funds from that lender.

0x52 Follow with 0xbepresent, Bauer and 3 others

Originally disclosed on Sherlock

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

Found by

0x52, 0xbepresent, Bauer, J4de, dingo, immeas

Summary

UpdateCommitment checks that the original lender is msg.sender but never validates that the original lender == new lender. This allows malicious users to effectively create a commitment for another user, allowing them to drain funds from them.

Vulnerability Detail

LenderCommitmentForwarder.sol#L208-L224

function updateCommitment(
    uint256 _commitmentId,
    Commitment calldata _commitment
) public commitmentLender(_commitmentId) { <- @audit-info checks that lender is msg.sender
    require(
        _commitment.principalTokenAddress ==
            commitments[_commitmentId].principalTokenAddress,
        "Principal token address cannot be updated."
    );
    require(
        _commitment.marketId == commitments[_commitmentId].marketId,
        "Market Id cannot be updated."
    );

    commitments[_commitmentId] = _commitment; <- @audit-issue never checks _commitment.lender

    validateCommitment(commitments[_commitmentId]);

UpdateCommitment is intended to allow users to update their commitment but due to lack of verification of _commitment.lender, a malicious user create a commitment then update it to a new lender. By using bad loan parameters they can steal funds from the attacker user.

Impact

UpdateCommitment can be used to create a malicious commitment for another user and steal their funds

Code Snippet

LenderCommitmentForwarder.sol#L208-L233

Tool used

Manual Review

Recommendation

Check that the update lender is the same the original lender

Discussion

ethereumdegen

Thank you for this feedback. This is a high severity issue as it could be used to unexpectedly steal tokens that another use had previously approved to the contract. Will fix.

passabilities

https://github.com/teller-protocol/teller-protocol-v2/pull/67

IAm0x52

Fix looks good. _commitment.lender (updated lender) is now required to be msg.sender

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 updateCommitment function fails to validate that the new lender address in the updated commitment matches the original lender.

Impact

An attacker could steal tokens that another user had previously approved to the contract.

What the attacker needed

Attacker has a commitment; victim has approved tokens to the contract

The fix

The fix requires that the updated lender is the same as the original lender (msg.sender).

How it was found

  1. Create a commitment as the attacker.
  2. Call updateCommitment with a new commitment that sets a different lender address.
  3. Use malicious loan parameters to drain funds from the new lender.

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.

A smart contract lets lenders create 'commitments' that specify loan terms. The update function only checks that the person calling it is the original lender, but it does not check that the new lender in the updated data is still the same person. So an attacker can change the lender to someone else and then use bad loan terms to take that person's funds.

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.