Skip to content

Code4rena

Nested Finance contest

Every publicly disclosed report for Nested Finance contest and what kind of bugs they were.

disclosed reports
15
most reported class
Business logic
bug classes found
3
first disclosure
2021
Find Nested Finance contest on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Nested Finance contest chose to make public.

Business logic

User can bypass entryFee by sending arbitrary calldata to ParaSwap operator

The NestedFactory contract allowed users to bypass entry fees by supplying arbitrary calldata to the ParaSwap operator, which could be manipulated to swap a tiny amount of input token for a large amount of output token via a malicious ERC777 token. An attacker could thus deposit a large amount into the vault without paying the intended entry fee.

Nested Finance contest

Medium
Business logic

NestedFactory : User can utilise accidentally sent ETH funds via processOutputOrders() / processInputAndOutputOrders()

The NestedFactory contract accepts plain ETH transfers from any sender and its order processing functions do not verify that ETH input comes from the reserve, allowing anyone to create an output order using the contract's accidentally sent ETH balance. An attacker could thereby convert stray ETH into tokens for their own benefit.

Nested Finance contest

Medium
Business logic

Undesired behavior

The store function in NestedRecords.sol pushes a token address into an array without checking for duplicates, so if a token is first added with amount 0 and later with a larger amount, it appears twice and all processing uses the first (zero) occurrence. An attacker could potentially cause loss of funds by exploiting this duplicate entry, but the sponsor argues the current operators prevent zero-amount transfers, so the issue is not currently exploitable.

Nested Finance contest

Medium
Business logic

Wrong logic around areOperatorsImported

The areOperatorsImported function used a logical AND instead of OR when comparing operator implementation and selector, so it could return true even if only one field matched. An attacker could exploit this to cause the owner to skip importing a corrected operator, potentially leading to token loss.

Nested Finance contest

Medium
Business logic

NestedFactory does not track operators properly

The NestedFactory contract's operator cache could fall out of sync with the factory's own list of operators, because adding or removing an operator did not trigger a cache rebuild and the cache check could not detect removed operators. As a result, a removed operator could still be used in core operations such as create() and swapTokenForTokens(), and a newly added one could fail until the cache was rebuilt manually.

Nested Finance contest

Medium
Business logic

Destroy can avoid the bulk of fees

The destroy function in NestedFactory only charged fees on the small amount of tokens returned by the user's chosen orders, not on the remaining balance. An attacker could submit tiny swap orders and have the bulk of their portfolio transferred back to them fee-free.

Nested Finance contest

Medium
Business logic

Copy your own portfolio to keep earning royalties

The protocol allows a user to copy their own portfolio and receive royalty shares for it, and repeat this to reduce fees. An attacker could create many wallets and bypass the frontend to lower fees to zero.

Nested Finance contest

High
Business logic

FeeSplitter: No sanity check to prevent shareholder from being added twice.

The FeeSplitter contract allows the same shareholder to be added multiple times because the setShareholders function does not check for duplicates. An attacker could add duplicate shareholders, causing them to receive more fees than intended when _sendFee is called.

Nested Finance contest

Medium
DoS

FeeSplitter: Unbounded number of shareholders can cause DOS

The FeeSplitter contract allows an unlimited number of shareholders, so a large number of shareholders can cause the _sendFees() function to run out of gas when distributing fees. This results in a denial of service for all NestedFactory functions, particularly those that remove funds like withdraw() and destroy().

Nested Finance contest

Medium
Business logic

Ensure on-chain that cache is synced

Core factory functions rely on a cache of operators being in sync, but removing or updating an operator does not immediately rebuild that cache. A user could therefore call create or swap functions that still use a removed or outdated operator until the cache is rebuilt.

Nested Finance contest

Medium
Business logic

NestedFactory.sol#_submitInOrders() Wrong implementation cause users to be overcharged

The order-submission function in the NestedFactory contract calculated fees and handled leftover input tokens incorrectly, so any unspent amount was treated as part of the fee rather than returned to the user. An attacker or ordinary user could therefore be overcharged whenever orders cost less than the supplied input amount.

Nested Finance contest

Medium
Business logic

isResolverCached() will always return false after removing operator

Removing an operator from the NestedFactory contract deletes its value in the operators array but leaves a zero entry, causing the cache to become permanently out of sync. As a result, isResolverCached() always returns false, and any function requiring a synced cache becomes uncallable.

Nested Finance contest

Medium
Race condition

setReserve() can be front-run

The reserve address in NestedFactory.sol is zero until an owner calls setReserve(), so any transfer or comparison involving reserve before that call may behave incorrectly. An attacker could front-run the setReserve() transaction to exploit the uninitialised state.

Nested Finance contest

Medium