Comparing VPN Protocols: Security and Performance
Evaluate IPsec, WireGuard, and OpenVPN across dimensions of security, performance, and complexity.
Attack Surface Comparison
WireGuard has the smallest attack surface with approximately 4,000 lines of in-kernel code. OpenVPN runs in user space with a large codebase (~70,000 lines) plus the full OpenSSL library dependency. IPsec's attack surface spans multiple protocols (IKEv2, ESP, AH, NAT-T) across kernel and user-space implementations. Smaller attack surfaces mean fewer places for vulnerabilities to hide.
Cipher Agility: Risk of Downgrade
Cipher agility means a protocol can negotiate different cryptographic algorithms. OpenVPN and IPsec both support cipher negotiation, which enables broad compatibility but introduces downgrade attack risk: if a client and server are tricked into selecting a weak cipher, security is compromised. WireGuard's fixed primitives eliminate this risk entirely at the cost of flexibility.
All lessons in this course
- IPsec: IKEv2, ESP, and AH Protocols
- WireGuard: ChaCha20 and Curve25519 VPN
- OpenVPN: TLS-Based VPN Architecture
- Comparing VPN Protocols: Security and Performance