Skip to content
Business logic Audit finding Intermediate

Lack of Success check of the Timelock executeT

The Timelock contract's executeTransaction function calls the target and emits a TransactionExecuted event without checking whether the call succeeded. If the call fails, the queued entry is still cleared and the event still fires, so the operations multisig must re-queue and wait out the delay again, and any dapp relying on the event is misled.

HX000 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

29006 - [SC - Medium] Lack of Success check of the Timelock executeT...

Submitted on Mar 4th 2024 at 16:26:05 UTC by @HX000 for Boost | Puffer Finance

Report ID: #29006

Report type: Smart Contract

Report severity: Medium

Target: https://etherscan.io/address/0x3C28B7c7Ba1A1f55c9Ce66b263B33B204f2126eA#code

Impacts:

  • It will impact the functionality of the protocol and reduces the efficiency of an important role
  • Contract fails to deliver promised returns, but doesn't lose value

Description

Brief/Intro

In Timelock.sol the function executeTransaction() internally calls _executeTransaction() and directly emites the event TransactionExecuted() without checking if the execution succeeded or not.

Vulnerability Details

Solidity
   function executeTransaction(address target, bytes calldata callData, uint256 operationId)
        external
        returns (bool success, bytes memory returnData)
    {
        // Community Multisig can do things without any delay
        if (msg.sender == COMMUNITY_MULTISIG) {
            return _executeTransaction(target, callData);
        }

        // Operations multisig needs to queue it and then execute after a delay
        if (msg.sender != OPERATIONS_MULTISIG) {
            revert Unauthorized();
        }

        bytes32 txHash = keccak256(abi.encode(target, callData, operationId));
        uint256 lockedUntil = queue[txHash];

        // slither-disable-next-line incorrect-equality
        if (lockedUntil == 0) {
            revert InvalidTransaction(txHash);
        }

        if (block.timestamp < lockedUntil) {
            revert Locked(txHash, lockedUntil);
        }

        queue[txHash] = 0;
        (success, returnData) = _executeTransaction(target, callData);

        emit TransactionExecuted(txHash, target, callData, operationId);

        return (success, returnData);
    }
Solidity
 function _executeTransaction(address target, bytes calldata callData) internal returns (bool, bytes memory) {
        // slither-disable-next-line arbitrary-send-eth
        return target.call(callData);
    }

in the code executeTransaction() first checks to make sure the tx is valid then - to avoid any reentrancy risk - resets its spot in the queue which is the same effect for the cancelTransaction() function, And finally TransactionExecuted() event is emitted. The problem is, if the transaction failed for any reason(e.g., due to an invalid target contract address, out-of-gas in the called contract, or a revert in the called contract) , the tx will not revert. it will only return "false" which is never handled AND the side-effects still happening i.e queue[txHash] = 0; and emit TransactionExecuted(txHash, target, callData, operationId);

Impact Details

This bug will result in 2 impacts: 1- Distrub functionality of the operations_multisig who can not re-execute the failed/ canceled transaction unless re-queue it and stand the delay time again. 2- The wrong-emitted event can lead to bad consequences for any dapp/smart contract depending on those events.

Proof of Concept

The original report as published on Immunefi, by HX000. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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 return value of the low-level call is captured but never checked, so the queue entry is cleared and the success event is emitted even when the call reverts or fails.

Impact

A failed queued operation is silently consumed and falsely reported as executed, forcing the operations multisig to re-queue and wait the delay again, and misleading any dapp that relies on the event.

What the attacker needed

Operations multisig queues a transaction; delay elapses; queued call fails on execution

The fix

The function should check the success flag and revert (or otherwise not clear the queue and not emit the event) when the call 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.

A timelock is a contract that makes privileged actions wait a set delay before they run. Here, when the delayed action is finally run, the contract ignores whether the action actually worked and still announces success and clears the queue slot. That means a failed action looks done, and the team has to queue it all over again and wait.

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.

More from Puffer Finance

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.