Skip to content
DoS Audit finding Intermediate

`LenderCommitmentGroup_Smart.sol` cannot deploy pools with non-string symbol() ERC20s

The contract assumes that ERC20 tokens' symbol() function returns a string, but the ERC20 standard makes symbol() optional and some tokens (like MKR) return bytes32 instead. This causes pool creation to revert for such tokens, preventing the protocol from supporting them.

BoRonGod Follow with EgisSecurity and pkqs90

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-04-teller-finance-judging/issues/269

Found by

BoRonGod, EgisSecurity, pkqs90

Summary

In LenderCommitmentGroup_Smart.sol, when initializing, it needs to fetch the symbol() for the principalToken and collateralToken. However, it assumes the symbol() returns a string, which is actually OPTIONAL for ERC20 standards. This means it would fail to create pools for these ERC20s.

Vulnerability Detail

First, let's quote the EIP20 to show symbol() is optional:

symbol

Returns the symbol of the token. E.g. “HIX”.

OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.

function symbol() public view returns (string)

The most famous token that uses bytes32 instead of string as symbol() return value is MKR.

The contest README states that any tokens compatible with Uniswap V3 should be supported, which includes MKR: https://info.uniswap.org/#/tokens/0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2

We are allowing any standard token that would be compatible with Uniswap V3 to work with our codebase, just as was the case for the original audit of TellerV2.sol. The tokens are assumed to be able to work with Uniswap V3.

At last, let's see the code. _generateTokenNameAndSymbol assumes that both principalToken and collateralToken has a symbol() function that returns string, which is inaccurate. This would revert if we try to create a pool with MKR.

Solidity
    function _generateTokenNameAndSymbol(address principalToken, address collateralToken) 
    internal view 
    returns (string memory name, string memory symbol) {
        // Read the symbol of the principal token
>       string memory principalSymbol = ERC20(principalToken).symbol();
        
        // Read the symbol of the collateral token
>       string memory collateralSymbol = ERC20(collateralToken).symbol();
        
        // Combine the symbols to create the name
        name = string(abi.encodePacked("GroupShares-", principalSymbol, "-", collateralSymbol));
        
        // Combine the symbols to create the symbol
        symbol = string(abi.encodePacked("SHR-", principalSymbol, "-", collateralSymbol));
    }

Impact

LenderCommitmentGroup_Smart pools cannot be created for ERC20s that does not implement function symbol() public view returns (string).

Code Snippet

Tool used

Manual review

Recommendation

Consider using a try-catch, an example would be:

Solidity
    function computeSymbol(
        address token
    ) external view returns (string memory) {
        try IERC20Metadata(token).symbol() returns (string memory tokenSymbol) {
            return tokenSymbol;
        } catch {
            return "???";
        }
    }

Discussion

ethereumdegen

I dont think a try catch will work because if the token doesnt implement that fn at all , it will still revert. hm.

sherlock-admin2

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

sherlock-admin2

The Lead Senior Watson signed off on the fix.

The original report as published on Sherlock, by BoRonGod. 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 code calls ERC20(token).symbol() and assigns the result to a string variable, assuming the function exists and returns a string, but the ERC20 standard allows symbol() to be optional and some tokens return bytes32 instead.

Impact

Pools cannot be created for ERC20 tokens that do not implement symbol() returning a string, limiting the protocol's compatibility.

What the attacker needed

Token with non-string symbol(); token without symbol()

The fix

The issue was fixed by the protocol team, but the exact fix is not described in the text; a suggested approach is to use a try-catch to handle tokens with non-string symbol() or missing symbol().

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.

ERC20 tokens are a standard for cryptocurrencies on Ethereum. The standard says a token's symbol (like a ticker) is optional and can be returned in different formats. This code expects a specific format (a string) and crashes if a token uses a different one, so you can't create a pool with that token.

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 BoRonGod

View all

1 more disclosed report, best first.

More from Teller Finance

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.