Gas Griefing Explained in Detail
Gas griefing happens when an attacker can make a transaction fail or become impractical by controlling gas costs. The attacker may use an expensive callback, a growing loop, a failing receiver, or a call made with too little gas.
The result is often denial of service rather than direct theft.
Smart contract example
A payout loop can become impossible to execute:
for (uint256 i = 0; i < recipients.length; i++) {
(bool ok,) = recipients[i].call{value: amount}("");
require(ok, "payout failed");
}
If the list grows too large or one receiver consumes gas or reverts, the payout path can fail for everyone.
Gas Griefing in Auditing
Gas griefing affects withdrawals, payouts, bridges, auctions, liquidations, and governance execution. It often appears around external calls, unchecked failures, and unbounded loops.
Red flags in code
-
Unbounded loops over user-controlled arrays.
-
Push-based payouts to many users.
-
Low-level calls with fixed gas stipends.
-
Failure of one receiver blocks all receivers.
-
Expensive callbacks inside critical settlement paths.
-
Cleanup logic must finish before users can withdraw.
How to test or review it
-
Test worst-case list sizes and expensive receiver contracts.
-
Check whether users can withdraw individually instead of relying on batch payouts.
-
Verify failed receivers cannot block unrelated users.
-
Review low-level call return values and gas forwarding.
-
Treat gas griefing as a denial of service risk when liveness matters.
Keep learning this topic
External Call
An external call is an interaction where one smart contract calls another address, creating a trust boundary and possible control-flow risk.
Unchecked Return Value
An unchecked return value bug happens when code ignores whether a low-level call or token operation succeeded.
Reentrancy
Reentrancy is a smart contract vulnerability where external code calls back into a contract before the first call finishes, often before balances, ownership, or other state has been updated.
Dos Attacks
See how this vulnerability appears in real smart contract audits.
Unchecked Return Value Attacks
SWC-104 unchecked call return values let Solidity calls fail silently. Learn the bug pattern, real exploit cases, and SafeERC20 fixes.
Delegatecall & Call Injection Attacks
Delegatecall and call injection attacks in Solidity: storage collision exploits, proxy vulnerabilities like Parity, and secure upgrade patterns.
Smart Contract Audit Checklist
Use this SCH tool to turn the concept into practical audit work.
Practice this in real audit scenarios
Definitions help, but auditors need reps. SCH turns concepts like Gas Griefing into exploit labs, code review habits, and report-writing practice.
Start the free trial or see the full smart contract auditing course.