Skip to content
Audit finding Advanced

Hackers can deploy token with respective name as the stable one to impersonate the stable token

The price oracle identifies stable tokens by comparing their symbol strings rather than their contract addresses. An attacker who can deploy a token with a matching symbol could have it treated as a stable token, potentially manipulating prices.

Chom Follow

Originally disclosed on Code4rena

Submitted by Chom, also found by 0xSmartContract, cccz, Jeiwan, linmiaomiao, SinceJuly, and V_B

Hackers can deploy tokens with respective names as the stable ones to impersonate the stable token. Then hackers can get profit from the malicious price oracle.

Proof of Concept

        string memory symbol = ctoken.symbol();
        if (compareStrings(symbol, "cCANTO")) {
            underlying = address(wcanto);
            return getPriceNote(address(wcanto), false);
        } else {
            underlying = address(ICErc20(address(ctoken)).underlying()); // We are getting the price for a CErc20 lending market
        }
        //set price statically to 1 when the Comptroller is retrieving Price
        if (compareStrings(symbol, "cNOTE")) { // note in terms of note will always be 1
            return 1e18; // Stable coins supported by the lending market are instantiated by governance and their price will always be 1 note
        }
        else if (compareStrings(symbol, "cUSDT") && (msg.sender == Comptroller )) {
            uint decimals = erc20(underlying).decimals();
            return 1e18 * 1e18 / (10 ** decimals); //Scale Price as a mantissa to maintain precision in comptroller
        }
        else if (compareStrings(symbol, "cUSDC") && (msg.sender == Comptroller)) {
            uint decimals = erc20(underlying).decimals();
            return 1e18 * 1e18 / (10 ** decimals); //Scale Price as a mantissa to maintain precision in comptroller
        }

If hackers or malicious admin deploy a non-stable token but has “cNOTE”, “cUSDT”, or “cUSDC” as symbols, these tokens will act as a stable token while in fact, it isn’t.

Recommended Mitigation Steps

Use fixed address whitelisting instead for example if (address(ctoken) == cUSDC_address) ... where cUSDC_address is an immutable variable set on the constructor.

tkkwon1998 (Canto) disputed and commented:

The warden is saying that malicious parties could deploy a token with the same name to impersonate other tokens, but that these tokens will use the same pricing methodology as the token it is impersonating.

However, as this is an open EVM, anyone could deploy any token name with any underlying price method. I fail to see how this would be an issue, since everything is open source and users can see what they are doing.

0xean (judge) commented:

What is the benefit the sponsor is trying to achieve by comparing a non unique string compared to a unique address?

While everything is open source, it does seem like this is a pretty bad design choice when compared to the alternative solutions.

nivasan1 (Canto) commented:

@0xean, the design choice presented here prevents from having multiple dependencies in the initialization of the oracle. Furthermore, the tokens that are referenced here must be supported by governance, so to override the actual prices would require a >51% voting power. As such, even if the exploit exists it is essentially impossible. As such, we do not believe that this is a high / med -risk issue.

0xean (judge) decreased severity to Medium and commented:

Will downgrade to Medium as there are several external factors for this to become an issue.


The original report as published on Code4rena, by Chom. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 oracle uses non-unique token symbols to identify stablecoins instead of unique contract addresses.

Impact

An attacker could potentially get a fake token treated as a stablecoin, but the sponsor argues this requires governance support and a >51% vote, making it essentially impossible.

What the attacker needed

Ability to deploy a token with a matching symbol; governance support for the token; >51% voting power to override prices

The fix

The oracle should use fixed address whitelisting, comparing the token's contract address to an immutable known address instead of its 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.

A price oracle is a service that tells a smart contract how much a token is worth. This code decides a token is a stablecoin by looking at its name (symbol) instead of its unique contract address, so someone could create a fake token with the same name and trick the system.

More by Chom

View all

13 more disclosed reports, best first.

More from Canto

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.