QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

The `QuantAMMWeightedPool` constructor and `initialize` function lack a check to ensure that the deployer and initializer is the `QuantAMMWeightedPoolFactory`.

Summary

The QuantAMMWeightedPool constructor and initialize function do not implement any check to ensure that the deployer and initializer of the QuantAMMWeightedPool contract are the QuantAMMWeightedPoolFactory contract.

Vulnerability Details

A malicious user can deploy its own pool with their own parameters and weights not through factory contract.

The QuantAMMWeightedPool contract can be deployed and initialized by anyone. It does not include any checks to verify that the deployment is done through the factory contract.

A malicious user could deploy the QuantAMMWeightedPool contract and initialize it with their own parameters and weights.

https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-quantamm/contracts/QuantAMMWeightedPool.sol#L694

https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-quantamm/contracts/QuantAMMWeightedPool.sol#L175

Impact

Users of this malicious pool could be rug-pulled and their tokens and funds could be compromised, as the malicious pool could operate with unauthorized parameters and weights.

Tools Used

Manual Review

Recommendations

To mitigate the bug, you can implement the following changes:

  1. Add a check in the constructor to ensure the contract is deployed through the QuantAMMWeightedPoolFactory:

+ address private factory;
+ constructor() {
+ factory = msg.sender;
+ require(factory == address(QuantAMMWeightedPoolFactory), "Contract must be deployed through QuantAMMWeightedPoolFactory");
+}

2.Add a check in the starting of initialize function to ensure the initializer is the QuantAMMWeightedPoolFactory contract :

+ require(msg.sender == factory, "Only QuantAMMWeightedPoolFactory can initialize this contract");
Updates

Lead Judging Commences

n0kto Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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

Give us feedback!