The MinimalRouter
contract's proportional liquidity addition mechanism is vulnerable to a griefing attack where malicious users can manipulate pool ratios through strategic swaps to prevent other users from depositing liquidity.
In the MinimalRouter
contract, when users add liquidity using AddLiquidityKind.PROPORTIONAL
, the required input amounts are calculated based on the current pool ratios. A malicious actor can exploit this by:
Monitoring pending deposit transactions
Front-running these deposits by performing strategic swaps that alter the pool ratios
Causing the required input amounts to exceed the victim's maxAmountsIn
parameters
This attack is particularly profitable for existing LPs since preventing new liquidity providers from joining the pool increases their share of trading fees.
DOS - The attack can effectively prevent new liquidity providers from joining the pool by making their deposits revert due to exceeding maxAmountsIn
limits.
Manual Review
Use a time-weighted average of pool ratios instead of spot ratios when determining the required input amounts. This will mitigate the attack by making it more difficult to manipulate the pool ratios through strategic swaps.
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.