DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: high
Valid

In `L2ContractMigrationFacet.sol`, the ` addMIgratedDepositsToAccount` function sets some global values to 0

Summary

addMIgratedDepositsToAccount function. code link below

https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/main/protocol/contracts/beanstalk/silo/L2ContractMigrationFacet.sol#L152-L200

The variables are declared but no value is assigned to them, hence they have a default value of 0. code link below

https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/main/protocol/contracts/beanstalk/silo/L2ContractMigrationFacet.sol#L152-L200

The Values of global state are being set to 0.code link below

https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/main/protocol/contracts/beanstalk/silo/L2ContractMigrationFacet.sol#L193-L195

Vulnerability Details

As seen in the code links above, the values for totalDeposited and totalDepositedBdv are not calculated nor they are assigned any value but the value of these variables is assigned to the global state which leads to assigning the value of 0 to those state variables

Impact

Setting the global state values to 0 can impact calculation/cause unexpected results where these state variables are used

Tools Used

Manual Review

Recommendations

check/ calculate the appropriate values for totalDeposited and totalDepositedBdv variables before assign them to global state

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

`addMigratedDepositsToAccount` Function doesn't properly aggregate the totalDeposited and totalDepositBdved

Support

FAQs

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