[GH-ISSUE #211] docs: DisableCookies description is stale after #188 — the whole under-load path is disabled, not only the reply #209

Open
opened 2026-11-08 07:41:22 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @EgolOS on GitHub (Nov 7, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-go/issues/211

The parameter reference says:

The DisableCookies parameter disables only the sending of Handshake Cookie Reply messages. Incoming cookie messages and other cookie-related mechanisms continue to work the same way as in the original WireGuard implementation.

Since #188 (b5928ef) that is no longer what the implementation does. In device/receive.go:

disableCookies := device.disableCookies.Load()
if !disableCookies && device.IsUnderLoad() {
    // verify MAC2
    // SendHandshakeCookie
    // rate.limiter.Allow(...)
}

so with DisableCookies on, the MAC2 check and the per-source rate limiter are skipped as well — not only the reply. amneziawg-linux-kernel-module behaves the same way: src/receive.c:194 computes under_load = !wg->disable_cookies && ..., and wg_cookie_validate_packet() in src/cookie.c only reaches wg_ratelimiter_allow() when check_cookie is true.

This is not a request to revert #188 — the trade-off is deliberate and the review on that PR already quantified it. The request is only that the documentation say so, because a reader today concludes that the pre-handshake gate is preserved.

For context, we ported the driver to OpenBSD and measured what a cookie-less interface exposes itself to: curve25519() from OpenBSD sys/crypto/curve25519.c, one core of a Ryzen AI Max+ 395, 43 µs per operation → ~23,000 initiations/s (~27 Mbit/s at 148 bytes per packet) to pin a core, in the same order as the 20 Mbit/s/core figure from the #188 discussion.

Either of these would close it:

  1. Fix the DisableCookies row/section in the docs: it disables the whole under-load path (no Cookie Reply, no MAC2 requirement, no per-source rate limiting), and state the computational-DoS exposure.
  2. Optionally, if a cheap partial mitigation is wanted without touching the wire format: keep the per-source rate limiter even when replies are suppressed (it cannot replace return-routability, but it caps per-IP handshake rates), or add an interface-wide admission cap before the X25519.

Happy to send the documentation PR for (1) if you prefer that over an issue.

Originally created by @EgolOS on GitHub (Nov 7, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-go/issues/211 The parameter reference says: > The `DisableCookies` parameter disables only the sending of Handshake Cookie Reply messages. Incoming cookie messages and other cookie-related mechanisms continue to work the same way as in the original WireGuard implementation. Since #188 (`b5928ef`) that is no longer what the implementation does. In `device/receive.go`: ```go disableCookies := device.disableCookies.Load() if !disableCookies && device.IsUnderLoad() { // verify MAC2 // SendHandshakeCookie // rate.limiter.Allow(...) } ``` so with `DisableCookies` on, the MAC2 check and the per-source rate limiter are skipped as well — not only the reply. `amneziawg-linux-kernel-module` behaves the same way: `src/receive.c:194` computes `under_load = !wg->disable_cookies && ...`, and `wg_cookie_validate_packet()` in `src/cookie.c` only reaches `wg_ratelimiter_allow()` when `check_cookie` is true. This is not a request to revert #188 — the trade-off is deliberate and the review on that PR already quantified it. The request is only that the documentation say so, because a reader today concludes that the pre-handshake gate is preserved. For context, we ported the driver to OpenBSD and measured what a cookie-less interface exposes itself to: `curve25519()` from OpenBSD `sys/crypto/curve25519.c`, one core of a Ryzen AI Max+ 395, 43 µs per operation → ~23,000 initiations/s (~27 Mbit/s at 148 bytes per packet) to pin a core, in the same order as the 20 Mbit/s/core figure from the #188 discussion. Either of these would close it: 1. Fix the `DisableCookies` row/section in the docs: it disables the whole under-load path (no Cookie Reply, no MAC2 requirement, no per-source rate limiting), and state the computational-DoS exposure. 2. Optionally, if a cheap partial mitigation is wanted without touching the wire format: keep the per-source rate limiter even when replies are suppressed (it cannot replace return-routability, but it caps per-IP handshake rates), or add an interface-wide admission cap before the X25519. Happy to send the documentation PR for (1) if you prefer that over an issue.
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/amneziawg-go#209
No description provided.