HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

Pool ID Collision Vulnerability

Summary

A potential vulnerability has been identified in the createContingentPool function of the DIVA Protocol, where pool IDs (_poolId) may collide if users provide identical pool parameters. This could lead to unintended behavior, such as pool duplication, replay attacks, or failure to distinguish between different pools.

Vulnerability Details

The function IDIVA(_diva).createContingentPool generates a pool ID (_poolId) based on the provided PoolParams structure. If the pool ID derivation mechanism does not incorporate a unique component—such as a nonce, sender address (msg.sender), or timestamp—two calls with the same parameters will yield the same _poolId. This results in a collision, which can cause:

  • Pool duplication: Multiple users attempting to create a pool with identical parameters may inadvertently reference the same pool.

  • Replay attacks: An attacker could reuse the same input parameters to recreate an existing pool, potentially affecting user expectations or protocol integrity.

  • Potential loss of funds or misrouting: If certain operations depend on unique pools, a collision could result in misallocation of collateral or incorrect settlement processes.

bytes32 _poolId = IDIVA(_diva).createContingentPool(
IDIVA.PoolParams({
referenceAsset: _poolParams.referenceAsset,
expiryTime: _poolParams.expiryTime,
floor: _poolParams.floor,
inflection: _poolParams.inflection,
cap: _poolParams.cap,
gradient: _poolParams.gradient,
collateralAmount: _poolParams.collateralAmount,
collateralToken: _collateralTokenToWToken[_poolParams.collateralToken], // Using the address of the wToken here
dataProvider: _poolParams.dataProvider,
capacity: _poolParams.capacity,
longRecipient: _poolParams.longRecipient,
shortRecipient: _poolParams.shortRecipient,
permissionedERC721Token: _poolParams.permissionedERC721Token
})
);

Impact

  • Loss of Pool Uniqueness: Different users creating the same pool parameters may unintentionally interact with the same pool.

  • Replayability: Malicious actors could exploit deterministic ID generation to manipulate protocol behavior.

  • Data Integrity Issues: If protocol logic assumes unique _poolId values, collisions may lead to incorrect data mappings or state inconsistencies.

Tools Used

Manual Review

Recommendations

  1. Incorporate Uniqueness in Pool ID Generation: Ensure that IDIVA.createContingentPool includes a unique identifier, such as:

    • msg.sender (to tie pools to the creator).

    • A nonce or counter (to guarantee unique increments).

    • Block timestamp (block.timestamp) or a random salt.

  2. Verify Uniqueness Before Pool Creation: Implement checks to confirm that a pool with the same parameters does not already exist unless intentional.

Updates

Lead Judging Commences

bube Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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