QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

Critical Validation Flaw in Fee Calculation During NFT Pool Position Transfer

Summary

A vulnerability was identified in the UpliftOnlyExample smart contract, where the lpTokenDepositValue is updated during an NFT pool position transfer without proper validation. The absence of checks on the lpTokenDepositValueNow can result in invalid or reverted pool calculations being stored. This could potentially disrupt future fee computations by introducing inaccurate data due to issues such as oracle malfunctions.

Vulnerability Details

In the UpliftOnlyExample contract when a user transfers their NFT representing their pool position, there is a critical issue with the rate validation when calculating the new fee data. The lpTokenDepositValue is updated to the current value but there is no check to validate if the pool calculation reverted or returned invalid values.

function afterUpdate(address _from, address _to, uint256 _tokenID) public {
// ...
int256[] memory prices = IUpdateWeightRunner(_updateWeightRunner).getData(poolAddress);
uint256 lpTokenDepositValueNow = getPoolLPTokenValue(prices, poolAddress, MULDIRECTION.MULDOWN);
// ...
if (tokenIdIndexFound) {
if (_to != address(0))
@-> // No validation on lpTokenDepositValueNow
feeDataArray[tokenIdIndex].lpTokenDepositValue = lpTokenDepositValueNow;
// ...
}
}
}

Impact


This could lead to bad data being stored if there are oracle issues, potentially impacting future fee calculations for that position since the rates at time of transfer are used as the new base for uplift calculations.

Tools Used

Manual Review

Recommendations

To mitigate this issue, validate lpTokenDepositValueNow before updating the feeDataArray to ensure it is a valid, non-zero value, and implement error handling in the getPoolLPTokenValue function to prevent the storage of invalid data. Introduce a fallback mechanism to use the last known valid value or pause updates if oracle data is unavailable or incorrect. Additionally, emit events to log invalid attempts for better debugging and monitoring. Finally, conduct comprehensive testing and auditing of the contract and its external dependencies to ensure robustness and resilience against edge cases and oracle anomalies.

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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