Proposals which intend to send native tokens to target addresses can’t be executed
The TemporalGovernor contract cannot receive native tokens, so any proposal that intends to send native tokens to a target address will revert when executed. An attacker could not exploit this directly, but legitimate proposals with value would fail.
hals Follow with immeas, 0xComfyCat and 10 others
Originally disclosed on Code4rena
Submitted by hals, also found by immeas, 0xComfyCat, RED-LOTUS-REACH, Kaysoft, Tendency, Vagner, 0xl51, sces60107, kodyvim, 0x70C9, T1MOH, and bin2chen
- In
TemporalGovernorcontract: any verified action approval (VAA)/proposal can be executed by anyone if it has been queued and passed the time delay. - But if the proposal is intended to send native tokens to the target address; it will revert since
TemporalGovernorcontract doesn’t have any balance, as there’s noreceive()or payable functions to receive the funds that will be sent to the proposal’s target address. - So any proposal with a value (decoded from
vm.payload) will not be executed since thetarget.call{value:value}(data)will revert.
Proof of Concept
- Code: Line 237-239
File: src/core/Governance/TemporalGovernor.sol
Line 237-239:
function executeProposal(bytes memory VAA) public whenNotPaused {
_executeProposal(VAA, false);
}
File: src/core/Governance/TemporalGovernor.sol
Line 400-402:
(bool success, bytes memory returnData) = target.call{value: value}(
data
);
- Foundry PoC:
- This test is copied from
testExecuteSucceedstest inTemporalGovernorExec.t.solfile,and modified to demonstrate the issue; where a proposal is set to send an EOA receiverAddress a value of 1 ether, but will revert due to lack of funds (follow the comments in the test):
function testProposalWithValueExecutionFails() public {
address receiverAddress = address(0x2);
address[] memory targets = new address[](1);
targets[0] = address(receiverAddress);
uint256[] memory values = new uint256[](1);
values[0] = 1 ether; // the proposal has a value of 1 eth to send it to the receiverAddress
bytes[] memory payloads = new bytes[](1);
payloads[0] = abi.encodeWithSignature("");
/// to be unbundled by the temporal governor
bytes memory payload = abi.encode(
address(governor),
targets,
values,
payloads
);
mockCore.setStorage(
true,
trustedChainid,
governor.addressToBytes(admin),
"reeeeeee",
payload
);
governor.queueProposal("");
bytes32 hash = keccak256(abi.encodePacked(""));
(bool executed, uint248 queueTime) = governor.queuedTransactions(hash);
assertEq(queueTime, block.timestamp);
assertFalse(executed);
//---executing the reposal
vm.warp(block.timestamp + proposalDelay);
//check that the balance of receiverAddress is zero before execution:
assertEq(receiverAddress.balance, 0);
// executeProposal function will revert due to lack of funds:
vm.expectRevert();
governor.executeProposal("");
assertFalse(executed); // the proposal wasn't executed
assertEq(receiverAddress.balance, 0); // the receiverAddress hasn't received any funds because the proposal execution has reverted due to lack of funds
}
- Test result:
$ forge test --match-test testProposalWithValueExecutionFails -vvv
Running 1 test for test/unit/TemporalGovernor/TemporalGovernorExec.t.sol:TemporalGovernorExecutionUnitTest
[PASS] testProposalWithValueExecutionFails() (gas: 458086)
Test result: ok. 1 passed; 0 failed; finished in 2.05ms
Tools Used
Foundry.
Recommended Mitigation Steps
Add receive() function to the TemporalGovernor contract; so that it can receive funds (native tokens) to be sent with proposals.
ElliotFriedman (Moonwell) confirmed and commented:
Good finding!
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 TemporalGovernor contract lacks a receive() or payable function to accept native tokens, so it cannot hold the balance needed to send value with proposals.
Impact
Proposals that intend to send native tokens cannot be executed, potentially blocking governance actions that require native token transfers.
What the attacker needed
A queued proposal with a value; proposal delay passed
The fix
Add a receive() function to the TemporalGovernor contract so it can receive native tokens to be sent with proposals.
How it was found
- Create a proposal that includes a target address and a value of 1 ether.
- Queue the proposal and wait for the time delay.
- Call executeProposal; the call reverts because the contract has no funds.
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 smart contract can only send native tokens (like Ether) if it holds some. The TemporalGovernor contract has no way to receive native tokens, so when it tries to send them as part of a proposal, the transaction fails. This means proposals that need to send native tokens cannot be executed.
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.