sherlock-audit / 2024-04-teller-finance-judging

10 stars 9 forks source link

0xrobsol - Uniqueness Violation in Market ID Assignment During Contract Initialization #214

Closed sherlock-admin4 closed 4 months ago

sherlock-admin4 commented 4 months ago

0xrobsol

medium

Uniqueness Violation in Market ID Assignment During Contract Initialization

Summary

The initialization function of the contract allows setting a marketId without checking its uniqueness. This oversight could lead to potential conflicts or overwrites in market configurations if the same marketId is reused inadvertently.

Vulnerability Detail

The contract's initialize function accepts a marketId parameter intended to uniquely identify a market configuration. However, there is no mechanism in place to verify whether the marketId has been previously set. As a result, it's possible to set up multiple markets with the same ID, leading to data integrity issues and unpredictable contract behavior.

Impact

If multiple market configurations use the same marketId, it could result in several undesirable outcomes:

Code Snippet

https://github.com/sherlock-audit/2024-04-teller-finance/blob/main/teller-protocol-v2-audit-2024/packages/contracts/contracts/LenderCommitmentForwarder/extensions/LenderCommitmentGroup/LenderCommitmentGroup_Smart.sol#L186

Tool used

Manual Review

Recommendation

To mitigate this vulnerability and prevent potential issues associated with non-unique marketIds, implement one or more of the following measures:

nevillehuang commented 3 months ago

Invalid, each marketId corresponds to a unique LenderCommitmentGroup_Smart contract address, so this is a non-issue