Missing Error Check in TRANSFER_NATIVE Command
The TRANSFER_NATIVE command in the Dispatcher contract performs a low-level Ether transfer without checking the success flag. An attacker could force the transfer to fail by using a contract that reverts on receiving Ether, leaving the system in an inconsistent state.
- Disclosed after under an hour
#43380 [SC-Low] Missing Error Check in TRANSFER_NATIVE Command
Submitted on Apr 5th 2025 at 06:56:40 UTC by @Paludo0x for Audit Comp | Spectra Finance
- Report ID: #43380
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/Spectra-Audit-Competition/blob/main/src/router/Dispatcher.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Vulnerability Details
In the TRANSFER_NATIVE command branch, the contract decodes the recipient and amount, then performs a native Ether transfer using the low-level call without checking the returned success flag. This can lead to silent failures in transferring funds.
The low-level call to transfer native Ether (call{value: amount}) does not verify the return value (success). In Solidity, the call function returns a boolean indicating whether the call succeeded. Not checking this value can allow a situation in which the call fails (for example, if the recipient is a contract that reverts on receiving Ether) while the execution of the function continues normally.
Impact Details
If the transfer fails, the contract does not revert the transaction, leaving the system in an inconsistent state or causing funds not to be transferred as expected.
An attacker might deliberately force transfers to fail by using a contract with a fallback function that always reverts.
Proof of Concept
The code snippet is as follows:
} else if (command == Commands.TRANSFER_NATIVE) {
(address recipient, uint256 amount) = abi.decode(_inputs, (address, uint256));
(bool success, ) = payable(recipient).call{value: amount}("");
}
To mitigate this issue, it is important to check the return value of the call and revert the transaction if the transfer fails. The code should be modified as follows:
} else if (command == Commands.TRANSFER_NATIVE) {
(address recipient, uint256 amount) = abi.decode(_inputs, (address, uint256));
(bool success, ) = payable(recipient).call{value: amount}("");
require(success, "Native transfer failed");
}
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 low-level call's boolean return value is not checked, so a failed Ether transfer does not revert the transaction.
Impact
If the transfer fails, the contract does not revert, potentially leaving the system in an inconsistent state or causing funds not to be transferred as expected; an attacker could deliberately force transfers to fail by using a contract with a reverting fallback.
What the attacker needed
Attacker controls recipient contract; recipient contract reverts on Ether receipt
The fix
The code should be modified to check the return value of the call and revert the transaction if the transfer fails.
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 a smart contract sends Ether to another address, it uses a low-level call that returns a true or false value indicating success. This code ignores that value, so if the transfer fails (for example, because the recipient is a contract that rejects payments), the function continues as if nothing went wrong. That can leave the contract's internal state out of sync with reality.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.