When users add liquidity to QuantAMM by calling the UpliftOnlyExample::addLiquidityProportional function, they are minted an NFT in addition to the BPTs they receive.
However, because the UpliftOnlyExample::addLiquidityProportional function does not check to ensure at least one non-zero input amount, users can keep minting the NFT without adding liquidity to QuantAMM.
The vulnerability lies in the fact that the UpliftOnlyExample::addLiquidityProportional function does not revert whenever a user populates the maxAmountsIn array with zeros signifying that no liquidity is added to the protocol. The affected code can be viewed on github here and also provided below for each of reference
Users can keep minting NFTs without adding liquidity to the protocol. Meanwhile, the NFTs are meant for liquidity providers. Since NFTs can be highly valued, it implies that such users can get rich off the protocol without making any significant contribution to the protocol.
Note that a user can mint up to 100 NFTs in each liquidity pool in QuantAMM without providing liquidity in any pool.
Manual Review
Foundry
Proof of Concept:
A malicious user bob sees that they can mint NFTs without providing liquidity to QuantAMM
bob populates the maxAmountsIn parameter array with zeros and calls the UpliftOnlyExample::addLiquidityProportional
bob mints himself an NFT without adding liquidity to the protocol
In fact, bob can do this 100 times for each liquidity pool on the QuantAMM
Consider adding a check in the UpliftOnlyExample::addLiquidityProportional to proceed only if they is at least one non-zero element in the maxAmountsIn array as shown below:
Better still, the zero in the condition if(maxAmountsIn[i] > 0) in the recommendation above can be replaced with a minimum amount allowed to add liquidity if the prototocol wants.
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.