src/attack/EvilOwnerImpl.sol13 lines · 424 bytes
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity 0.8.37; |
| 3 | |
| 4 | import {DemoBTC} from "../DemoBTC.sol"; |
| 5 | |
| 6 | /// @title EvilOwnerImpl (demo attack, threat T2) |
| 7 | /// @notice Adds `claimOwner()` with no access control: anyone can take ownership. |
| 8 | /// @dev Deliberately malicious demo code. Never deploy outside a demo. |
| 9 | contract EvilOwnerImpl is DemoBTC { |
| 10 | function claimOwner() external { |
| 11 | _transferOwnership(msg.sender); |
| 12 | } |
| 13 | } |