-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPoC.t.sol
47 lines (35 loc) · 1.44 KB
/
PoC.t.sol
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;
import "forge-std/Test.sol";
import "./utils.sol";
import "../src/PoC.sol";
/// @title Proof of Concept Test
/// @notice DO NOT USE ON ANY PUBLIC NETWORK
/// @dev https://book.getfoundry.sh/forge/writing-tests
contract PoCTest is Test {
// ---------------------------------------------------------------------------------------------
// VARIABLES
/// @notice Attacker EOA address.
/// @dev First address generated by Anvi. Private key is publicly known.
address internal constant attacker = address(0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266);
/// @notice Target address
address internal constant target = address(0x45);
/// @notice PoC address
address internal poc;
// ---------------------------------------------------------------------------------------------
// SCENARIO SET UP
/// @notice Sets up the environment. Deploy contracts here.
function setUp() public {
poc = address(new PoC(target));
}
// ---------------------------------------------------------------------------------------------
// EXPLOIT TEST
/// @notice Test the PoC here.
function testPoC() public {
// Every external contract call within `testPoC` starting here will have a `msg.sender` of
// `attacker`.
// https://book.getfoundry.sh/cheatcodes/start-prank
vm.startPrank(attacker);
// Exploit here
}
}