Skip to content
Business logic Audit finding Intermediate

When transferring tokens not in whitelist on Ethereum to Terra with CrossAnchorBridge.depositStable() , the funds may get frozen

The bridge contract's token whitelist checks were commented out, so users could deposit non-whitelisted tokens. Those tokens cannot be processed on the Terra side, so the funds may become frozen on the bridge or on Terra.

WatchPug Follow

Originally disclosed on Code4rena

Submitted by WatchPug, also found by BondiPestControl, broccoli, and defsec

In the current implementation of CrossAnchorBridge, all require that “Check that token is a whitelisted token” is commented out.

As a result, users may send transcations with the non-whitelisted tokens and as they can not be processd properly on the Terra side, the funds can be frozen on the brige contract or on the Terra side.

https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts/cross-chain-contracts/ethereum/CrossAnchorBridge.sol#L167-L175

function handleStableToken(
        address token,
        uint256 amount,
        uint8 opCode
    ) internal {
        // Check that `token` is a whitelisted stablecoin token.
        // require(whitelistedStableTokens[token]);
        handleToken(token, amount, opCode);
    }

https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts/cross-chain-contracts/ethereum/CrossAnchorBridge.sol#L250-L253

function redeemStable(address token, uint256 amount) external {
        // require(whitelistedAnchorStableTokens[token]);
        handleToken(token, amount, OP_CODE_REDEEM_STABLE);
    }

https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts/cross-chain-contracts/ethereum/CrossAnchorBridge.sol#L255-L258

function lockCollateral(address token, uint256 amount) external {
        // require(whitelistedCollateralTokens[token]);
        handleToken(token, amount, OP_CODE_LOCK_COLLATERAL);
    }

Recommended Mitigation Steps

Uncomment the whitelist codes.

bitn8 (Anchor) disagreed with severity

Alex the Entreprenerd (triage) commented:

Seems conditional, would recommend downgrading to Medium.

Albert Chon (judge) decreased severity to Medium


The original report as published on Code4rena, by WatchPug. 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 whitelist checks in the bridge's token-handling functions were commented out, so any token could be passed to the transfer logic.

Impact

Non-whitelisted tokens sent through the bridge may become frozen on the bridge contract or on the Terra side, as they cannot be processed properly there.

What the attacker needed

User sends a non-whitelisted token; bridge accepts the deposit

The fix

The whitelist checks should be re-enabled by uncommenting the require statements.

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 bridge moves tokens between two blockchains. This bridge was supposed to accept only a list of approved tokens, but the code that enforces that list was disabled. If someone sends an unapproved token, the other side may not know what to do with it, and the money can get stuck.

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 WatchPug

View all

197 more disclosed reports, best first.

More from Anchor contest

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.