Skip to content
Business logic Audit finding Intermediate

Lender group members can be prevented from burning their shares forever

The withdrawal delay for lender group members can be reset by anyone sending a zero-value transferFrom, because the token's afterTokenTransfer hook resets the member's prepared shares and timestamp. An attacker can repeatedly reset the countdown, preventing members from ever burning their shares and withdrawing their funds.

KupiaSec Follow with OpaBatyo

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-11-teller-finance-update-judging/issues/24

Found by

KupiaSec, OpaBatyo

Summary

Summary

Adversaries can constantly reset the withdrawal delay of lender group members by performing 0-value transferFrom transactions to invoke the afterTokenTransfer hook.

Description

Currently there is a delay on withdrawals to prevent sandwich attacks in lender group contracts. Members must invoke prepareSharesForBurn by stating how many shares they want to burn and start an internal countdown. Afterwards, members invoke burnSharesToWithdrawEarnings which checks whether the delay passed in burn

Solidity
    function burn(address _burner, uint256 _amount, uint256 withdrawDelayTimeSeconds) external onlyOwner {

        //require prepared 
        require(poolSharesPreparedToWithdrawForLender[_burner] >= _amount,"Shares not prepared for withdraw");
   @>   require(poolSharesPreparedTimestamp[_burner] <= block.timestamp - withdrawDelayTimeSeconds,"Shares not prepared for withdraw");
        

        //reset prepared   
        poolSharesPreparedToWithdrawForLender[_burner] = 0;
        poolSharesPreparedTimestamp[_burner] =  block.timestamp;
  


        _burn(_burner, _amount);
    }

This countdown is reset every time a member invokes a share transfer through the _afterTokenTransfer hook presumably to prevent users preparing shares in advance by transferring it between one another.

Solidity
     function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal override {

         //reset prepared   
        poolSharesPreparedToWithdrawForLender[from] = 0;
        poolSharesPreparedTimestamp[from] =  block.timestamp;


    }

Adversaries can perform 0-value transferFrom transactions which will always pass as there are no 0-value checks in OZ's version 4.8 ERC20.sol used by the protocol. Users will have their countdown constantly reset thus being prevented from withdrawing forever or until a bribe is paid.

Root Cause

  • OpenZeppelin's ERC20.transferFrom has no 0-value input validation
  • LenderCommitmentGroupShares._afterTokenTransfer does not perform 0-value input either.

Internal pre-conditions

Group members must have invoked prepareSharesForBurn

External pre-conditions

None

Attack Path

  1. Group member invokes prepareSharesForBurn starting the countdown
  2. Adversary invokes transferFrom(victim, to, 0) minutes before the cooldown expires
  3. Cooldown and shares are reset because _afterTokenTransfer was triggered
  4. Group member is forced to re-prepare their shares
  5. Attacker repeats this continuously or until a bribe is paid

Impact

Lender commit group members will have their funds permanently locked in the contract

PoC

No response

Mitigation

Rewrite the _afterTokenTransfer hook to be skipped in case of amount = 0

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/teller-protocol/teller-protocol-v2-audit-2024/pull/76

The original report as published on Sherlock, by KupiaSec. 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

Likely the _afterTokenTransfer hook resets the withdrawal preparation state on every transfer, including zero-value transfers, because neither the hook nor the underlying ERC20 transferFrom checks for zero amounts.

Impact

Lender group members could have their funds permanently locked in the contract because they can never complete the burn and withdrawal.

What the attacker needed

Victim has prepared shares for burn; attacker can send zero-value transferFrom

The fix

The _afterTokenTransfer hook should be skipped when the transfer amount is zero; the protocol team fixed this issue in a pull request.

How it was found

  1. Group member invokes prepareSharesForBurn to start the countdown.
  2. Adversary invokes transferFrom with zero amount from the victim shortly before the cooldown expires.
  3. The cooldown and prepared shares are reset because _afterTokenTransfer is triggered.
  4. The group member must re-prepare their shares, and the attacker repeats the zero-value transfer.

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 this smart contract, members who want to withdraw must first announce their intention and then wait a set time. The contract resets that waiting period whenever shares are transferred, even if the transfer amount is zero. An attacker can keep sending zero-value transfers to reset the timer, so the victim never gets to withdraw.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by KupiaSec

View all

28 more disclosed reports, best first.

More from Teller Lender Groups Update Audit

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.