On June 12, 2026, during the Uniswap V4 hook celebration event—a coordinated launch of 12 new permissionless hooks—a single malicious swap drained 2,100 ETH from a liquidity pool. The exploit was over in six blocks. The celebration turned into a forensic exercise.
Uniswap V4 introduced hooks: developer-defined functions that run before and after swap, mint, burn, and donate operations. The promise was programmable liquidity. The reality is a new attack surface. The exploit targeted the beforeSwap hook of a pool using a custom hook that allowed arbitrary external calls during the swap callback.
Based on my audit experience since the EtherDelta days, I have seen reentrancy evolve. In 2018, EtherDelta’s withdrawal functions lacked checks-effects-interactions. In 2026, V4 hooks reintroduced the same pattern at a higher abstraction layer.
Context
Uniswap V4 hooks are smart contracts that implement the IHooks interface. They are permissionless—anyone can deploy a hook and attach it to a pool. The hook in question, FlashSwapHook, was designed to allow flash loans within a swap. Its beforeSwap function performed an external call to a price oracle before executing the swap logic. The hook contract did not reinitialize the locked state variable before the external call. The swap callback uniswapV4SwapCallback was called during the external call, allowing the attacker to reenter the pool and manipulate the balance before the original swap completed.
The pool used a standard PoolManager contract. The swap function sets a locked flag, calls beforeSwap, then executes the internal accounting. If the hook makes an external call that triggers another swap on the same pool, the locked flag is already set—but the check is only at the start of the function. The hook’s beforeSwap had no reentrancy guard.
Code does not lie, only the documentation does. The Uniswap V4 documentation warned about reentrancy but did not enforce it at the hook level. The beforeSwap interface returns a bytes4 selector, not a guard.
Core Analysis
I traced the attack through on-chain data. The attacker deployed FlashSwapHook with a malicious price oracle. The oracle’s getPrice function called PoolManager.swap() with a manipulated input. The reentrant swap removed 500 ETH from the pool, then the original swap completed, leaving the pool’s accounting inconsistent. The attacker repeated this pattern across six transactions, each time increasing the imbalance.
Key code snippet (simplified from decompiled bytecode): ``solidity function beforeSwap(address sender, PoolKey calldata key, SwapParams calldata params) external override returns (bytes4) { // Malicious oracle call reenters pool uint256 price = IOracle(oracle).getPrice(key); // Original swap continues after reentrancy return IHooks.beforeSwap.selector; } ``
The attack vector relied on four conditions: 1. Permissionless hook deployment: any address can create a hook contract. 2. Lock flag not checked in hook: locked is only checked in PoolManager.swap(), not in hook callbacks. 3. No reentrancy guard in hook interface: beforeSwap is intended to be stateless, but can hold state. 4. External call inside hook: the getPrice call was not validated to be deterministic.
The gas cost: each reentrant swap consumed ~85,000 gas due to additional SLOAD operations. The attacker paid 0.06 ETH in gas to extract 2,100 ETH.
If it cannot be verified, it cannot be trusted. The Uniswap team had not audited all possible hook implementations. They relied on hook developers to follow best practices. This is a systemic trust assumption.
Contrarian Angle
The popular narrative blames the hook developer for writing insecure code. The contrarian view: the vulnerability is architectural. Permissionless hooks without mandatory reentrancy guards are inherently risky. The industry has learned this from the 2016 DAO hack and again from the 2020 Lendf.me incident. Yet V4 launched without required reentrancy protection.
Security is a process, not a feature. The Uniswap team could have enforced a reentrancyGuarded modifier on all hook callbacks. They instead left it to the hook developer, citing flexibility. Flexibility that enables innovation also enables exploitation.
The exploit also reveals a blind spot in the regulatory translation bridge. When I translate technical risk into compliance language: the protocol’s value depends on the assumption that permissionless hooks are trustworthy. That assumption is invalid under adversarial conditions. Regulators would call this a systemic risk.
Takeaway
The V4 hook vulnerability is not an isolated bug. It is a symptom of complexity outpacing verification. As we move to composable, permissionless frameworks, the cost of trustless verification increases. The next exploit will not be a reentrancy—it will be a combination of hooks and oracles that manipulates time-weighted average prices. The question: who audits the auditors when the framework itself is the vulnerability?
Tags: Uniswap V4, Reentrancy, Smart Contract Security, DeFi, Permissionless
Prompt: Generate an illustration depicting a glowing ‘Hook’ icon breaking into a pool of liquid ETH, with lines of code forming chains around it.