WireGuard vs AmneziaWG: How Obfuscated Handshakes Get Past DPI
· 6 min read
WireGuard replaced OpenVPN and IPsec across most modern VPN infrastructure for good reasons. Its codebase is tiny, its Noise-based cryptography is modern and opinionated, and it pushes gigabit throughput without breaking a sweat. On an open network it is hard to beat.
On a restrictive network, however, standard WireGuard is one of the easiest protocols in existence to block. Corporate firewalls, university Wi-Fi, mobile carriers and national deep-packet-inspection (DPI) appliances routinely drop WireGuard handshakes before a single application packet ever crosses the tunnel. AmneziaWG exists specifically to close that gap.
Why standard WireGuard is trivial to fingerprint
WireGuard was never designed to disguise itself. Its specification intentionally left obfuscation out of scope in favour of a small, auditable kernel implementation. That simplicity leaves an unmistakable signature on the wire:
- Fixed message-type headers. Every WireGuard UDP packet begins with a
1-byte message type followed by three reserved zero bytes:
0x01 00 00 00for a handshake initiation,0x02 00 00 00for a response,0x03 00 00 00for a cookie reply, and0x04 00 00 00for encrypted transport data. - Exact handshake sizes. A handshake initiation payload is always 148 bytes. The server's handshake response is always 92 bytes. A cookie reply is always 64 bytes.
- Predictable opening sequence. Every session begins with a 148-byte UDP
datagram followed milliseconds later by a 92-byte reply from the same remote endpoint,
before switching to type
4data frames.
A stateful DPI box does not need to break ChaCha20-Poly1305 or inspect port 51820 to recognise that pattern. Changing the port does nothing: matching on the 148-byte initiation
prefix 01 00 00 00 followed by a 92-byte 02 00 00 00 reply catches
vanilla WireGuard on any UDP port with virtually zero false positives. Once matched, the
firewall either drops the response or blackholes the 5-tuple entirely.
What AmneziaWG changes
AmneziaWG is a fork of WireGuard that leaves the cryptographic core — Curve25519 key exchange, ChaCha20-Poly1305 authenticated encryption, BLAKE2s hashing and the Noise_IKpsk2 state machine — completely untouched. What it changes is the outer wire shape that DPI rules look for, using three groups of parameters:
- Junk pre-handshake packets (
Jc,Jmin,Jmax). Before transmitting the real handshake initiation, the client sendsJcpseudo-random UDP packets sized betweenJminandJmaxbytes. The server silently discards them, while any middlebox watching the start of the flow sees unstructured UDP traffic rather than a textbook WireGuard opening. - Random handshake padding (
S1,S2).S1prepends a configured number of random bytes to every handshake initiation, andS2does the same for every handshake response. The telltale 148-byte and 92-byte lengths disappear, breaking size-based classifiers. - Custom message headers (
H1–H4). Instead of the hardcoded1,2,3and4type tags with trailing zero bytes, client and server agree on arbitrary 32-bit header values for each packet type (and newer revisions add dynamic header protection on top). The static01 00 00 00signature no longer exists on the wire.
Because the server only accepts packets matching the expected padding lengths, header tags and MACs, active probes sent by censors or scanners still receive silence — preserving WireGuard's stealth against port scanning while removing its passive DPI fingerprint.
WireGuard vs AmneziaWG at a glance
| Property | WireGuard | AmneziaWG |
|---|---|---|
| Cryptography | Noise_IKpsk2, Curve25519, ChaCha20-Poly1305 | Identical to WireGuard |
| Handshake sizes | Fixed 148 B initiation / 92 B response | Variable via S1 / S2 random padding |
| Message type tags | Fixed 0x01–0x04 with zero bytes | Custom 32-bit H1–H4 values |
| Opening pattern | Immediate initiation packet | Preceded by Jc random junk datagrams |
| DPI resilience | Blocked easily on restrictive networks | Bypasses signature- and size-based UDP DPI |
| Throughput | Line rate (multi-gigabit) | Near line rate (negligible per-packet overhead) |
Tradeoffs and what obfuscation does not solve
AmneziaWG is deliberately lightweight compared to heavy proxy-over-TLS wrappers, so throughput remains fast enough to saturate gigabit links. There are still two practical details worth understanding:
- Packet overhead and MTU. Any extra header or padding bytes trim the maximum payload a single UDP datagram can carry. Left unmanaged on a naive VPN gateway, a tighter tunnel MTU lowers the outbound TCP MSS seen by websites — a signal that anti-bot systems check.
- Two different adversaries. AmneziaWG hides your tunnel from the network between you and the VPN server (your ISP, office firewall or regional DPI). It does not change what the destination website sees after traffic exits the VPN.
To stay invisible to the destination website as well, the exit needs a clean residential IP and clean transport-layer behaviour — topics we break down in how websites detect a VPN.
How Spettro uses it
Spettro's residential VPN is built on WireGuard with obfuscated handshakes and simulated pre-handshake noise, so your device stays connected even behind strict firewalls and DPI. Combined with a dedicated Frontier residential IP in Ashburn, VA and our exit-side TCP stack, both halves of the path — to the server and from the server to the target — stay clean. See the VPN page for details.
References
- Jason A. Donenfeld, WireGuard: Next Generation Kernel Network Tunnel, NDSS 2017.
- AmneziaVPN, amneziawg-go, reference implementation and protocol obfuscation parameters.