Beginner FriendlyFoundryDeFiOracle
100 EXP
View results
Submission Details
Severity: high
Valid

Storage Collisions Between Implementation Versions

Summary

Storage collision because between ThunderLoan and ThunderLoanUpgraded could cause conflicts and override sensible variables

Vulnerability Details

In this case, the first implementation of the logic contract stores uint256 private s_feePrecision at the first storage slot and an upgraded logic contract stores uint256 private s_flashLoanFee; at the same first slot. When the updated logic contract attempts to write to the s_flashLoanFee variable, it will be using the same storage position where the previous value for s_feePrecision was being stored, and overwrite it. This is due to deleting s_feePrecision and adding FEE_PRECISION on the updated version.

Impact

High

Tools Used

Manual Analysis

Recommendations

By following Openzeppelin guidelines we need to have new versions of a logic contract extend previous versions.
section "Storage Collisions Between Implementation Versions"
https://docs.openzeppelin.com/upgrades-plugins/1.x/proxies

Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

storage collision on upgrade

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.