Project

One World
NFTDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

Native Meta Transactions May Fail Due to Missing Fallback Functions, Exposing the Protocol to DoS Vulnerabilities

Summary

The NativeMetaTransaction.sol contract includes a function called executeMetaTransaction for executing meta-transactions. This function includes a callback to the contract itself, passing some data and value. However, the contract lacks both a receive and fallback function, which are necessary for handling certain types of calls. This oversight introduces potential risks, including denial-of-service (DoS) attacks.

Vulnerability Details

In the NativeMetaTransaction.sol contract:

...
// No receive or fallback functions implemented
...
function executeMetaTransaction(
address userAddress,
bytes memory functionSignature,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) public payable returns (bytes memory) {
MetaTransaction memory metaTx =
MetaTransaction({nonce: nonces[userAddress], from: userAddress, functionSignature: functionSignature});
require(verify(userAddress, metaTx, sigR, sigS, sigV), "Signer and signature do not match");
// Increment nonce to prevent replay attacks
nonces[userAddress] = nonces[userAddress] + 1;
emit MetaTransactionExecuted(userAddress, msg.sender, functionSignature, hashMetaTransaction(metaTx));
// Append userAddress and relayer address at the end for extraction from the call context
// @note: This contract lacks receive and fallback functions
(bool success, bytes memory returnData) =
address(this).call{value: msg.value}(abi.encodePacked(functionSignature, userAddress));
require(success, "Function call failed");
return returnData;
}
...

Impact

The absence of receive and fallback functions in the contract exposes it to several risks:

  • Loss of Funds: Without a receive or fallback function, the contract cannot accept Ether directly. Any attempt to send Ether to this contract will result in a failed transaction, causing a loss of funds. This can have significant consequences, especially in scenarios where contract interactions are expected to include Ether transfers.

  • Limited Functionality: The inability to handle incoming Ether restricts the contract's interoperability with other contracts or users that may need to send Ether to it. This limitation hinders the contract’s utility and could break critical workflows.

  • Security Risks: While the lack of a fallback function can mitigate certain attack vectors (such as unexpected Ether transfers), it also limits the contract’s ability to defend against others. For instance, without a custom fallback function, the contract cannot reject or manage unwanted Ether transfers, leaving it susceptible to certain DoS scenarios.

Tools Used

Manual Code Review

Recommendations

To mitigate the risks associated with the missing fallback functionality, it is strongly recommended to implement both a receive function and a fallback function in the contract. These functions are essential for ensuring the contract can properly handle incoming Ether and maintain expected functionality in various scenarios.

Updates

Lead Judging Commences

0xbrivan2 Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!