How Do Gas Limitations Prevent Reentrancy in Some Cases?

The Solidity transfer() and send() methods, when used to send Ether, limit the amount of gas forwarded to the recipient contract to a fixed amount (2300 gas). This small gas stipend is generally enough to log an event but is insufficient to perform any complex state-changing operations, including calling back into the original contract to execute a reentrancy attack.

While this was a common defense, modern contracts often use call.value() which does not impose this gas limit, requiring explicit CEI pattern use.

What Are the Differences between Single-Function and Cross-Function Reentrancy Attacks?
How Does the Use of Transfer or Send Help Enforce the CEI Pattern?
What Are the Potential Consequences of Setting a TWAP Time Period That Is Too Short or Too Long?
Why Is Call.value() Preferred over Transfer() in Modern Solidity?
How Do Decentralized Exchanges (DEXs) Mitigate Reentrancy Risks in Their Swap Functions?
How Does the EVM’s Gas Limit System Work?
How Does the Severity of the Penalty Differ between CEX and DEX Manipulation Cases?
What Are the Gas Limitations of the Transfer Function in Solidity?

Glossar