Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Latest commit

 

History

History
93 lines (80 loc) · 6.14 KB

070.md

File metadata and controls

93 lines (80 loc) · 6.14 KB

HE1M

medium

Increasing the volume of bridging fraudulently

Summary

It is possible to increase the volume of bridging transaction significantly. It can be done by getting a flash loan of USDC (for example) and transfers this large amount between L1/L2 but in reality this large amount only is deposited in bridge contract on L1 and in the same transaction it is withdrawn to repay the flash loan. But, it seems that the user is bridging large amount between L1 and L2.

Vulnerability Detail

deposits[FakeL2Token][USDC] = 1_000_000 * 10 ** 6;

https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/universal/StandardBridge.sol#L413

deposits[USDC][FakeL2Token] = 1_000_000 * 10 ** 6;

https://github.com/sherlock-audit/2023-01-optimism/blob/main/optimism/packages/contracts-bedrock/contracts/universal/StandardBridge.sol#L415

Please note that the same scenario can also happen for ERC721 bridging.

Impact

  • It may have some impact on the Bots (defenders, like what implemented by OpenZeppelin) who monitors the deposit and withdrawal amount continuously. For example, if a Bot is monitoring the Optimism bridges to see if some suspicious large amount of funds are being transferred between L1/L2 to do some action (like setting off an alarm or pausing some critical functions), it will lead to a false alarm.
  • Moreover, Bob can increase his volume of transaction with optimism fraudulently, and can increase his chance of getting airdrop (if any) significantly.

Code Snippet

Tool used

Manual Review

Recommendation

Maybe one solution is to check that at least one of the tokens (remote or local) be Optimism Mintable ERC20 on one of the chains. For example, Since USDC is not Optimism Mintable ERC20, then FakeL2Token must be Optimism Mintable ERC20 on L2.

function finalizeBridgeERC20(
        address _localToken,
        address _remoteToken,
        address _from,
        address _to,
        uint256 _amount,
        bytes calldata _extraData
    ) public onlyOtherBridge {
        if (_isOptimismMintableERC20(_localToken)) {
            require(
                _isCorrectTokenPair(_localToken, _remoteToken),
                "StandardBridge: wrong remote token for Optimism Mintable ERC20 local token"
            );

            OptimismMintableERC20(_localToken).mint(_to, _amount);
        } else {
            require(_isOptimismMintableERC20OnRemoteChain(_remoteToken), "at least one token must be Optimism Mintable ERC20");
            deposits[_localToken][_remoteToken] = deposits[_localToken][_remoteToken] - _amount;
            IERC20(_localToken).safeTransfer(_to, _amount);
        }

        emit ERC20BridgeFinalized(_localToken, _remoteToken, _from, _to, _amount, _extraData);
    }