The executeMetaTransaction
function in NativeMetaTransaction.sol
lacks a robust fallback mechanism when using the call
function. If the call
fails, it reverts without a detailed error message, which could complicate debugging and obscure the reason for failure.
The executeMetaTransaction
function performs a low-level call to the contract itself using address(this).call
. While this is a common practice, the lack of specific error handling or fallback mechanisms in this call can lead to unclear reverts. When the call fails—due to reasons such as insufficient balance or excessive gas consumption—there is no specific error message provided, resulting in a general failure message that does not aid debugging.
This breaks the security guarantee of clear error handling, potentially reducing the ability to pinpoint or resolve the underlying issue in a production environment. A malicious or poorly constructed transaction could be propagated through the system, leading to a failure with no insight into the failure’s origin.
The call
function in executeMetaTransaction
does not handle errors beyond the success/failure check. If the call fails, the transaction reverts with a generic "Function call not successful" error, providing no information on the underlying reason, which could be due to:
Insufficient funds in the contract balance for a value transfer.
High gas consumption for a complex function.
Compatibility issues with the called function’s structure.
This lack of a detailed error message hinders developers and users in diagnosing the issue, especially in a production environment.
The impact is medium because, while it doesn’t directly lead to a security vulnerability, it reduces transparency and debugging ease. Detailed error messages are essential for contract reliability and user confidence, particularly in high-stakes applications involving financial transactions.
To reproduce this issue, consider a scenario where:
The contract’s balance is insufficient for a function requiring a value transfer.
A complex function is invoked with a high gas requirement, causing call
to fail due to gas limitations.
In either case, the transaction would revert with a generic error, lacking specific details on why it failed.
Example:
Add detailed error handling using returnData
to capture the specific revert reason, if available. This can be done by checking if returnData
contains an error message and emitting it if the call fails.
Modify the executeMetaTransaction
function as follows:
This change allows any error message from returnData
to be propagated back to the caller, making it easier to diagnose the underlying cause of the failure.
NativeMetaTransaction.sol
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.