code-423n4 / 2022-06-nested-findings

0 stars 1 forks source link

NO TIMELOCK ON `setExitFees()` CAN LEAD TO USERS LOSING FUNDS IN NESTEDFACTORY #86

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Lines of code

https://github.com/code-423n4/2022-06-nested/blob/b4a153c943d54755711a2f7b80cbbf3a5bb49d76/contracts/NestedFactory.sol#L169 https://github.com/code-423n4/2022-06-nested/blob/b4a153c943d54755711a2f7b80cbbf3a5bb49d76/contracts/NestedFactory.sol#L264 https://github.com/code-423n4/2022-06-nested/blob/b4a153c943d54755711a2f7b80cbbf3a5bb49d76/contracts/NestedFactory.sol#L269

Vulnerability details

NO TIMELOCK ON setExitFees() CAN LEAD TO USERS LOSING FUNDS IN NESTEDFACTORY

In NestedFactory.sol, there is no timelock on setExitFees(). This is the fee that is applied upon calling destroy(), and determines how much the FeeSplitter receives in fee VS how much the user receives (in ERC20 token). But:

A malicious owner could effectively wait for enough users to create portfolios, then set a very high fee, which would result in every user calling destroy() transferring the ERC20 token amount from the user to the feeSplitter, resulting in the user effectively losing their NFT for nothing.

Impact

Medium

Proof Of Concept

The malicious owner calls setExitFees(10000), setting exitFees as 100%.

Tools Used

Manual Analysis

Recommended Mitigation Steps

Two things can be done:

obatirou commented 2 years ago

Disputed

There is a timelock, see ownership documentation in readme