-
Notifications
You must be signed in to change notification settings - Fork 0
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
No Storage Gap for Upgradable Contracts #300
Comments
GalloDaSballo marked the issue as primary issue |
Better because of suggested remediation |
This is a fair point, but only an issue if we intend to modify ERC20Upgradeable or ERC4626Upgradeable implementation contract behind a proxy. |
After consulting the Rulebook Am downgrading to Low Severity. The Sponsor may not extend storage of child contracts, that is not inherently a vulnerability but a risk we're flagging as QA - Low Severity |
L |
GalloDaSballo changed the severity to QA (Quality Assurance) |
GalloDaSballo marked the issue as grade-c |
Lines of code
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/upgradeable/ERC20Upgradeable.sol#L10
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L11
Vulnerability details
Impact
The
ERC20Upgradable.sol
andERC4626Upgradable.sol
contracts are abstract, upgradable contracts where inheriting may introduce new storage variables. In order to safely upgrade the contracts which may include adding new storage variables, a storage gap should be added to both abstract contracts. The OpenZeppelin TimelockControllerUpgradable.sol contract demonstrates how this can be done.If no storage gap is added and if the upgradable contracts introduce new variables, this may cause storage collisions which will result in the overriding of existing variables in the inheriting contract.
Proof of Concept
Recommended Mitigation Steps
It's recommended that the upgradable contracts
ERC20Upgradable.sol
andERC4626Upgradable.sol
include a storage gap similar to the following either at the foot or the head of the contract as a storage variable:The text was updated successfully, but these errors were encountered: