[NAZ-H5] Underlying Assets Stealing In All EIP4626 Implementations via share price manipulation #605
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-243
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2023-01-popcorn//blob/main/src/vault/adapter/yearn/YearnAdapter.sol#L17
https://github.com/code-423n4/2023-01-popcorn//blob/main/src/vault/adapter/beefy/BeefyAdapter.sol#L17
https://github.com/code-423n4/2023-01-popcorn//blob/main/src/vault/adapter/abstracts/AdapterBase.sol#L88
https://github.com/code-423n4/2023-01-popcorn//blob/main/src/vault/adapter/abstracts/AdapterBase.sol#L154
https://github.com/code-423n4/2023-01-popcorn//blob/main/src/utils/MultiRewardStaking.sol#L26
https://github.com/code-423n4/2023-01-popcorn//blob/main/src/vault/Vault.sol#L26
Vulnerability details
Impact
Vault tokens can be stolen from depositors in all EIP4626 Implementations vaults by manipulating the price of a share.
Proof of Concept
ERC4626 vaults are subject to a share price manipulation attack that allows an attacker to steal underlying tokens from other depositors (this is a known issue of ERC4626 implementation). Consider this scenario for
Vault.sol
:convertToShares()
function:convertToShares()
function:19e18 * 1 / 10e18 == 1
;Tools Used
Manual Review
Recommended Mitigation Steps
deposit()
functions, consider requiring a reasonably high minimal amount of assets during first deposit. The amount needs to be high enough to mint many shares to reduce the rounding error and low enough to be affordable to users.The text was updated successfully, but these errors were encountered: