_beforeSwap Is Router Address, Breaking All Per-User Anti-Bot ProtectionsThe TokenLaunchHook is designed to provide anti-bot protection during launches by tracking per-address swap amounts, enforcing cooldowns between swaps, and applying penalty fees when users exceed limits or violate cooldowns. Each user should have independent tracking of their swap activity.
In Uniswap V4, when a user swaps through a router contract, the sender parameter passed to _beforeSwap is the router's address, not the actual user's address. The hook uses this sender parameter for all per-address tracking, causing all users' swaps to be attributed to the router address instead of individual users. This completly breaks the anti-bot protection mechanism.
Likelihood: High
All swaps in Uniswap V4 flow through router contracts. Direct calls to PoolManager are not the standard user flow.
The vulnerability is triggered on every single swap transaction, making it a certainty rather than an edge case.
Impact: High
Bots can swap unlimited amounts without any tracking since their EOA address is never recorded in the hook's mappings.
Per-address limits become meaningless - all users share the same limit through the router, turning individual limits into a global limit.
Cooldowns are shared across all users - one user's swap triggers cooldown penalties for all subsequent users using the same router.
The entire anti-bot protection mechanism is rendered completely ineffective.
The following changes in the flow are suggested:
Maintain a list of trusted routers
Verify the sender address against the trusted routers
Use a method exposed from the router to read the user address
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.
The contest is complete and the rewards are being distributed.