[GH-ISSUE #2857] [Obsolete following the release of AWG 3.0] Static I1 junk-packet value in default/self-host configs creates a cross-deployment DPI fingerprint #1300

Open
opened 2026-10-14 03:39:48 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @skipjust12 on GitHub (Jul 22, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/2857

The self-hosted AmneziaWG 2.0 setup docs/installer ship a hardcoded value for I1 (first special junk packet):
I1 = <r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>
Decoding the payload shows it is a well-formed DNS response for icloud.com (flags 0x8580 = QR=1, AA, RD, RA; A record, TTL 0x105a, IP 77.88.55.55 encoded in the last 4 bytes). This is not a randomized template — it is byte-identical across any deployment where the operator copy-pasted the documented example (which, anecdotally, appears to be common practice, since this is the value given directly in the official self-host guide).
Why this matters
The entire point of I1–I5 / protocol mimicry is that AmneziaWG traffic should be indistinguishable from real background protocol traffic on a per-deployment basis, just like H1–H4 are deliberately randomized ranges that must not overlap between installs. A static, publicly-documented junk packet defeats this:
1. Global signature, not per-deployment: Any DPI system that captures this exact 44-byte UDP payload once can build a static signature valid for every AmneziaWG self-host instance that used the documented default — not just one server. This is categorically worse than a fixed H1–H4, since those are at least opaque integers with no fixed semantic payload; I1 here is a complete, parseable, byte-exact DNS message.
2. Correlation/detection before handshake analysis: An observer doesn’t need to fingerprint the WireGuard handshake shape at all — matching this one packet on a UDP port is sufficient to flag “this is likely AmneziaWG,” independent of the H1–H4 randomization that the rest of the protocol relies on.
3. Low-risk-of-edits problem: Because I1 requires exact byte-perfect DNS structure (correct section counts/lengths per the <b 0x...> format), users are unlikely to manually randomize it themselves — a single miscounted byte produces a malformed DNS packet, which is arguably a stronger detection signal (a broken protocol pretending to be a normal one) than leaving it static. In practice this discourages exactly the mitigation that would fix the issue.
Suggested fix
• Installer/config generator should auto-generate I1 (and I2–I5, if used) per-deployment: a syntactically valid DNS query/response for a randomly chosen, plausible domain, with randomized transaction ID / TTL / answer IP where applicable, rather than shipping one canonical example.
• Update the self-host documentation so the sample I1 value is clearly marked as illustrative-only (“do not use verbatim in production”), or better, replace the doc example with a small script/tool that generates a valid signature automatically (the existing Wireshark-based manual guide is good for custom protocols but too error-prone/tedious to expect users to do it for the common DNS case).
• Consider validating at parse time that I1–I5 differ from the documented example value(s), and warn the user if they match.

Originally created by @skipjust12 on GitHub (Jul 22, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/2857 The self-hosted AmneziaWG 2.0 setup docs/installer ship a hardcoded value for I1 (first special junk packet): I1 = <r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737> Decoding the payload shows it is a well-formed DNS response for icloud.com (flags 0x8580 = QR=1, AA, RD, RA; A record, TTL 0x105a, IP 77.88.55.55 encoded in the last 4 bytes). This is not a randomized template — it is byte-identical across any deployment where the operator copy-pasted the documented example (which, anecdotally, appears to be common practice, since this is the value given directly in the official self-host guide). Why this matters The entire point of I1–I5 / protocol mimicry is that AmneziaWG traffic should be indistinguishable from real background protocol traffic on a per-deployment basis, just like H1–H4 are deliberately randomized ranges that must not overlap between installs. A static, publicly-documented junk packet defeats this: 1. Global signature, not per-deployment: Any DPI system that captures this exact 44-byte UDP payload once can build a static signature valid for every AmneziaWG self-host instance that used the documented default — not just one server. This is categorically worse than a fixed H1–H4, since those are at least opaque integers with no fixed semantic payload; I1 here is a complete, parseable, byte-exact DNS message. 2. Correlation/detection before handshake analysis: An observer doesn’t need to fingerprint the WireGuard handshake shape at all — matching this one packet on a UDP port is sufficient to flag “this is likely AmneziaWG,” independent of the H1–H4 randomization that the rest of the protocol relies on. 3. Low-risk-of-edits problem: Because I1 requires exact byte-perfect DNS structure (correct section counts/lengths per the <r N><b 0x...> format), users are unlikely to manually randomize it themselves — a single miscounted byte produces a malformed DNS packet, which is arguably a stronger detection signal (a broken protocol pretending to be a normal one) than leaving it static. In practice this discourages exactly the mitigation that would fix the issue. Suggested fix • Installer/config generator should auto-generate I1 (and I2–I5, if used) per-deployment: a syntactically valid DNS query/response for a randomly chosen, plausible domain, with randomized transaction ID / TTL / answer IP where applicable, rather than shipping one canonical example. • Update the self-host documentation so the sample I1 value is clearly marked as illustrative-only (“do not use verbatim in production”), or better, replace the doc example with a small script/tool that generates a valid signature automatically (the existing Wireshark-based manual guide is good for custom protocols but too error-prone/tedious to expect users to do it for the common DNS case). • Consider validating at parse time that I1–I5 differ from the documented example value(s), and warn the user if they match.
Author
Owner

@bivlked commented on GitHub (Aug 3, 2026):

The fingerprint is real, and per-deployment generation removes it. Where I might add something is the next question, what to generate, and my answer there got worse the more I looked at it.

For context, I maintain a separate AmneziaWG installer. It emits I1 = <r N>, N drawn once per installation between 32 and 256, so no shared constant across deployments. That isn't what you're proposing, since yours keeps a valid DNS message and randomises the fields inside it. But it is the other obvious way to kill a shared constant, and two users have reported trouble with exactly that variant.

  • Tele2 and Megafon. Tunnel down for two days on the <r 127> the installer had generated. A QUIC-shaped value brought it up immediately on both carriers. So did deleting the I1 line altogether, by the same user in the same message. A day earlier, though, he had described a server that would not connect without I1, so his control condition isn't consistent.
  • Another user, verbatim: "it works for QUIC (<b xyz...zyx>) each time. For <r xyz> it works only from time to time". He also found the value only mattered on the client side.

Both point the same way, that the unstructured blob is what people run into trouble with. Neither shows why. One contradicts itself on the control, and nobody has compared a protocol-shaped value against no value at all with the rest held still. My own bench can't settle it: six combinations of payload form and placement all completed the handshake, but that was loopback on one host with no NAT and no censor in the path.

Which leaves a third option this issue doesn't mention: not sending a concealment payload at all. My installer has a flag for it, added when a desktop client turned out not to parse CPS. In the one report that tried omitting I1, it did as well as the protocol-shaped value.

Worth saying before anyone leans on mimicry too hard: a DPI that parses rather than matches beats either shape. The documented DNS answer maps icloud.com to a public resolver's own address, which is not an ordinary answer for that name. QUIC is no deeper. The Initial keys for v1 derive from the client's DCID and a salt published in RFC 9001 section 5.2, so an observer can strip header protection and watch arbitrary payload bytes fail authentication.

Your point about hand edits being risky, a malformed imitation being a worse signal than a static one, already has an example in the wild. The QUIC-shaped I1 values being passed around are about a hundred bytes. RFC 9000 section 14.1 has a client expand any UDP datagram carrying an Initial packet to at least 1200 bytes, and a server discard an Initial that arrives in a smaller one. So these aren't merely imperfect, they're the wrong size by an order of magnitude, and separating them from real client Initials needs nothing but a length check. Whether any carrier filter bothers, I don't know, and the reports above can't tell me.

One thing that makes this cheaper to test. In amneziawg-go the I1-I5 values are used to build outgoing packets in SendHandshakeInitiation, and a capture on our side matched: with I1 set on the server and the client initiating, nothing goes out. So for a client-initiated tunnel it's the client config a carrier sees. The smallest useful test now has three arms rather than two: random bytes, a protocol-shaped value, and no I1 at all. One install, a few attempts each, port left alone. That last part matters. Another case of mine looked like an I1 result for a week before it turned out the user had switched to port 443 at the same time.

On the documentation change: one user attributed an I1 byte-identical to the documented example to the official app. The provenance is unverified and he may well have copied the same guide. But if the app is a second source of that value, it is worth knowing before the sample is reworded, and it would matter for the parse-time warning you suggest too.

If it's useful, I can run the three-way comparison with users who currently can't connect and report back what comes out.

<!-- gh-comment-id:5166132229 --> @bivlked commented on GitHub (Aug 3, 2026): The fingerprint is real, and per-deployment generation removes it. Where I might add something is the next question, what to generate, and my answer there got worse the more I looked at it. For context, I maintain a separate AmneziaWG installer. It emits `I1 = <r N>`, N drawn once per installation between 32 and 256, so no shared constant across deployments. That isn't what you're proposing, since yours keeps a valid DNS message and randomises the fields inside it. But it is the other obvious way to kill a shared constant, and two users have reported trouble with exactly that variant. - Tele2 and Megafon. Tunnel down for two days on the `<r 127>` the installer had generated. A QUIC-shaped value brought it up immediately on both carriers. So did deleting the `I1` line altogether, by the same user in the same message. A day earlier, though, he had described a server that would not connect without `I1`, so his control condition isn't consistent. - Another user, verbatim: "it works for QUIC (`<b xyz...zyx>`) each time. For `<r xyz>` it works only from time to time". He also found the value only mattered on the client side. Both point the same way, that the unstructured blob is what people run into trouble with. Neither shows why. One contradicts itself on the control, and nobody has compared a protocol-shaped value against no value at all with the rest held still. My own bench can't settle it: six combinations of payload form and placement all completed the handshake, but that was loopback on one host with no NAT and no censor in the path. Which leaves a third option this issue doesn't mention: not sending a concealment payload at all. My installer has a flag for it, added when a desktop client turned out not to parse CPS. In the one report that tried omitting `I1`, it did as well as the protocol-shaped value. Worth saying before anyone leans on mimicry too hard: a DPI that parses rather than matches beats either shape. The documented DNS answer maps `icloud.com` to a public resolver's own address, which is not an ordinary answer for that name. QUIC is no deeper. The Initial keys for v1 derive from the client's DCID and a salt published in RFC 9001 section 5.2, so an observer can strip header protection and watch arbitrary payload bytes fail authentication. Your point about hand edits being risky, a malformed imitation being a worse signal than a static one, already has an example in the wild. The QUIC-shaped `I1` values being passed around are about a hundred bytes. RFC 9000 section 14.1 has a client expand any UDP datagram carrying an Initial packet to at least 1200 bytes, and a server discard an Initial that arrives in a smaller one. So these aren't merely imperfect, they're the wrong size by an order of magnitude, and separating them from real client Initials needs nothing but a length check. Whether any carrier filter bothers, I don't know, and the reports above can't tell me. One thing that makes this cheaper to test. In `amneziawg-go` the `I1`-`I5` values are used to build outgoing packets in `SendHandshakeInitiation`, and a capture on our side matched: with `I1` set on the server and the client initiating, nothing goes out. So for a client-initiated tunnel it's the client config a carrier sees. The smallest useful test now has three arms rather than two: random bytes, a protocol-shaped value, and no `I1` at all. One install, a few attempts each, port left alone. That last part matters. Another case of mine looked like an `I1` result for a week before it turned out the user had switched to port 443 at the same time. **On the documentation change:** one user attributed an `I1` byte-identical to the documented example to the official app. The provenance is unverified and he may well have copied the same guide. But if the app is a second source of that value, it is worth knowing before the sample is reworded, and it would matter for the parse-time warning you suggest too. If it's useful, I can run the three-way comparison with users who currently can't connect and report back what comes out. - the three-way report, in Russian: https://github.com/bivlked/amneziawg-installer/issues/42#issuecomment-4570197314 - "works for QUIC each time, for `<r` from time to time": https://github.com/bivlked/amneziawg-installer/issues/196#issuecomment-5131826186 - the case where the variable turned out to be the port: https://github.com/bivlked/amneziawg-installer/discussions/38#discussioncomment-17865931 - the config identical to the documented example: https://github.com/bivlked/amneziawg-installer/discussions/127#discussioncomment-17787921
Author
Owner

@skipjust12 commented on GitHub (Aug 5, 2026):

I discussed all this with Claude, and he found something else:

Found an additional structural issue while comparing the default I1 against a user's edited variant, verified empirically rather than by inspection.

The packet doesn't actually contain a Transaction ID field. Parsing it as a strict RFC 1035 header (ID first) breaks completely — ARCOUNT comes out to a nonsensical value, and the question section parse fails outright. The only interpretation that decodes into something coherent (icloud.com, sane counts) is a 10-byte pseudo-header with the ID field omitted, FLAGS starting at byte 0.

Under that (only viable) interpretation, the Answer section's compression pointer is c00c, which points to offset 12 — but the QNAME actually starts at offset 10, since there's no ID field to occupy those first 2 bytes. So the pointer is off by exactly the width of the missing ID field.

Practical implication: even setting aside the "identical across all deployments" problem this issue is about, the packet is internally inconsistent as DNS — a parser that actually walks the structure (rather than just matching bytes) would resolve the pointer to the wrong location. This means any fix that just randomizes domain/TTL/IP while keeping this structure would still carry the same offset bug.

Repro (pure Python, no deps):

wire = bytes.fromhex("858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737")

# strict RFC1035 (ID first) -- fails
id_, flags = wire[0:2], wire[2:4]
arcount = int.from_bytes(wire[10:12], 'big')
print(arcount)  # 1641 -- nonsensical for a 42-byte packet

# no-ID interpretation -- decodes coherently but pointer is wrong
# QNAME starts at offset 10 ("icloud.com" decodes fine)
# Answer pointer c00c = offset 12, a 2-byte mismatch

Worth fixing alongside the per-deployment randomization: if I1 generation moves to a script, it should build a byte-correct DNS message (real ID field, pointer offsets computed programmatically) rather than editing the current template's domain/IP/TTL in place.

<!-- gh-comment-id:5194788222 --> @skipjust12 commented on GitHub (Aug 5, 2026): I discussed all this with Claude, and he found something else: Found an additional structural issue while comparing the default `I1` against a user's edited variant, verified empirically rather than by inspection. The packet doesn't actually contain a Transaction ID field. Parsing it as a strict RFC 1035 header (ID first) breaks completely — `ARCOUNT` comes out to a nonsensical value, and the question section parse fails outright. The only interpretation that decodes into something coherent (`icloud.com`, sane counts) is a 10-byte pseudo-header with the ID field omitted, `FLAGS` starting at byte 0. Under that (only viable) interpretation, the Answer section's compression pointer is `c00c`, which points to offset 12 — but the QNAME actually starts at offset 10, since there's no ID field to occupy those first 2 bytes. So the pointer is off by exactly the width of the missing ID field. Practical implication: even setting aside the "identical across all deployments" problem this issue is about, the packet is internally inconsistent as DNS — a parser that actually walks the structure (rather than just matching bytes) would resolve the pointer to the wrong location. This means any fix that just randomizes domain/TTL/IP while keeping this structure would still carry the same offset bug. Repro (pure Python, no deps): ```python wire = bytes.fromhex("858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737") # strict RFC1035 (ID first) -- fails id_, flags = wire[0:2], wire[2:4] arcount = int.from_bytes(wire[10:12], 'big') print(arcount) # 1641 -- nonsensical for a 42-byte packet # no-ID interpretation -- decodes coherently but pointer is wrong # QNAME starts at offset 10 ("icloud.com" decodes fine) # Answer pointer c00c = offset 12, a 2-byte mismatch ``` Worth fixing alongside the per-deployment randomization: if `I1` generation moves to a script, it should build a byte-correct DNS message (real ID field, pointer offsets computed programmatically) rather than editing the current template's domain/IP/TTL in place.
Author
Owner

@bivlked commented on GitHub (Aug 7, 2026):

The structural part does not hold, and the reason is a small one: the transaction ID is there, it just is not inside the <b ...> literal.

The shipped default is a two-tag chain. In client/core/utils/constants/protocolConstants.h, defaultSpecialJunk1:

<r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737>

<r 2> emits two random bytes ahead of the literal, and those two bytes are the DNS transaction ID, redrawn on every packet. Count them in and the offsets line up:

offset field
0-1 ID, random, from <r 2>
2-3 flags 0x8580 (response, AA, RD, RA, RCODE 0)
4-11 QDCOUNT 1, ANCOUNT 1, NSCOUNT 0, ARCOUNT 0
12-23 QNAME icloud.com
24-27 QTYPE A, QCLASS IN
28-29 answer name: pointer 0xc00c
30-43 TYPE A, CLASS IN, TTL 4186, RDLENGTH 4, RDATA 77.88.55.55

44 bytes total, nothing left over. 0xc00c resolves to offset 12, which is exactly where QNAME begins. No off-by-two and no missing field: with the random ID in front, the whole thing parses as a well formed DNS response. Reading the literal on its own is what produces the 10-byte pseudo-header and the shifted pointer, because the literal does begin at flags.

Your actual point survives all of this, and the byte count makes it sharper. Two of the 44 bytes are redrawn per packet, the ID. The other 42 are byte-identical on every deployment that keeps the default, so the shared constant is 42 bytes wide. Whether a filter keys on them I cannot say, that is the part neither of us has measured. But it does say where per-deployment generation would have to work: everything except the one field that is already random.

The structural claim is the only thing I would drop, since anyone who checks the default will find it correct.

<!-- gh-comment-id:5216799723 --> @bivlked commented on GitHub (Aug 7, 2026): The structural part does not hold, and the reason is a small one: the transaction ID is there, it just is not inside the `<b ...>` literal. The shipped default is a two-tag chain. In `client/core/utils/constants/protocolConstants.h`, `defaultSpecialJunk1`: ``` <r 2><b 0x858000010001000000000669636c6f756403636f6d0000010001c00c000100010000105a00044d583737> ``` `<r 2>` emits two random bytes ahead of the literal, and those two bytes are the DNS transaction ID, redrawn on every packet. Count them in and the offsets line up: | offset | field | |---|---| | 0-1 | ID, random, from `<r 2>` | | 2-3 | flags `0x8580` (response, AA, RD, RA, RCODE 0) | | 4-11 | QDCOUNT 1, ANCOUNT 1, NSCOUNT 0, ARCOUNT 0 | | 12-23 | QNAME `icloud.com` | | 24-27 | QTYPE A, QCLASS IN | | 28-29 | answer name: pointer `0xc00c` | | 30-43 | TYPE A, CLASS IN, TTL 4186, RDLENGTH 4, RDATA `77.88.55.55` | 44 bytes total, nothing left over. `0xc00c` resolves to offset 12, which is exactly where QNAME begins. No off-by-two and no missing field: with the random ID in front, the whole thing parses as a well formed DNS response. Reading the literal on its own is what produces the 10-byte pseudo-header and the shifted pointer, because the literal does begin at flags. Your actual point survives all of this, and the byte count makes it sharper. Two of the 44 bytes are redrawn per packet, the ID. The other 42 are byte-identical on every deployment that keeps the default, so the shared constant is 42 bytes wide. Whether a filter keys on them I cannot say, that is the part neither of us has measured. But it does say where per-deployment generation would have to work: everything except the one field that is already random. The structural claim is the only thing I would drop, since anyone who checks the default will find it correct.
Author
Owner

@Ratio2 commented on GitHub (Sep 24, 2026):

Not obsolete. Fingerprint added again in github.com/amnezia-vpn/amnezia-client@9a7db3475f

<!-- gh-comment-id:5823588425 --> @Ratio2 commented on GitHub (Sep 24, 2026): Not obsolete. Fingerprint added again in https://github.com/amnezia-vpn/amnezia-client/commit/9a7db3475fdede69b2953cfd90ebeef2fe3952db
Author
Owner

@bivlked commented on GitHub (Sep 25, 2026):

@Ratio2 is right. Before 9a7db34 (#3115) the self-hosted generator in awgInstaller.cpp didn't set I1 at all, it only read it back from an existing config. The commit adds serverConfig.specialJunk1 = protocols::awg::defaultSpecialJunk1, so new self-hosted configs get exactly the value this issue is about: <r 2> plus the 42-byte literal, the same on every deployment.

The per-install header protection key that the same generator sets doesn't help here. In amneziawg-go the I1-I5 packets come out of the obfuscation chain and are sent as they are (device/send.go:139-143). The header protection keystream is applied only to the handshake message that follows (send.go:165-170). The I1 datagram on the wire is the same with or without the key.

The rest of that commit goes the other way: equal S1-S4 and H1-H4 = 1-4 with a per-install key, which is what the documentation recommends for header protection and RandomTrailers. Only I1 goes back to a shared constant. Generating it per install, or leaving it out, would match the rest of the profile.

<!-- gh-comment-id:5839856343 --> @bivlked commented on GitHub (Sep 25, 2026): @Ratio2 is right. Before [9a7db34](https://github.com/amnezia-vpn/amnezia-client/commit/9a7db3475fdede69b2953cfd90ebeef2fe3952db) (#3115) the self-hosted generator in `awgInstaller.cpp` didn't set `I1` at all, it only read it back from an existing config. The commit adds `serverConfig.specialJunk1 = protocols::awg::defaultSpecialJunk1`, so new self-hosted configs get exactly the value this issue is about: `<r 2>` plus the 42-byte literal, the same on every deployment. The per-install header protection key that the same generator sets doesn't help here. In amneziawg-go the `I1`-`I5` packets come out of the obfuscation chain and are sent as they are ([`device/send.go:139-143`](https://github.com/amnezia-vpn/amneziawg-go/blob/b5928efb6ca19f0153958460c3d141f04abc5c2e/device/send.go#L139-L143)). The header protection keystream is applied only to the handshake message that follows ([`send.go:165-170`](https://github.com/amnezia-vpn/amneziawg-go/blob/b5928efb6ca19f0153958460c3d141f04abc5c2e/device/send.go#L165-L170)). The `I1` datagram on the wire is the same with or without the key. The rest of that commit goes the other way: equal S1-S4 and H1-H4 = 1-4 with a per-install key, which is what the documentation recommends for header protection and RandomTrailers. Only `I1` goes back to a shared constant. Generating it per install, or leaving it out, would match the rest of the profile.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#1300
No description provided.