Tokens that revert of zero value transfers can cause reverts on liquidation
The contract transfers tokens without checking if the amount is zero, which can cause transactions to revert for tokens that disallow zero-value transfers. This can block liquidations and leave the share value incorrectly high.
Source: https://github.com/sherlock-audit/2024-11-teller-finance-update-judging/issues/51
Found by
hash
Summary
Tokens that revert of zero value transfers can cause reverts on liquidation
Root Cause
In the readme the team has mentioned that they would like to know if any wierd token breaks their contract pools
In multiple places token amount which can become zero is transferred without checking the value is zero. This will cause these transactions to revert https://github.com/sherlock-audit/2024-11-teller-finance-update/blob/0c8535728f97d37a4052d2a25909d28db886a422/teller-protocol-v2-audit-2024/packages/contracts/contracts/LenderCommitmentForwarder/extensions/LenderCommitmentGroup/LenderCommitmentGroup_Smart.sol#L699-L727
IERC20(principalToken).safeTransferFrom(
msg.sender,
address(this),
amountDue + tokensToTakeFromSender - liquidationProtocolFee
);
address protocolFeeRecipient = ITellerV2(address(TELLER_V2)).getProtocolFeeRecipient();
IERC20(principalToken).safeTransferFrom(
msg.sender,
address(protocolFeeRecipient),
liquidationProtocolFee
);
totalPrincipalTokensRepaid += amountDue;
tokenDifferenceFromLiquidations += int256(tokensToTakeFromSender - liquidationProtocolFee );
} else {
uint256 tokensToGiveToSender = abs(minAmountDifference);
IERC20(principalToken).safeTransferFrom(
msg.sender,
address(this),
amountDue - tokensToGiveToSender
);
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
In case liquidation reverts (due to tokensToGiveToSender == -amountDue), the tokenDifferenceFromLiquidations won't be updated which will cause the value of the shares to be incorrectly high (because in reality the auction is settling at 0 price)
PoC
No response
Mitigation
Check if amount is non-zero before transferring
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/82
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 contract does not check for zero transfer amounts before calling safeTransferFrom, which reverts for tokens that disallow zero-value transfers.
Impact
Liquidation could revert, preventing the update of tokenDifferenceFromLiquidations and causing share value to be incorrectly high.
What the attacker needed
Tokens that revert on zero-value transfers
The fix
The protocol team fixed this issue by checking if the amount is non-zero before transferring.
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 refuse to transfer zero amounts, which is unusual but allowed. The contract tries to transfer zero tokens during liquidation, so the whole liquidation fails. This leaves the system thinking the loan is still valuable when it should be settled at zero.
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.