Incorrect chainId of Base in deploy script will force redeployment
The deployment script used an incorrect chain ID for the Base network, mapping it to the wrong Wormhole chain ID. This would cause the deployment to be misconfigured and require redeployment.
Submitted by T1MOH
Incorrect chainId of Base in deploy parameters results in incorrect deploy and subsequent redeployment.
Proof of Concept
Contract ChainIds.sol is responsible for mapping chainId -> wormholeChainId which is used in contract Addresses to associate contract name with its address on specific chain. Addresses is the main contract which keeps track of all dependency addresses and passed into main deploy() and here addresses accessed via block.chainId:
https://github.com/code-423n4/2023-07-moonwell/blob/fced18035107a345c31c9a9497d0da09105df4df/test/proposals/mips/mip00.sol#L77
function deploy(Addresses addresses, address) public {
...
trustedSenders[0].chainId = chainIdToWormHoleId[block.chainid];
...
memory cTokenConfigs = getCTokenConfigurations(block.chainid);
}
Here you can see that Network ID of Base set to 84531. But actual network id is 8453 from Base docs.
contract ChainIds {
uint256 public constant baseChainId = 84531;
uint16 public constant baseWormholeChainId = 30; /// TODO update when actual base chain id is known
uint256 public constant baseGoerliChainId = 84531;
uint16 public constant baseGoerliWormholeChainId = 30;
...
constructor() {
...
chainIdToWormHoleId[baseChainId] = moonBeamWormholeChainId; /// base deployment is owned by moonbeam governance
...
}
}
Recommended Mitigation Steps
Change Base Network ID to 8453.
ElliotFriedman (Moonwell) confirmed
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 constant for Base's chain ID was set to 84531 instead of the correct 8453, and the Wormhole chain ID mapping was also incorrect.
What the attacker needed
Deployment script used
The fix
Change the Base network ID to 8453.
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 chain ID is a number that identifies a blockchain network. The script used the wrong number for Base, so the deployment would set up the wrong connections and have to be done again.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.