Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

The transfer function is using in _refundETH function

Summary

The primary goal of the _refundETH function is to facilitate the process of refunding ETH to a specified address.

Vulnerability Details

In the _refundETH function, the transfer method is used to move ETH from one address to another.

The transfer function imposes a fixed gas limit of 2300 gas for the execution of the fallback or receive function in the recipient contract. This can cause transactions to fail if the recipient contract needs more than 2300 gas to execute its logic.

Impact

If the recipient is a smart contract, the transaction will revert if the recipient contract requires more than 2300 gas to execute its logic. Consequently, the ETH funds will be blocked within the protocol.

Tools Used

manual review

Recommendations

Using the call method with proper error handling and gas forwarding can be a more flexible and secure way to send Ether.

(bool success, ) = _to.call{value: refundValue}("");
require(success, "Transfer failed");

The call method does not impose a fixed gas limit and allows for more flexibility in handling complex logic or interacting with other contracts

Updates

Lead Judging Commences

0xtimefliez Lead Judge 8 months ago
Submission Judgement Published
Validated
Assigned finding tags:

transfer instead of call

0xtimefliez Lead Judge 8 months ago
Submission Judgement Published
Validated
Assigned finding tags:

transfer instead of call

Support

FAQs

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