code-423n4 / 2024-05-munchables-validation

0 stars 0 forks source link

Lack of Validation for `_price` Parameter in `proposeUSDPrice` Function #552

Open c4-bot-10 opened 6 months ago

c4-bot-10 commented 6 months ago

Lines of code

https://github.com/code-423n4/2024-05-munchables/blob/57dff486c3cd905f21b330c2157fe23da2a4807d/src/managers/LockManager.sol#L142-L145

Vulnerability details

Description

The proposeUSDPrice function in the LockManager contract does not validate the _price parameter. This oversight can lead to several issues, including the potential assignment of a zero value or other invalid prices, which could impact the contract's logic and functionality.

Potential Impact

  1. Zero Price Assignment: Without validation, the function can be called with _price set to zero, which could lead to incorrect USD price updates. This would affect all dependent calculations and contract functionalities that rely on the USD price and lead to significant financial losses, incorrect calculations, and disruption of the intended functionality of the contract..
  2. Arbitrary Price Assignment: Lack of upper and lower bounds for _price means it can be set to values that may not make sense within the business logic, potentially leading to financial discrepancies or exploitation.

Mitigation Steps

To address this vulnerability, the following validation steps should be added to the proposeUSDPrice function:

  1. Check for Zero Value:

    solidity

Tools Used

Manual review, VS Code

Assessed type

Invalid Validation