The vulnerability manifests in the QuantAMMWeightedPoolFactory's pool creation process. During pool creation, the factory accepts parameters for both hook configuration and liquidity management settings but fails to validate their relationship. When hooks have enableHookAdjustedAmounts = true, disableUnbalancedLiquidity must be true, but this constraint is not enforced.
Here's a comment in the code:
What this means is that if:
enableHookAdjustedAmounts = true
disableUnbalancedLiquidity must also be true.
However, in the pool creation functions, this important validation wasn't checked.
Here's a code snippet of the contract creation:
The core of this vulnerability starts in the VaultTypes.sol contract, where two essential structures are defined: HookFlags and LiquidityManagement. These structures are designed to work together in maintaining pool security and operational integrity. The HookFlags structure contains the enableHookAdjustedAmounts flag, which when set to true, grants hooks the ability to modify token amounts during pool operations.
During pool creation, the factory accepts parameters for both hook configuration and liquidity management settings but fails to validate their relationship.
This combination creates a dangerous scenario where hooks can adjust amounts while the pool still permits unbalanced liquidity operations, potentially leading to manipulation of pool balances and economic exploits. Every swap, liquidity addition, or removal operation could potentially be affected by this misconfiguration.
Pool Creation Starts
Factory accepts hook configuration with enableHookAdjustedAmounts
Factory accepts liquidity settings with disableUnbalancedLiquidity
No validation between these settings
Pool deploys with potentially incompatible configuration
Operations proceed with security risk
Whereas, the correct implementation should be:
Pool Creation Starts
Factory accepts hook configuration with enableHookAdjustedAmounts
Factory accepts liquidity settings with disableUnbalancedLiquidity
Factory checks: if enableHookAdjustedAmounts = true then requires disableUnbalancedLiquidity = true
Pool only deploys if validation passes
Operations proceed safely
Pools can be created with incompatible settings. Hooks that adjust amounts can operate with unbalanced liquidity enabled. This may cause manipulation of pool balances as unbalanced liquidity remains enabled.
Manual review
The correct implementation should be:
Pool Creation Starts
Factory accepts hook configuration with enableHookAdjustedAmounts
Factory accepts liquidity settings with disableUnbalancedLiquidity
Factory checks: if enableHookAdjustedAmounts = true then requires disableUnbalancedLiquidity = true
Pool only deploys if validation passes
Operations proceed safely
This should be applied to the two pool creation functions.
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.
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.
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.