-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Lines of code
Vulnerability details
Vulnerability details
In AxelarRouter.sol
, we need to ensure the legitimacy of the execute()
method execution, mainly through two methods
axelarGateway.validateContractCall ()
to validate if thecommand
is approved or notonlyCentrifugeChainOrigin()
is used to validate thatsourceChain
sourceAddress
is legal.
Let's look at the implementation of onlyCentrifugeChainOrigin()
modifier onlyCentrifugeChainOrigin(string calldata sourceChain, string calldata sourceAddress) {
@> require(msg.sender == address(axelarGateway), "AxelarRouter/invalid-origin");
require(
keccak256(bytes(axelarCentrifugeChainId)) == keccak256(bytes(sourceChain)),
"AxelarRouter/invalid-source-chain"
);
require(
keccak256(bytes(axelarCentrifugeChainAddress)) == keccak256(bytes(sourceAddress)),
"AxelarRouter/invalid-source-address"
);
_;
}
The problem is that this restriction msg.sender == address(axelarGateway)
When we look at the official axelarGateway.sol
contract, it doesn't provide any call external contract 'sexecute()
method
so msg.sender
cannot be axelarGateway
, and the official example does not restrict msg.sender
the security of the command can be guaranteed by axelarGateway.validateContractCall()
, sourceChain
, sourceAddress
.
there is no need to restrict msg.sender
axelarGateway
code address
https://github.com/axelarnetwork/axelar-cgp-solidity/blob/main/contracts/AxelarGateway.sol
can't find anything that calls router.execute()
Impact
router.execute()
cannot be executed properly, resulting in commands from other chains not being executed, protocol not working properly
Recommended Mitigation
remove msg.sender
restriction
modifier onlyCentrifugeChainOrigin(string calldata sourceChain, string calldata sourceAddress) {
- require(msg.sender == address(axelarGateway), "AxelarRouter/invalid-origin");
require(
keccak256(bytes(axelarCentrifugeChainId)) == keccak256(bytes(sourceChain)),
"AxelarRouter/invalid-source-chain"
);
require(
keccak256(bytes(axelarCentrifugeChainAddress)) == keccak256(bytes(sourceAddress)),
"AxelarRouter/invalid-source-address"
);
_;
}
Assessed type
Context