Skip to main content
๐Ÿ› Bug HuntSO Solidity Hardโšก+35 XP

Reentrancy Vulnerability

This withdraw function is vulnerable to reentrancy.

๐Ÿ› Find the bug
1function withdraw() external {
2 uint amount = balances[msg.sender];
3 (bool ok,) = msg.sender.call{value: amount}("");
4 balances[msg.sender] = 0;
5}
๐Ÿ› The bug is on line 4

๐Ÿ”ง Select the correct fix: