<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-a0ximyp5j" -->

---
title: EVM Deep Dive: Reentrancy Attacks and the...
description: Explains how Ethereum smart contracts transfer Ether using .transfer(), .send(), and .call{value: amount}(""), and why the modern standard .call forwards all...
canonical: https://daily.dev/posts/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-a0ximyp5j
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: EVM Deep Dive: Reentrancy Attacks and the Checks-Effects-Interactions Pattern | daily.dev
og:description: Explains how Ethereum smart contracts transfer Ether using .transfer(), .send(), and .call{value: amount}(""), and why the modern standard .call forwards all...
og:url: https://daily.dev/posts/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-a0ximyp5j
og:image: https://api.daily.dev/og/posts/A0Ximyp5j.png
og:image:alt: EVM Deep Dive: Reentrancy Attacks and the Checks-Effects-Interactions Pattern
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# EVM Deep Dive: Reentrancy Attacks and the Checks-Effects-Interactions Pattern

**[Coins Bench](https://daily.dev/sources/coinsbench)** · 4 min read · 0 upvotes · 0 comments

## Summary

Explains how Ethereum smart contracts transfer Ether using .transfer(), .send(), and .call{value: amount}(""), and why the modern standard .call forwards all remaining gas rather than a fixed 2300 gas stipend. Walks through a vulnerable withdraw() function that updates balance state after the external call, showing exactly how an attacker contract recursively re-enters withdraw() via its receive() function to drain funds. Presents the fix: the Checks-Effects-Interactions pattern (update state before external calls) combined with OpenZeppelin's ReentrancyGuard mutex lock for defense-in-depth against both single-function and cross-function reentrancy.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://coinsbench.com/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-0d55e8741a17>

## Questions this post answers

### How does a reentrancy attack work in a Solidity withdraw function?

An attacker deposits funds, then calls withdraw(), which sends ETH via a low-level call before zeroing the caller's balance. Because .call{value: amount}("") forwards all remaining gas, it triggers the attacker's receive() function, which calls withdraw() again while the balance is still nonzero, letting the loop drain the contract until funds run out.

_daily.dev surfaces smart contract security patterns for developers auditing withdrawal logic against reentrancy._

### What is the checks-effects-interactions pattern in Solidity and how does it prevent reentrancy?

It's a coding order that requires validating conditions (checks), updating internal state (effects), and only then making external calls (interactions). In a withdraw function this means zeroing a user's balance before sending ETH via call, so a re-entrant call sees a zero balance and halts immediately, unlike a vulnerable version that zeroes the balance after the transfer.

_Developers hardening contract logic can track patterns like checks-effects-interactions through daily.dev._

### Why is .call{value: amount}("") preferred over .transfer() for sending Ether in Solidity, despite the reentrancy risk?

.transfer() and .send() forward a fixed 2300 gas stipend meant to block reentrancy, but that stipend breaks compatibility with smart contract wallets and multisigs like Safe that need more gas for fallback execution. .call{value: amount}("") forwards all remaining gas instead, making it the modern standard, though it requires explicit reentrancy protections since it hands control back to the recipient before execution completes.

_Choosing between Ether transfer methods is easier when developers follow smart contract security discussion on daily.dev._

## Similar posts on daily.dev

- [Reentrancy Explained for Beginners](https://daily.dev/posts/reentrancy-explained-for-beginners-hcszxbihg) · Coins Bench · 1 upvotes · 0 comments
- [Call, Send, Transfer: Complete Timeline In Solidity Ethereum](https://daily.dev/posts/call-send-transfer-complete-timeline-in-solidity-ethereum-4wdrjltm8) · Coins Bench · 0 upvotes · 0 comments
- [Access Control Vulnerabilities in Smart Contracts](https://daily.dev/posts/access-control-vulnerabilities-in-smart-contracts-95bplr5qu) · Coins Bench · 0 upvotes · 0 comments
- [\[Ethernaut\] 1. Fallback](https://daily.dev/posts/ethernaut-1-fallback-ce3e4qxmg) · Coins Bench · 0 upvotes · 0 comments
- [Hunting in the Dark Forest: How I Uncovered a Private $25M Simulation Fork via an RPC Misconfiguration](https://daily.dev/posts/hunting-in-the-dark-forest-how-i-uncovered-a-private-25m-simulation-fork-via-an-rpc-misconfigurati-b5nskzd82) · InfoSec Write-ups · 0 upvotes · 0 comments

---

Tags: [#ethereum](https://daily.dev/tags/ethereum), [#appsec](https://daily.dev/tags/appsec), [#smart-contracts](https://daily.dev/tags/smart-contracts), [#solidity](https://daily.dev/tags/solidity)

[View this post on daily.dev](https://daily.dev/posts/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-a0ximyp5j)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"EVM Deep Dive: Reentrancy Attacks and the Checks-Effects-Interactions Pattern","url":"https://daily.dev/posts/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-a0ximyp5j","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-a0ximyp5j"},"datePublished":"2026-09-05T21:10:35.812Z","dateModified":"2026-09-05T21:11:33.271Z","description":"Explains how Ethereum smart contracts transfer Ether using .transfer(), .send(), and .call{value: amount}(\"\"), and why the modern standard .call forwards all...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Coins Bench","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Coins Bench","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/ba340d3c8caa4c2586911332928e24d9","url":"https://daily.dev/sources/coinsbench"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-a0ximyp5j","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ethereum,appsec,smart-contracts,solidity","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Coins Bench","item":"https://daily.dev/sources/coinsbench"},{"@type":"ListItem","position":3,"name":"EVM Deep Dive: Reentrancy Attacks and the Checks-Effects-Interactions Pattern"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/evm-deep-dive-reentrancy-attacks-and-the-checks-effects-interactions-pattern-a0ximyp5j#faq","mainEntity":[{"@type":"Question","name":"How does a reentrancy attack work in a Solidity withdraw function?","acceptedAnswer":{"@type":"Answer","text":"An attacker deposits funds, then calls withdraw(), which sends ETH via a low-level call before zeroing the caller's balance. Because .call{value: amount}(\"\") forwards all remaining gas, it triggers the attacker's receive() function, which calls withdraw() again while the balance is still nonzero, letting the loop drain the contract until funds run out. daily.dev surfaces smart contract security patterns for developers auditing withdrawal logic against reentrancy."}},{"@type":"Question","name":"What is the checks-effects-interactions pattern in Solidity and how does it prevent reentrancy?","acceptedAnswer":{"@type":"Answer","text":"It's a coding order that requires validating conditions (checks), updating internal state (effects), and only then making external calls (interactions). In a withdraw function this means zeroing a user's balance before sending ETH via call, so a re-entrant call sees a zero balance and halts immediately, unlike a vulnerable version that zeroes the balance after the transfer. Developers hardening contract logic can track patterns like checks-effects-interactions through daily.dev."}},{"@type":"Question","name":"Why is .call{value: amount}(\"\") preferred over .transfer() for sending Ether in Solidity, despite the reentrancy risk?","acceptedAnswer":{"@type":"Answer","text":".transfer() and .send() forward a fixed 2300 gas stipend meant to block reentrancy, but that stipend breaks compatibility with smart contract wallets and multisigs like Safe that need more gas for fallback execution. .call{value: amount}(\"\") forwards all remaining gas instead, making it the modern standard, though it requires explicit reentrancy protections since it hands control back to the recipient before execution completes. Choosing between Ether transfer methods is easier when developers follow smart contract security discussion on daily.dev."}}]}
```

