Possible emission of wrong data in cancelTransa
The timelock contract's cancelTransaction function sets the queued flag for a transaction hash to false without checking that the hash was actually queued. If the admin supplies incorrect inputs, the call emits a cancellation event for a transaction that was never queued while leaving the real queued transaction untouched.
- Disclosed after under an hour
26527 - [SC - Insight] Possible emission of wrong data in cancelTransa...
Submitted on Dec 4th 2023 at 14:22:36 UTC by @Obin for Boost | DeGate
Report ID: #26527
Report type: Smart Contract
Report severity: Insight
Target: https://etherscan.io/address/0xf2991507952d9594e71a44a54fb19f3109d213a5#code
Impacts:
- Contract can wrongly emit cancellation of not-previously-queued Tx
Description
Bug Description
The cancelTransaction() only sets the hash of the inputs to false. this implementation is sub-optimal and buggy as contract doesn't check if inputed data is correct.
Impact
In situation of input error, this will lead to:
- Not actually deleting Tx as intended
- Wrongly publishing / emitting a false data to have been cancelled.
Recommendation
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
+ require(queuedTransactions[txHash], "Timelock::cancelTransaction:Incorrect input or not queued");
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
Reference
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 cancelTransaction function lacks a check that the computed transaction hash is present in the queuedTransactions mapping before setting it to false and emitting the cancellation event.
Impact
With incorrect input, the intended transaction is not actually cancelled and the contract wrongly emits a cancellation event for a transaction that was never queued; the text does not claim any further exploitation.
What the attacker needed
Admin privileges on the timelock; admin supplies incorrect transaction details
The fix
The function should require that the computed hash is already marked as queued before clearing it and emitting the event.
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 timelock contract is a smart contract that delays actions so an admin can review or cancel them before they run. To cancel something, the contract builds a fingerprint (hash) from the details of the action and marks that fingerprint as cancelled. Here it marks the fingerprint as cancelled without first checking that the action was ever scheduled, so a typo in the details produces a cancellation notice for something that never existed.
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.