The provide_liquidity
function lacks a mechanism for users to specify minimum acceptable LP tokens, exposing them to potential MEV attacks and unexpected losses when pool conditions change between transaction submission and execution.
Mechanism: When a user adds liquidity to the pool, they provide an amount of token A, and the system calculates the required amount of token B based on the current pool ratio. However, there is no parameter for the user to specify a minimum amount of LP tokens they expect to receive.
Root Cause: The function signature lacks a parameter for minimum output protection:
Attack Vector: Malicious validators or searchers could execute a sandwich attack by:
Detecting a user's liquidity provision transaction
Adding their own liquidity before the user's transaction to alter the pool ratio unfavorably
Removing their liquidity after the user's transaction executes
Likelihood:
Likelihood Assessment:
Attack Complexity: Low - Common MEV extraction pattern on blockchain networks
Prerequisites: Transaction visibility in mempool or validator access
Impact:
Impact Assessment:
Integrity: Medium - User operations execute correctly but with potentially unfair economic outcomes
Financial: Medium - Users may receive fewer LP tokens than expected without protection
N/A
Add a minimum LP tokens parameter to the function:
Create a new error type in your error module:
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.