A recalled ERC20 bridge transfer can lock tokens in the bridge
A recalled bridge transfer of USDC can fail to mint tokens on the source chain if the USDC minter allowance is exhausted, leaving the bridged tokens and ETH locked. An attacker could cause this by bridging USDC when the allowance is near its limit, though the lock may be temporary if the allowance is later increased.
Submitted by monrel, also found by monrel
A recalling ERC20 bridge transfer can lock funds in the bridge if the call to mint tokens fail on the source chain. Depending on the Native token logic this could either be a permanent lock or a lock of an unknown period of time.
Example of how this can happen with the provided USDCAdapter:
USDC limits the amount of USDC that can be minted on each chain by giving each minter a minting allowance. If the minting allowance is reach minting will revert. If this happens in a recalled message the tokens together with the ETH value is locked.
Proof of Concept
USDC limits the amount of USDC that can be minted on each chain by giving each minter a minting allowance.
If _amount <= mintingAllowedAmount is reached for the USDCAdapter tokens can not be minted but since this is a recalled message the funds are stuck.
Both onMessageIncovation() and onMessageRecalled() call _transferToken() to either mint or release tokens.
function _transferTokens(
CanonicalERC20 memory _ctoken,
address _to,
uint256 _amount
)
private
returns (address token_)
{
if (_ctoken.chainId == block.chainid) {
token_ = _ctoken.addr;
IERC20(token_).safeTransfer(_to, _amount);
} else {
token_ = _getOrDeployBridgedToken(_ctoken);
IBridgedERC20(token_).mint(_to, _amount);
}
}
A recalled message to bridge USDC L1->L2 will revert when we attempt to mint through the USDCAdapter
function _mintToken(address _account, uint256 _amount) internal override {
usdc.mint(_account, _amount);
On the following condition in the native USDC contract
require(
_amount <= mintingAllowedAmount,
"FiatToken: mint amount exceeds minterAllowance"
);
Course of events that ends in locked funds:
- User bridges USDC from L2->L1
- The message is recalled from L1
- The USDCAdapter has reached the
mintingAllowedAmount - The recalled message is stuck because minting reverts. The USDC and ETH passed in are both locked.
Tools Used
Foundry, VScode
Recommended Mitigation Steps
Add new functionality in the vault that allows users to send a new message to the destination chain again with new message data if onMessageRecalls() can not mint tokens. We give users the ability to redeem for canonical tokens instead of being stuck.
dantaik (Taiko) acknowledged and commented:
Thank you for your feedback. In your example, if the user cannot mint tokens in USDCAdapter by using
recallMessage, the user can wait and callrecallMessageagain. That’s why recallMessage is retriable.There is no perfect solution here, and I personally don’t want to make the bridge too complicated by introducing this re-send-another-message feature.
Adding a warning on the bridge UI to show a warning message might be a good solution, something like “USDC on Taiko has reached 95% of its max supply cap, bridging USDC to Taiko may end up your fund becoming unavailable for some time until others bridge USDC away from Taiko”.
The sponsor comments simply show their isn’t a great solution to the problem, it still represents a loss of user funds (if it goes on forever) or a denial of service and a risk that users should be aware of.
@dontonka / @adaki2004 (Taiko) any last comments here?
We are OK with med, no issue. Please proceed accordinlgy - as we dont have:
- the perfect solution to the problem
- the intention to fix it ATM - since we wont be using any native tokens anytime soon.
But please proceed the way which is suitable for the wardens better, we appreciate their efforts. (So not questioning the severity)
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 bridge's recall function attempts to mint tokens without handling the case where the token's minting allowance is exhausted, causing a revert and locking funds.
Impact
The bridged USDC and ETH could be locked permanently or for an unknown period, depending on whether the minting allowance is later increased.
What the attacker needed
USDC minting allowance on destination chain is exhausted; User bridges USDC and the message is recalled
The fix
The bridge should allow users to retry the recall or redeem canonical tokens instead of being stuck, and the UI should warn when the minting allowance is near its limit.
How it was found
- User bridges USDC from L2 to L1.
- The message is recalled from L1.
- The USDCAdapter has reached the mintingAllowedAmount.
- The recalled message is stuck because minting reverts, locking the USDC and ETH.
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.
When you bridge tokens, the bridge sometimes needs to create new tokens on the other side. If that creation fails, the bridge may not be able to return your original tokens, so they get stuck. This report shows that a specific token (USDC) has a limit on how many new tokens can be created, and if that limit is hit during a recall, your funds are locked.
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.