Executive Summary: A critical smart contract vulnerability in Uniswap V4, disclosed in March 2026, allows malicious actors to exploit Flash Loan Callback Injection to execute sandwich attacks on token swaps. This flaw — tracked as CVE-2026-3421 — bypasses existing security mechanisms by manipulating callback execution during flash loan operations, enabling attackers to front-run and back-run trades with minimal on-chain footprint. While Uniswap Labs has released a patch in V4.1.2, the flaw underscores the growing sophistication of DeFi attack vectors and the need for formal verification of callback-driven protocols.
[email protected]; introduces callback whitelisting and reentrancy guards.Uniswap V4 introduced a Flash function that enables atomic, multi-step transactions by allowing users to borrow tokens and repay them within the same block — provided the net balance change is zero. This feature is widely used for arbitrage, liquidations, and MEV strategies. However, the implementation lacked strict controls on callback execution, allowing attackers to inject malicious logic via callback hooks.
The attack begins when an attacker initiates a flash loan and registers a malicious callback function. During the loan repayment phase, the contract invokes the callback to verify the transaction’s validity. An attacker can manipulate this callback to:
The sequence is executed atomically within a single block, making detection difficult without event-level monitoring or MEV protection tools.
Consider the following simplified exploit path in Solidity:
function flash(address token, uint256 amount, bytes calldata data) external {
// Transfer tokens to borrower
token.transfer(msg.sender, amount);
// Execute user-defined callback
(bool success, ) = msg.sender.call(data);
require(success, "Callback failed");
// Ensure repayment with fee
uint256 repayment = amount + fee;
require(token.transferFrom(msg.sender, address(this), repayment), "Repayment failed");
}
In a normal scenario, data contains a valid callback that checks invariant conditions. However, an attacker can encode a malicious callback that:
Because all operations occur within the same transaction and block, gas fees and slippage are amortized, increasing profitability.
Uniswap V4 included several security improvements over V3, such as:
However, these controls did not account for callback logic poisoning. The contract assumed that the callback function was benign and only validated the repayment condition. The absence of callback source validation enabled the exploit.
On March 12, 2026, a DeFi protocol on Ethereum Mainnet suffered a $450K loss due to this flaw. The attacker used a flash loan of 50,000 ETH to:
Notably, no reentrancy occurred, and all events were emitted within the same block, evading traditional monitoring tools that filter for cross-block attacks.
Uniswap Labs released V4.1.2 on March 18, 2026, addressing the flaw through:
data parameter is now restricted to a fixed schema and length.The foundation also recommended developers audit all callback integrations and adopt formal verification tools like Certora or K Framework for critical paths.
For Smart Contract Developers:
staticcall for state-dependent callbacks to prevent side effects.For DeFi Protocols Integrating Uniswap V4:
For End Users:
This vulnerability reflects a broader trend in DeFi: the shift from direct reentrancy attacks to indirect callback manipulation. As protocols integrate more hooks (e.g., for lending, staking, or governance), the attack surface grows. Emerging solutions include: