Skip to content
Business logic Audit finding Intermediate

Unhandled Failure of _executeTransaction Call i

The executeTransaction function in Timelock.sol calls _executeTransaction, a low-level call, but does not check the returned success boolean. If the call fails, the function still emits a TransactionExecuted event and returns false, which could mislead users into thinking the transaction succeeded.

ihtishamsudo Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

28688 - [SC - Insight] Unhandled Failure of _executeTransaction Call i...

Submitted on Feb 24th 2024 at 00:15:20 UTC by @ihtishamsudo for Boost | Puffer Finance

Report ID: #28688

Report type: Smart Contract

Report severity: Insight

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

Impacts:

  • Contract fails to deliver promised returns, but doesn't lose value

Description

Brief/Intro

The executeTransaction function in Timelock.sol does not handle the case where _executeTransaction call fails because bool only does not revert but returns true or false

Vulnerability Details

When a transaction is executed via executeTransaction the _executeTransaction is called. This _executeTransaction function is a low-level call that forward call with payload to another contract or address. The problem is that if this call fails if doesn't throw any exception, but instead it returns false as a success value.

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

However, calling function executeTransaction doesn't handle the failure case. the TransactionExecuted event is emitted regardless of the success of the _executeTransaction call.

Impact Details

If the _executeTransaction call fails, it's likely that something went wrong with the transaction. However, the executeTransaction function would still emit the TransactionExecuted event and return false and an empty bytes array. This could lead to a false sense of successful transaction execution. In a worst-case scenario, this could result in loss of funds or incorrect state changes if actions are taken based on the incorrect assumption that the transaction was successful.

Mitigation

To handle the failure case, you could add a condition to check the success value and revert the transaction if the call failed

Diff
function executeTransaction(address target, bytes calldata callData, uint256 operationId)
        external
        returns (bool success, bytes memory returnData)
    {
       Code....

        queue[txHash] = 0;
        (success, returnData) = _executeTransaction(target, callData); 
+      if (!success) {
+    revert ("Transaction Failed");
+   }        
        emit TransactionExecuted(txHash, target, callData, operationId);

        return (success, returnData);
    }

References

Timelock.executeTransaction

https://docs.soliditylang.org/en/v0.8.4/control-structures.html#error-handling-assert-require-revert-and-exceptions

Proof of Concept

N/A

The original report as published on Immunefi, by ihtishamsudo. 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 code does not check the boolean success value returned by the low-level call and therefore does not revert on failure.

Impact

If the call fails, the contract still emits a success event and returns false, which could lead to a false sense of successful execution and potentially cause loss of funds or incorrect state changes if actions are taken based on that assumption.

What the attacker needed

None

The fix

The executeTransaction function should check the success value and revert if the call failed.

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 function that makes a call to another contract can fail silently if the caller does not check the result. Here, the timelock contract ignores the failure and still announces success, which could confuse users or other contracts that rely on that announcement.

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 by ihtishamsudo

View all

8 more disclosed reports, best first.

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.