Closed code423n4 closed 1 year ago
0xSorryNotSorry marked the issue as primary issue
deanamiel marked the issue as sponsor disputed
Only Axelar is meant to send nativeValue to the contract, and nothing can be executed without the Axelarnet governance process of voting and approval.
berndartmueller marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-07-axelar/blob/2f9b234bb8222d5fbe934beafede56bfb4522641/contracts/cgp/governance/InterchainGovernance.sol#L68-L79
Vulnerability details
Impact
In the InterChainGovernance.sol contract, the
executeProposal
function lacks an explicit check to ensure that themsg.value
provided with the function call is greater than or equal to thenativeValue
specified.After an extensive discussion with the sponsors, we came to an conclusion that
This potential oversight easily leads to possible front-running attacks, where an attacker can observe pending transactions and then scoop up the funds in the contract to execute their transactions ahead of honest users, see POC.
Proof of Concept
Take a look at InterchainGovernance.sol#L68-L79
Here is a hypothetical PoC scenario:
executeProposal()
function to forward their native value to a target contract.As seen the executeProposal() function, doesn't prevent this scenario, note that this issue is also compounded by the presence of the payable receive() function, making it possible for funds to be present in the contract:
Tool Used
Manual Audit
Recommended Mitigation Steps
As concluded by the discussion with the sponsors
So a fix should be to include an explicit check in the
executeProposal()
function to ensure that themsg.value
provided is equal to or exceeds thenativeValue
specified. This addition will prevent an attacker from front-running a legitimate call to the function with a higher gas fee. since they have to provide the amount of native value they would like to get to the target contract, code implemntation of the fix could be the below:Additionally I'd recommended to ensure a mechanism exists for securely withdrawing any funds sent to the contract via the payable fallback function, incase a user mistakenly sends them to the contracts, that's asides via complex executions, access to this withdrawal function should be strictly controlled, e.g., by allowing only the contract owner to perform the action.
Assessed type
Other