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

L2ContractMigrationFacet::redeemDepositsAndInternalBalances - silo's deposited and depositedBdv balances corresponding to particular token is set to 0

Summary

In L2ContractMigrationFacet::redeemDepositsAndInternalBalances when deposits and bean-asset internal balances are redeemed onto L2 address then while updating deposits to reciever's address global states storing silo's deposited and depositedBdv balances corresponding to particular token is set to 0.

Vulnerability Details

Inside L2ContractMigrationFacet::redeemDepositsAndInternalBalances addMigratedDepositsToAccount is called to increment account's stalk.

for (uint256 i; i < deposits.length; i++) {
accountStalk += addMigratedDepositsToAccount(reciever, deposits[i]);
}

Inside function addMigratedDepositsToAccount local variables totalDeposited and totalDepositedBdv are used to update global states storing silo's deposited and depositedBdv balances corresponding to particular token but these local variables hold their default values only which will be set to global states.

// set global state
s.sys.silo.balances[depositData.token].deposited = totalDeposited;
s.sys.silo.balances[depositData.token].depositedBdv = totalDepositedBdv;

Impact

Setting Global state corresponding to silo token's balances (deposited and depositedBdv) to 0 will severly impact the system's accounting and all other account's holding that token.

Tools Used

Manual review

Recommendations

properly update global sates.

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

Appeal created

psb01 Submitter
11 months ago
inallhonesty Lead Judge
10 months ago
inallhonesty Lead Judge 10 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.