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

Upgradeable Contracts doesn't use storage gap for some inherited contracts #213

Closed
code423n4 opened this issue Oct 8, 2022 · 2 comments
Closed
Labels
bug Something isn't working duplicate This issue or pull request already exists invalid This doesn't seem right QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-10-blur/blob/2fdaa6e13b544c8c11d1c022a575f16c3a72e3bf/contracts/BlurExchange.sol#L30

Vulnerability details

Impact

The BlurExchange contract is upgradeable but inherit from ReentrancyGuarded and EIP712 which both does not have a storage gap. If in a future upgrade, additionnals state variables were to be added to one or both of these contracts it would shifts down all of the state variables below in the inheritance chain and potentially overwrite storage slots of the BlurExchange contract.

Proof of Concept

Link: https://github.com/code-423n4/2022-10-blur/blob/2fdaa6e13b544c8c11d1c022a575f16c3a72e3bf/contracts/BlurExchange.sol#L30

contract BlurExchange is IBlurExchange, ReentrancyGuarded, EIP712, OwnableUpgradeable, UUPSUpgradeable {

Openzeppelin notes about this: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps

Link to a similar issue: code-423n4/2022-05-rubicon-findings#67

Tools Used

Manual review.

Recommended Mitigation Steps

Add a storage gap to existing ReentrancyGuarded and EIP712 contracts.

@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 Oct 8, 2022
code423n4 added a commit that referenced this issue Oct 8, 2022
@GalloDaSballo
Copy link
Collaborator

Dup of #410

@GalloDaSballo GalloDaSballo added the duplicate This issue or pull request already exists label Oct 13, 2022
@GalloDaSballo GalloDaSballo added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Oct 27, 2022
@GalloDaSballo
Copy link
Collaborator

L

@JeeberC4 JeeberC4 added invalid This doesn't seem right unsatisfactory does not satisfy C4 submission criteria; not eligible for awards labels Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists invalid This doesn't seem right QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants