MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: high
Invalid

Lack of validation for duplicate pools in `createPool`, user might stake in duplicate pool

Summary

The createPool function in the Distribution contract allows the addition of duplicate pools to the pools array without checking if the content is unique. While the function is controlled by the admin, the lack of validation for uniqueness could lead to potential issues if duplicate pools are mistakenly added. This could impact the user experience and introduce confusion in managing and maintaining the pools.

Vulnerability Details

The vulnerability arises from the absence of a check for duplicate content when adding pools using the createPool function. The function appends a new pool to the pools array without verifying if a similar pool already exists.

Impact

1 - Duplicate pools may lead to confusion and complexity in managing and maintaining the system. Administrators and developers may find it challenging to debug and modify duplicated pools effectively.

2 - Users interacting with the contract might experience inconsistent behavior if they stake or claim rewards from duplicated pools. This could affect the overall user experience and trust in the system.

POC

  • Copy paste the below code to your tests ( i am using foundry )

  • Run the test via this command forge test --match-test testCreatePool -vvvv

Test:

function testCreatePool() public {
// create one pool
vm.prank(address(distribution.owner()));
distribution.createPool(myPool);
// create 2nd pool with same data `myPool`
vm.prank(address(distribution.owner()));
distribution.createPool(myPool);
// check if data in array is duplicate
assertEq(distribution.hasDuplicate(myPool), true);
}

Result:

Test result: ok. 1 passed; 0 failed; 0 skipped; finished in 11.51ms
Ran 1 test suites: 1 tests passed, 0 failed, 0 skipped (1 total tests)

Tools Used

Manual analysis and review.

Recommendations

To enhance the createPool function, add a validation mechanism to check if the array being added is unique.

Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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