Excess eth is not refunded
The ArbitraryCallsProposal contract does not refund excess ETH sent by the user when the total value of the calls is less than msg.value. An attacker could cause the excess ETH to remain stuck in the contract.
Originally disclosed on Code4rena
Submitted by csanuragjain
The ArbitraryCallsProposal contract requires sender to provide eth(msg.value) for each call. Now if user has provided more eth than combined call.value then this excess eth is not refunded back to user.
Proof of Concept
- Observe the _executeArbitraryCalls function
function _executeArbitraryCalls(
IProposalExecutionEngine.ExecuteProposalParams memory params
)
internal
returns (bytes memory nextProgressData)
{
...
uint256 ethAvailable = msg.value;
for (uint256 i = 0; i < calls.length; ++i) {
// Execute an arbitrary call.
_executeSingleArbitraryCall(
i,
calls[i],
params.preciousTokens,
params.preciousTokenIds,
isUnanimous,
ethAvailable
);
// Update the amount of ETH available for the subsequent calls.
ethAvailable -= calls[i].value;
emit ArbitraryCallExecuted(params.proposalId, i, calls.length);
}
....
}
- As we can see user provided msg.value is deducted with each calls[i].value
- Assume user provided 5 amount as msg.value and made a single call with calls[0].value as 4
- This means after calls have been completed ethAvailable will become 5-4=1
- Ideally this 1 eth should be refunded back to user but there is no provision for same and the fund will remain in contract
Recommended Mitigation Steps
At the end of \_executeArbitraryCalls function, refund the remaining ethAvailable back to the user.
merklejerk (PartyDAO) confirmed and commented:
Will refund unused ETH at the end of executing arbitrary calls.
HardlyDifficult (judge) commented:
This is a form of leaking value - agree with Medium risk.
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
Likely the function does not refund the remaining ETH after executing all calls.
Impact
Excess ETH sent by the user remains stuck in the contract, causing a loss of funds for the user.
What the attacker needed
User sends more ETH than needed for calls
The fix
The function should refund the remaining ETH to the user after executing all calls; the project confirmed and later resolved this.
How it was found
- Observe the _executeArbitraryCalls function.
- User provides msg.value greater than the sum of calls[i].value.
- After all calls, ethAvailable is greater than zero.
- The excess ETH is not refunded and remains in the contract.
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.
When you send a proposal that makes several calls, you also send some ETH to pay for those calls. If you send more ETH than needed, the extra should be returned to you. Here, the extra ETH stays in the contract instead of being refunded.
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.