Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NestedBuybacker sends NST to NestedReserve with no proper way to retrieve it. #33

Open
code423n4 opened this issue Nov 13, 2021 · 2 comments
Labels
0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Something isn't working sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Handle

TomFrench

Vulnerability details

Impact

Co-mingling of DAO and user funds for no reason. Requirement to deploy a specialised factory to retrieve funds and store them somewhere more suitable.

Proof of Concept

When triggered the NestedBuybacker sends NST to the NestedReserve

https://github.com/code-423n4/2021-11-nested/blob/5d113967cdf7c9ee29802e1ecb176c656386fe9b/contracts/NestedBuybacker.sol#L37-L38

https://github.com/code-423n4/2021-11-nested/blob/5d113967cdf7c9ee29802e1ecb176c656386fe9b/contracts/NestedBuybacker.sol#L106-L113

This places this NST in the same contract as user owned NST with no proper bookkeeping (the amount of NST owned by the DAO needs to be calculated offchain). There's also no functions to retrieve this NST without impersonating a factory with a new contract specially deployed for the task.

https://github.com/code-423n4/2021-11-nested/blob/main/contracts/NestedReserve.sol

Recommended Mitigation Steps

Have a separate treasury contract to hold this NST which has been bought which allows safe withdrawal of this NST without the potential for accidentally stealing user funds.

@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working labels Nov 13, 2021
code423n4 added a commit that referenced this issue Nov 13, 2021
@adrien-supizet
Copy link
Collaborator

The nstReserve mentioned here https://github.com/code-423n4/2021-11-nested/blob/5d113967cdf7c9ee29802e1ecb176c656386fe9b/contracts/NestedBuybacker.sol#L106-L113
is an EOA and not the NestedReserve contract used to store funds.

The wording can be confusing and can be adapted, but this is not an issue.

@maximebrugel maximebrugel added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Nov 18, 2021
@alcueca
Copy link
Collaborator

alcueca commented Dec 3, 2021

Downgraded to code clarity issue.

@alcueca alcueca added 0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation and removed 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments labels Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Something isn't working sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

4 participants