Open code423n4 opened 2 years ago
CommandID and execution batch contents are determined via Tendermint consensus on Axelar network. Then batch is signed with their private keys and signatures are validated in the gateway. Users can't just submit commands to the execute()
method
The warden has shown how the code is not producing sufficient validation, because the code is for a Cosmos SDK contract, then callers will need to be trusted, for that reason no "arbitrary code execution" is possible
I will downgrade the report to QA and mark it as a valid "Lack of Checks" as the statement that CommandID doesn't necessarily represent the contents of the command is correct
However because of the permissioned nature of the system, no higher severity vulnerability was demonstrated via this report
Lines of code
https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/AxelarGateway.sol#L262 https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/AxelarGateway.sol#L295
Vulnerability details
Impact
commandID is used to prevent replicated trades, but commandID is not equal to command and command's parameters. It is not possible to prevent repeat trades by commandID.
So different commandIDs can be the same commands, the execute() function has great risk of allowing any user to execute the same trade without any restrictions.
Proof of Concept
I have written a replicated trade test by hardhat. The
cracker
calls four same commandsgetMintCommand(symbol, cracker.address, amount1)
in theexecutes()
, although the four commands have different commandIds. In fact, here is just an example, the cracker can execute any amount of the same commands as he wants.It is very dangerous for
execute()
which allows anyone to execute the same trade any times without restrictions.Tools Used
Hardhat
Recommended Mitigation Steps
Do not just check commandId, it is needed to check commands and params to prevent replicated trades.