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

BaseUpgradeable is using a non-upgradeable dependency #499

Closed
code423n4 opened this issue Jan 3, 2023 · 4 comments
Closed

BaseUpgradeable is using a non-upgradeable dependency #499

code423n4 opened this issue Jan 3, 2023 · 4 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-710 edited-by-warden QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

code423n4 commented Jan 3, 2023

Lines of code

https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/BaseUpgradeable.sol#L9

Vulnerability details

Impact

BaseUpgradeable is using a non-upgradeable dependency (BaseAbstract) which will eventually break upgradeability

Proof of Concept

Currently, the BaseUpgradeable contract inherits the BaseAbstract contract. The BaseUpgradeable contract is meant to be used by a proxy contract which means that all dependencies should be proxy capable as well. The issue for BaseAbstract lies in the missing _gap variable. If a state variable is ever added to BaseAbstract this will result in a storage collision with all other storage slots, in this case it would break the storage in Initializable.sol and BaseUpgradeable.sol.

This issue is of course also present in TokenggAVAX.sol since BaseUpgradeable is there inherited as well.

Tools Used

VSCode, remix

Recommended Mitigation Steps

Consider copying the BaseAbstract contract, rename it to BaseAbstractUpgradeable and add a _gap variable to it.

uint256[50] private __gap;

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Jan 3, 2023
code423n4 added a commit that referenced this issue Jan 3, 2023
C4-Staff added a commit that referenced this issue Jan 6, 2023
@c4-judge
Copy link
Contributor

c4-judge commented Jan 8, 2023

GalloDaSballo marked the issue as duplicate of #300

@c4-judge
Copy link
Contributor

c4-judge commented Feb 2, 2023

GalloDaSballo marked the issue as not a duplicate

@c4-judge c4-judge closed this as completed Feb 2, 2023
@c4-judge c4-judge added downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax duplicate-710 and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Feb 2, 2023
@c4-judge
Copy link
Contributor

c4-judge commented Feb 2, 2023

Duplicate of #710

@GalloDaSballo
Copy link

L

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-710 edited-by-warden QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

3 participants