code-423n4 / 2024-04-panoptic-findings

7 stars 3 forks source link

Lack of Correct Handling of Negative Utilization #505

Closed c4-bot-6 closed 4 months ago

c4-bot-6 commented 4 months ago

Lines of code

https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L751

Vulnerability details

Impact

The _sellCollateralRatio function in the smart contract incorrectly handles negative utilization by simply negating the value, which could lead to unintended behaviour and incorrect results.

If negative utilization values occur due to underutilization or specific conditions, the incorrect handling can lead to inaccurate collateral ratio calculations. This could potentially result in incorrect risk assessments and financial losses for users.

Tools Used

Manual Review

Recommended Mitigation Steps

Assessed type

Math

c4-judge commented 4 months ago

Picodes marked the issue as unsatisfactory: Invalid