Proposal requiring native coin transfers cannot be executed
The InterchainProposalExecutor contract cannot execute proposals that require sending native coins because its execute function is not payable and the contract lacks a receive function. As a result, any proposal call with a value greater than zero will fail.
Jeiwan Follow with libratus, KrisApostolov and 8 others
Originally disclosed on Code4rena
Submitted by Jeiwan, also found by libratus, KrisApostolov, Toshii, nobody2018, immeas, qpzm, Emmanuel (1, 2), Viktor_Cortess, 0xkazim, UniversalCrypto, and T1MOH
Lines of code
Proposals that require sending native coins in at least one of their calls cannot be executed.
Proof of Concept
The InterchainProposalExecutor._execute executes cross-chain governance proposals. The function extracts the list of calls to make under the proposal and calls _executeProposal. _executeProposal, in its turn, makes distinct calls and sends native coins along with each call as specified by the call.value argument:
(bool success, bytes memory result) = call.target.call{ value: call.value }(call.callData);
However, InterchainProposalExecutor._execute is called from a non-payable function, AxelarExecutable.execute, and thus native coins cannot be passed in the call. As a result, proposal calls that have the value argument greater than 0 cannot be executed.
Sending native funds to the contract in advance cannot be a solution because such funds can be stolen by back-running and executing a proposal that would consume them.
Recommended Mitigation Steps
Consider implementing an alternative AxelarExecutable contract (i.e. AxelarExecutablePayable) that has the execute function payable and consider inheriting in InterchainProposalExecutor from this alternative implementation, not from AxelarExecutable.
Assessed type
Payable
deanamiel (Axelar) disputed and commented:
The intention is for the contract that executes the proposal to have been already funded with native value. Native value is not meant to be sent with the call to
AxelarExecutable.execute().
berndartmueller (judge) commented:
The
InterchainProposalExecutorcontract, in line 20, states that this contract is abstract. The only derived contract in the repository is theTestProposalExecutorintended for testing purposes. @deanamiel - can you show the concrete implementation for such a derived contract that is going to be deployed?Given the code in scope, there would not be a
receivefunction to be able to fund the contract with native tokens. This would render this submission valid.
So it would be the contract that inherits
AxelarExecutablethat would need to be funded with native value for proposal execution. If we look atInterchainGovernanceas an example, this contract does contain a receive function here. Does this answer your question?
berndartmueller (judge) commented:
@deanamiel - the issue is that the
InterchainProposalExecutorcontract can not be funded with native funds, but attempts to execute proposals (target contracts) that potentially require native funds (see L76).I’m inclined to leave this submission as medium severity, as it does not allow using the
InterchainProposalExecutorcontract in conjunction with proposals that require native funds.
milapsheth (Axelar) commented:
We acknowledge the severity. The solution is to add a receive function as mentioned in #344, since the design expects to fund tokens to the contract and then execute. This funding
+execution can be done within a contract atomically if there’s a concern of another proposal stealing tokens.
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
Proposals that require native coin transfers cannot be executed, limiting the contract's functionality; the judge rated this medium severity.
What the attacker needed
A proposal that sends native coins; the contract must be deployed
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.
This is a smart contract that runs governance proposals from another blockchain. Some proposals need to send the blockchain's native money (like Ether) along with a function call. The contract has no way to receive that money, so those proposals simply fail.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.