The onAfterRemoveLiquidity function in UpliftOnlyExample.sol lacks the onlyVault modifier, leaving it exposed to unauthorized calls. This allows any malicious actor to burn all liquidity provider's NFTs, leading to the inability for the liquidity providers to withdraw their funds.
The root cause of the vulnerability is the missing onlyVault modifier in the onAfterRemoveLiquidity function, which is critical for restricting access to malicious calls.
Found in contracts/hooks-quantamm/UpliftOnlyExample.sol at Line 440
The onlyVault modifier is required to protect against malicious calls but onAfterRemoveLiquidity hook missed that protection.
This vulnerability is critical, as it allows any user to burn a liquidity provider's NFT. Once the NFT is burned, the liquidity provider loses the ability to withdraw their funds, resulting in a complete loss of liquidity assets.
Step by step attack recreation is described below.
Add below POC snippet to pkg/pool-hooks/test/foundry/UpliftExample.t.sol
Run the POC test with the following commands:
A PASS result indicates the attack was successful and the vulnerability described above is present.
Foundry Test
To mitigate this vulnerability:
Add the onlyVault modifier to the onAfterRemoveLiquidity function to ensure it is protected against unauthorized access.
Likelihood: High, anyone, anytime. Impact: High, Loss of funds
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.