Skip to content

Hardcoded Gas Forwarded in External Call

SAFE-0238 External Calls Checked automatically by the scanner
1

What goes wrong

A call forwards a hardcoded gas amount ({gas: 2300} or a fixed constant). Opcode gas repricing in future hard forks (as happened with EIP-1884) can make that amount insufficient, silently breaking the call.

2

The vulnerable pattern

proof of concept — how it is exploited
// to.call{gas: 2300, value: v}("");
// after a repricing hard fork, a compliant receive() now costs > 2300
// -> every payout reverts across the protocol.
3

How to fix it

the pattern that is safe
// forward all remaining gas (default) unless you have a specific reason
(bool ok, ) = to.call{value: amount}("");
Avoid hardcoded gas stipends; they break on repricings.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0238 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs