sherlock-audit / 2024-03-arrakis-judging

0 stars 0 forks source link

ArrakisMetaVault::mint Insufficient MINIMUM_LIQUIDITY Won’t Protect Against Vault Inflation Attack (Grieving) #98

Closed sherlock-admin4 closed 1 month ago

sherlock-admin4 commented 1 month ago

ArrakisMetaVault::mint Insufficient MINIMUM_LIQUIDITY Won’t Protect Against Vault Inflation Attack (Grieving)

Low/Info issue submitted by cergyk

Summary

The MINIMUM_LIQUIDITY constant is intended to serve as a mitigation against the “ERC-4626 share inflation” attack vector. However, its current value won’t be sufficient to protect against vault inflation attacks in the ArrakisMetaVault.

Vulnerability Detail

The MINIMUM_LIQUIDITY is set to a value of 10 ** 3, or 1000: CArrakis.sol#L4.

In the ArrakisMetaVaultPublic contract, the mint function allows users to mint shares of the vault position. When the total supply is zero, the function mints MINIMUM_LIQUIDITY to the zero address to set a base liquidity level: ArrakisMetaVaultPublic.sol#L64-L67.

This approach is supposed to prevent the value of vault tokens from being manipulated, but the low value of MINIMUM_LIQUIDITY could still allow for inflation of vault tokens.

An attacker can reduce the precision of the Vault permanently, for example by donating 1 ether directly to the vault:

Scenario

Vault USDC-DAI totalSupply == 0 initially

  1. Attacker mints 1 share
  2. Attacker donates 1000 USDC and 1000 DAI to the pool

    All subsequent deposits will perpetually lose one-thousandth of the amount donated by the attacker, 1000 USDC in this case, because the value of the shares minted to the zero address are inflated in value.

  3. User deposits 1000 USDC and 1000 DAI and loses 1 USDC and 1 DAI due to precision loss.

Impact

An attacker can cause a permanent grieving attack on any public vault, and cause all subsequent users to lose a small share of their deposit due to rounding.

Deploying a new public vault is the only solution, but there is a 2-day timelock after each vault deployment because the owner must call ValantisModule::setALMAndManagerFees through the timelock.

Code Snippet

Tool used

Manual Review

Recommendation

Increase the MINIMUM_LIQUIDITY value to a more substantial amount to provide better protection against inflation attacks, such as 10 ** 6: CArrakis.sol#L4