DeFiHardhat
12,000 USDC
View results
Submission Details
Severity: low
Invalid

lpTokenAmount is not checked

[M-1] Lack of input validation in calcLPTokenUnderlying function

The calcLPTokenUnderlying function in the ProportionalLPToken2 contract lacks input validation for the lpTokenAmount parameter. This could potentially lead to unexpected behavior or exploitation if the provided LP token amount exceeds the total supply of LP tokens (lpTokenSupply).

Vulnerability Details

The vulnerability arises due to the absence of input validation for the lpTokenAmount parameter in the calcLPTokenUnderlying function of the ProportionalLPToken2 contract. Without proper validation, there is no check to ensure that lpTokenAmount does not exceed the total supply of LP tokens (lpTokenSupply), which could lead to unintended consequences or exploitation.

Impact

If exploited, this vulnerability could impact the functionality and integrity of the calcLPTokenUnderlying function. Specifically, it allows for the calculation of underlying token amounts even when the provided LP token amount exceeds the total supply of LP tokens. This could result in incorrect calculations or unexpected behavior in systems relying on this contract.

Recommendations

To mitigate this vulnerability, it's recommended to add input validation to ensure that the lpTokenAmount does not exceed the total supply of LP tokens (lpTokenSupply). This can be achieved by adding a require statement at the beginning of the function:

function calcLPTokenUnderlying(
uint256 lpTokenAmount,
uint256[] calldata reserves,
uint256 lpTokenSupply,
bytes calldata
) external pure returns (uint256[] memory underlyingAmounts) {
require(lpTokenAmount <= lpTokenSupply, "LP token amount exceeds supply");
// Rest of the function implementation
}

By adding this validation, the contract will revert execution if the provided lpTokenAmount exceeds the total supply of LP tokens, ensuring that calculations are performed within expected bounds.

Updates

Lead Judging Commences

giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Informational/Invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.