QuickAccManager.sol#cancel() Wrong hashTx makes it impossible to cancel a scheduled transaction
The cancel function in QuickAccManager.sol computed the transaction hash without the final boolean parameter, so it never matched the hash stored when scheduling a transaction. As a result, users could not cancel a scheduled transaction.
Submitted by WatchPug, also found by gpersoon
In QuickAccManager.sol#cancel(), the hashTx to identify the transaction to be canceled is wrong. The last parameter is missing.
As a result, users will be unable to cancel a scheduled transaction.
function cancel(Identity identity, QuickAccount calldata acc, uint nonce, bytes calldata sig, Identity.Transaction[] calldata txns) external {
bytes32 accHash = keccak256(abi.encode(acc));
require(identity.privileges(address(this)) == accHash, 'WRONG_ACC_OR_NO_PRIV');
bytes32 hash = keccak256(abi.encode(CANCEL_PREFIX, address(this), block.chainid, accHash, nonce, txns, false));
address signer = SignatureValidator.recoverAddr(hash, sig);
require(signer == acc.one || signer == acc.two, 'INVALID_SIGNATURE');
// @NOTE: should we allow cancelling even when it's matured? probably not, otherwise there's a minor grief
// opportunity: someone wants to cancel post-maturity, and you front them with execScheduled
bytes32 hashTx = keccak256(abi.encode(address(this), block.chainid, accHash, nonce, txns));
require(scheduled[hashTx] != 0 && block.timestamp < scheduled[hashTx], 'TOO_LATE');
delete scheduled[hashTx];
emit LogCancelled(hashTx, accHash, signer, block.timestamp);
}
Recommendation
Change to:
bytes32 hashTx = keccak256(abi.encode(address(this), block.chainid, accHash, nonce, txns, false));
Ivshti (Ambire) confirmed and resolved:
Great find, resolved in https://github.com/AmbireTech/adex-protocol-eth/commit/5c5e6f0cb47e83793dafc08630577b93500c86ab
GalloDaSballo (judge) commented:
The warden has found that the method
cancelwas calculating the wronghashTx, this hash, used to verify which transaction to cancel, making it impossible to cancel a transaction.The sponsor has mitigated in a subsequent pr
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 hash used to look up the scheduled transaction omitted the final boolean argument that was included when the transaction was originally scheduled.
Impact
Users could not cancel any scheduled transaction, leaving them stuck until maturity.
What the attacker needed
A scheduled transaction exists
The fix
The hash calculation was fixed to include the missing boolean parameter, and the sponsor confirmed it was resolved.
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 lets users schedule transactions for later. Each scheduled transaction is stored under a unique fingerprint (hash). The cancel function calculated a different fingerprint because it left out one piece of data, so it could never find the scheduled transaction to delete it.
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.