code-423n4 / 2023-01-popcorn-findings

0 stars 0 forks source link

`ChangeAdapter` can lead to a DOS if the new adapter breaches the `maxDeposit` limit when assets are migrated from old adapter #485

Open code423n4 opened 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-01-popcorn/blob/d95fc31449c260901811196d617366d6352258cd/src/vault/Vault.sol#L612

Vulnerability details

Impact

ChangeAdapter migrates all assets from existing adapter and deposits them into new adapter - however, at the stage of proposing & changing adapters, it is not checked whether deposit into new adapter can breach the max deposit limit. For eg. Yearn adapter has a maxDeposit depending on the limit of yearn vaults - if such limit is breached, adapter can never be changed until excess deposits are shifted to another vault - this logic seems to be missing currently.

Proof of Concept

Tools Used

Manual

Recommended Mitigation Steps

c4-judge commented 1 year ago

dmvt marked the issue as primary issue

c4-sponsor commented 1 year ago

RedVeil marked the issue as sponsor acknowledged

c4-judge commented 1 year ago

dmvt changed the severity to QA (Quality Assurance)

c4-judge commented 1 year ago

dmvt marked the issue as grade-b