Smart Contract Security Audit Report
Uniswap V2 — Partial Review
1. Overview
This report presents the findings of a security audit conducted by Aegis Labs on a subset of the Uniswap V2 core contracts, specifically the Pair and Router implementations.
The audit focused on cross-chain message handling, reentrancy vectors, liquidity invariants, and upgradeability risks. Automated analysis was supplemented with manual code review.
2. Scope
In Scope
- UniswapV2Pair.sol
- UniswapV2Router02.sol
- swap / addLiquidity / removeLiquidity flows
Out of Scope
- Factory contracts
- ERC20 token implementations
- Oracle / TWAP logic
3. Methodology
Static Analysis
Slither, Mythril for automated vulnerability detection
Manual Review
Line-by-line audit of business logic and edge cases
Cross-chain Focus
Message verification, replay protection, invariant checks
4. Risk Rating
Overall Assessment: 1 High and 3 Medium severity issues identified. No Critical findings. Recommendations provided for all items.
5. Findings
Detailed vulnerability list with descriptions, recommendations, and code references.
Reentrancy in swap via callback
Description
The swap function triggers a callback to the recipient before state updates complete. A malicious pair contract or receiver can re-enter and drain liquidity during the callback window.
Recommendation
Apply checks-effects-interactions pattern. Update all state (balances, reserves) before performing the callback. Consider ReentrancyGuard as defense-in-depth.
Code Reference
function swap(uint amount0Out, uint amount1Out, address to, bytes data) external {
// ... checks ...
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out);
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out);
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(...); // Re-entry point
_update(balance0, balance1, ...); // State update too late
}Flash loan arbitrage via sync manipulation
Description
An attacker can flash loan, call sync() to skew reserves, execute arbitrage, and repay within the same transaction. Enables low-cost MEV extraction.
Recommendation
Document sync() behavior. Consider time-weighted oracles for dependent protocols. Informational for integrators.
Rounding bias in getAmountOut
Integer division can favor the pool in edge cases. Document rounding behavior; use getAmountIn or safety margins for exact-amount protocols.
Missing zero-address check in Router
addLiquidity does not reject tokenA == tokenB or address(0). Add explicit validation at Router entry points.
Unchecked return value for non-standard ERC20
Some tokens do not return bool. Use SafeERC20 or check return values where applicable.
This is what you get
Structured, actionable reports. Not PDFs—living documents you can share and reference.
Submit for Free Review