Reentrancy Guards
Learn how to make secure external calls.
We'll cover the following...
Reentrancy
Whenever our contract makes an external call, it becomes potentially vulnerable to a type of attack known as a reentrancy attack. A reentrancy attack occurs when a malicious callee of one of our functions immediately calls back to our contract and attempts to drain funds. Therefore, external calls must be handled with care.
This seemingly simple attack was behind some devastating security exploits in the past. For instance, in 2016, a reentrancy attack stole $60 million worth of ETH from the DAO. The whole Ethereum blockchain had to be forked to return funds to investors, which was a serious blow to the ideals of immutability and decentralization.
Fortunately, the ecosystem has learned from this exploit, and we now have ways to prevent ...