The contract does not perform sufficient input validation in some cases. For example, in the _createContigentPool() function, it does not explicitly validate the input parameters (e.g., expiry time, floor, cap) provided by the caller.
The missing input validation in the _createContingentPool() function poses a potential security risk. This function accepts a PoolParams struct as input, which contains various parameters for creating a contingent pool on the DIVA Protocol. However, the contract does not perform any validation on these parameters before passing them to the IDIVA.createContigentPool function.
For example:
The contract does not check if the expiryTime is a valid future timestamp. An attacker could potentially provide an invalid or past timestamp which could lead to enexpected behaviour oor even allow the attacker to manipulate the pool's behaviour.
While the contract checks if the collateralAmount is greater than zero, it does not check if it is within a reasonable range or if it is sufficient to cover the potential liabilities of the pool. An attacker could potentially provide a very small collatoralAmount, which could lead to the pool becoming insolvent or unable to fulfill its obligations.
floor, inflection, cap, gradient: These parameters define the shape of the payout curve for the contingent pool. The contract does not check if these values are within reasonable or expected ranges. An attacker could potentially provide invalid or extreme values, which could lead to unintended consequences, such as creating a pool with no payout or a payout that is significantly different from the intended outcome.
Below is a test created in foundry to validate how a malicious actor can manipulate the data fields
The contract should implement robust input validation checks for all parameters in the PoolParams struct. This could include:
Checking if the expiryTime is a valid future timestamp.
Checking if the floor, inflection, cap and gradient values are within reasonable or expected ranges.
Checking if the collateralAmount is sufficient to cover the potential liabilities of the pool.
Checking if the dataProvider is a valid and trusted address.
The contract can significantly reduce its exposure to potential attacks and ensure that the contingent pools created through the _createContingentPool function behave as expected.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.