Skip to content
Misconfiguration Audit finding Intermediate

Incorrect address is set as Wormhole Bridge, which breaks deploy

The Wormhole Bridge address in the deployment configuration was set to a testnet address that has no code on Base Mainnet. As a result, the TemporalGovernance contract could not execute proposals, leaving initial tokens stuck and requiring redeployment.

T1MOH Follow

Originally disclosed on Code4rena

Submitted by T1MOH

Wormhole Bridge will have incorrect address, which disables whole TemporalGovernance contract and therefore administration of Moonbeam. But during deployment markets are initialized with initial token amounts to prevent exploits, therefore TemporalGovernance must own this initial tokens. But because of incorrect bridge address TemporalGovernance can’t perform any action and these tokens are brick. Protocol needs redeployment and loses initial tokens.

Proof of Concept

To grab this report easily I divided it into 3 parts

  1. Why WORMHOLE_CORE set incorrectly

There is no config for Base Mainnet, however this comment states for used parameters: https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/test/proposals/mips/mip00.sol#L55-L61

    /// --------------------------------------------------------------------------------------------------///
    /// Chain Name	       Wormhole Chain ID   Network ID	Address                                      |///
    ///  Ethereum (Goerli)   	  2	                5	    0x706abc4E45D419950511e474C7B9Ed348A4a716c   |///
    ///  Ethereum (Sepolia)	  10002          11155111	    0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78   |///
    ///  Base	                 30    	        84531	    0xA31aa3FDb7aF7Db93d18DDA4e19F811342EDF780   |///
    ///  Moonbeam	             16	             1284 	    0xC8e2b0cD52Cf01b0Ce87d389Daa3d414d4cE29f3   |///
    /// --------------------------------------------------------------------------------------------------///

Why to treat this comment? Other parameters are correct except Base Network ID. But Base Network ID has reflection in code, described in #114. 0xA31aa3FDb7aF7Db93d18DDA4e19F811342EDF780 is address of Wormhole Token Bridge on Base Testnet according to docs and this address has no code in Base Mainnet.

  1. Why governor can’t execute proposals with incorrect address of Wormhole Bridge

Proposal execution will revert here because address wormholeBridge doesn’t contain code: https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/src/core/Governance/TemporalGovernor.sol#L344-L350

    function _executeProposal(bytes memory VAA, bool overrideDelay) private {
        // This call accepts single VAAs and headless VAAs
        (
            IWormhole.VM memory vm,
            bool valid,
            string memory reason
        ) = wormholeBridge.parseAndVerifyVM(VAA);
        ...
    }
  1. Impact of inability to execute proposals in TemporalGovernor.sol

Here you can see that deployer should provide initial amounts of tokens to initialize markets:

    /// @notice the deployer should have both USDC, WETH and any other assets that will be started as
    /// listed to be able to deploy on base. This allows the deployer to be able to initialize the
    /// markets with a balance to avoid exploits
    function deploy(Addresses addresses, address) public {
    ...
    }

And here governor approves underlying token to MToken and mints initial mTokens. It means that governor has tokens on balance.

    function build(Addresses addresses) public {
        /// Unitroller configuration
        _pushCrossChainAction(
            addresses.getAddress("UNITROLLER"),
            abi.encodeWithSignature("_acceptAdmin()"),
            "Temporal governor accepts admin on Unitroller"
        );

        ...

        /// set mint unpaused for all of the deployed MTokens
        unchecked {
            for (uint256 i = 0; i < cTokenConfigs.length; i++) {
                Configs.CTokenConfiguration memory config = cTokenConfigs[i];

                address cTokenAddress = addresses.getAddress(
                    config.addressesString
                );

                _pushCrossChainAction(
                    unitrollerAddress,
                    abi.encodeWithSignature(
                        "_setMintPaused(address,bool)",
                        cTokenAddress,
                        false
                    ),
                    "Unpause MToken market"
                );

                /// Approvals
                _pushCrossChainAction(
                    config.tokenAddress,
                    abi.encodeWithSignature(
                        "approve(address,uint256)",
                        cTokenAddress,
                        initialMintAmount
                    ),
                    "Approve underlying token to be spent by market"
                );

                /// Initialize markets
                _pushCrossChainAction(
                    cTokenAddress,
                    abi.encodeWithSignature("mint(uint256)", initialMintAmount),
                    "Initialize token market to prevent exploit"
                );

                ...
            }
        }

        ...
    }

To conclude, there is no way to return the tokens from the TemporalGovernor intended for market initialization

Recommended Mitigation Steps

Change WORMHOLE_CORE to 0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6 according to docs

ElliotFriedman (Moonwell) disputed and commented:

This is correct on base goerli, however we have not added base mainnet contract yet as it has not been deployed.

This can’t be a high or even medium risk bug because this is an issue in our testnet deploy configuration.

alcueca (Judge) decreased severity to Medium and commented:

Upon discussion with the sponsor about differences between this issue and #114, and actual impact of this issue, I’m instating Medium severity.


The original report as published on Code4rena, by T1MOH. 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

Impact

The TemporalGovernance contract is disabled, preventing administration of Moonbeam and leaving initial tokens stuck, which requires redeployment and loss of those tokens.

What the attacker needed

Deployment on Base Mainnet

The fix

The WORMHOLE_CORE address should be changed to the correct mainnet address according to the documentation.

How it was found

  1. The deployment configuration sets WORMHOLE_CORE to a testnet address.
  2. The TemporalGovernor contract tries to call parseAndVerifyVM on that address.
  3. The call reverts because the address has no code.
  4. Proposals cannot be executed, so the governor cannot perform actions like approving tokens or minting initial mTokens.
  5. The initial tokens held by the governor become stuck.

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 smart contract on a blockchain can only call another contract if that other contract actually exists at the given address. Here, the address used for the Wormhole Bridge was from a test network, so on the real network it was empty. This meant the governance contract could not do its job, and tokens sent to it were stuck.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by T1MOH

View all

11 more disclosed reports, best first.

More from Moonwell

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.