Skip to content
DoS Audit finding Intermediate

Fixed Amount of Gas Sent in Call May Be Insufficient

The contract's ETH transfer function uses a fixed gas amount of 30,000, which may be insufficient for a receiving contract's receive() function, preventing the recipient from receiving funds. An attacker could exploit this by deploying a contract that requires more gas, causing the transfer to fail and funds to be stuck.

kirk-baird Follow

Originally disclosed on Code4rena

Submitted by kirk-baird

Impact

The function attemptETHTransfer() makes a call with a fixed amount of gas, 30,000. If the receiver is a contract this may be insufficient to process the receive() function. As a result the user would be unable to receive funds from this function.

Proof of Concept

    function attemptETHTransfer(address to, uint256 value)
        private
        returns (bool)
    {
        // Here increase the gas limit a reasonable amount above the default, and try
        // to send ETH to the recipient.
        // NOTE: This might allow the recipient to attempt a limited reentrancy attack.
        (bool success, ) = to.call{value: value, gas: 30000}("");
        return success;
    }

Recommended Mitigation Steps

Consider removing the gas field to use the default amount and protect from reentrancy by using reentrancy guards and the check-effects-interaction pattern. Note this pattern is already applied correctly.

sofianeOuafir (Joyn) confirmed and commented:

This is an issue we want to investigate and fix if needed

deluca-mike (judge) commented:

Consider that changes to the network could result in re-pricing of opcodes which can make:

  • opcodes less expensive, which would re-introduce the opportunity for re-entrancy that the old costs prevented
  • opcodes more expensive, which would break this function altogether

If attemptETHTransfer is the only way to extract ETH stored in this contract, then an Ethereum upgrade could result in lost funds. Luckily, as long as access lists remain in the protocol, a route would exist to recover and/or restore functionality.


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

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 contract hardcodes a gas limit of 30,000 for external calls, which may be insufficient for complex receiver logic.

Impact

Users may be unable to receive funds if the receiver contract requires more than 30,000 gas, and future network changes could worsen the issue.

What the attacker needed

Receiver is a contract needing >30k gas

The fix

The gas field should be removed to use the default amount, and reentrancy should be prevented with guards and the check-effects-interaction pattern.

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.

When a smart contract sends Ether to another contract, it must provide enough gas for the receiving contract to run its code. This report says the sending contract always gives exactly 30,000 gas, which might be too little for some receivers, so the transfer fails and the money cannot be received.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by kirk-baird

View all

32 more disclosed reports, best first.

More from Joyn contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.