Skip to content

Latest commit

 

History

History
44 lines (24 loc) · 1.46 KB

File metadata and controls

44 lines (24 loc) · 1.46 KB

Urban Vinyl Koala

Medium

Overflow in VVVVCInvestmentLedger.sol line-165 due to unchecked large value of product entities will cause invest() to revert.

Summary

In function VVVVCInvestmentLedger.sol::invest() there could be case of overflow due to following code line -

https://github.com/sherlock-audit/2024-11-vvv-exchange-update/blob/1791f41b310489aaa66de349ef1b9e4bd331f14b/vvv-platform-smart-contracts/contracts/vc/VVVVCInvestmentLedger.sol#L165

  uint256 preFeeStableAmountEquivalent = (_params.amountToInvest * _params.exchangeRateNumerator) /exchangeRateDenominator;

If the value of _params.amountToInvest and _params.exchangeRateNumerator is very large or even on of the value is very large, it will lead to overflow of uint256 and execution will revert.

Root Cause

large value of _params.amountToInvest and _params.exchangeRateNumerator isn't checked in invest() of VVVVCInvestmentLedger.sol.

Internal pre-conditions

  1. signer signes a investment transactions which has pretty high amountToInvest and exchangeRateNumerator values, such that amountToInvest*exchangeRateNumerator > max(uint256).

External pre-conditions

No response

Attack Path

No response

Impact

It will cause the invest() function to revert for a particular signed InvestParams every time.

PoC

No response

Mitigation

check the values of _params.amountToInvest and _params.exchangeRateNumerator if they are too large or not.