제출 #1045504: smartalock wireguard-lwip `6e65ae6f (verified); c54f20db (main, presumed affected)` Memory Corruption정보

제목smartalock wireguard-lwip `6e65ae6f (verified); c54f20db (main, presumed affected)` Memory Corruption
설명wireguard-lwip (https://github.com/smartalock/wireguard-lwip) is a WireGuard implementation for the lwIP embedded network stack. A remote denial-of-service vulnerability was found in its handshake processing: a sustained stream of handshake initiation messages crashes the affected application with a memory-corruption fault inside the reference x25519 ladder, and the listener never recovers without a restart. Vulnerability class: memory corruption - an out-of-bounds write on the stack (CWE-787/121), manifesting as SIGSEGV or SIGABRT in the crypto ladder. Affected component and parameter (verified on commit 6e65ae6f; on current main c54f20db src/wireguard.c was compared and found identical, and src/crypto/refc/x25519.c differs only by a two-line alignment fix from pull request #17 that does not change the ladder's frame layout, so main is presumed affected): the affected input is a WireGuard handshake initiation message (message type 1) received on the WireGuard UDP port. Call path: wireguardif_network_rx() -> wireguard_process_initiation_message() -> wireguard_x25519() DH1 call at src/wireguard.c:587. Faulting site: mul() at src/crypto/refc/x25519.c:142, the first dereference of an already-corrupted pointer; other crash sites of the same corruption family are propagate() and hchacha20(). The faulting thread is the lwIP tcpip_thread. Attack vector: a single unauthenticated remote UDP source sends handshake initiation messages that pass MAC1 validation at a sustained rate of about 7 packets per second. MAC1 requires only the responder's public key, which every configured peer knows, and the DH1 call executes before any peer lookup or static-key decryption, so possession of any peer's private key is not required to reach the corrupted call. No authentication and no user interaction are needed. Impact: after 2-63 seconds of sustained traffic the application dies with SIGSEGV (exit 139) or, in other runs, SIGABRT "stack smashing detected" (stack canary overwritten mid-ladder). The fault signature indicates an out-of-bounds write on the response-path stack: at the fault, rax holds a text-segment address inconsistent with the spilled operand pointer visible at [rbp-0x90], and rbp equals the caller's frame pointer (wireguardif_send_handshake_response), i.e. the deep ladder frame overlaps its caller's frame and a saved pointer/return address in that window has been overwritten. The access that faults is the corrupted control flow consuming an overwritten saved pointer, not the original write. Once hit, tcpip_thread never returns: ICMP, ARP and WireGuard processing all stop while the process itself stays up, and only a restart recovers. The result is a reliable, permanent remote denial of service in the default configuration. Reproduction sketch: build the example application (the repository's example platform; our test binary is named wg-test) with the lwIP STABLE-2_2_0_RELEASE contrib unix port on a persistent TAP device, listen on the example's default WireGuard UDP port with one peer configured, and send MAC1-valid initiation messages with fresh TAI64N timestamps from one source at a steady rate of about 7 per second. Crash activity clusters at several discrete packet periods: within a single boot session a given period deterministically crashes or survives, and the pattern re-aligns across host reboots, so reproduction should be judged within one boot session. Analysis (bisection over 7 instrumented builds, 3 trials per condition): skipping the initiation-processing function entirely makes the flood survivable (0/3, 1233+ packets handled), while skipping MAC1 validation or skipping the response build does not stop the crashes (3/3) - the DH1 x25519 call frame is the necessary stage, and the response-path stack window is where the corruption lands. Ruled out: stack exhaustion (10.7 KB used of an 8 MB stack, measured with -fstack-usage over 365 functions); heap-overflow traversal (the pbuf arena is 56 MB away behind PROT_NONE); input-data dependence (replacing the attacker-supplied ephemeral point with the fixed basepoint still crashes 3/3); build-chain dependence (a host-native rebuild with system gcc, no Docker and no container runtime, crashes 4/5 at the identical site with the same corrupted-frame signature). The exact overflowing buffer could not be named: the response-path frame window is legitimately shared and reused by sibling callees (x25519/blake2s/hmac), so post-mortem memory images cannot distinguish reuse remnants from overflow writes, and live hardware watchpoints measurably perturb the timing-sensitive race (0/10+ crashes under observation versus 3/3 unobserved). The bisection bracket plus the faulting-site diversity establish the out-of-bounds write independently of naming the buffer. Evidence captured in our testing (artifacts - the four core dumps, gdb logs, packet captures, the bisect matrix and the period-scan table - are available on request): - Termination: SIGSEGV (exit 139) 3/3 trials at the 148 ms period, 3/3 at 172 ms and 3/3 at 256 ms; death between 2.0 s and 62.8 s after the flood starts. Other runs at the same dose terminate with SIGABRT "stack smashing detected" (exit 134). - gdb death frame (containerized build; a host-native build reproduces the identical frame): rip = mul+153 at src/crypto/refc/x25519.c:142; rax = 0xc0459ce99450aebb while the spilled operand pointer at [rbp-0x90] reads 0xabf0; rbp = 0x7acd5ec2a9e0 equals the frame pointer of the caller wireguardif_send_handshake_response; backtrace: mul <- mul1 (x25519.c:156) <- sqr1 (:157) <- ladder_part1 (:215) <- x25519_core (:258) <- x25519 (:266) <- wireguard_process_initiation_message (wireguard.c:587, the DH1 call) <- wireguardif_network_rx <- udp_input <- ip4_input <- ethernet_input <- tcpip_thread. - Post-fault thread state: tcpip_thread is R with wchan 0 and utime growing by about 100 jiffies per second (one core spinning); ICMP echo, ARP and further WireGuard packets receive zero replies in tcpdump while the process itself remains up; only a restart of the process recovers. - Determinism: within one boot session a given packet period reproducibly crashes or survives; the poison set {148, 172, 256} ms reproduces 3/3 while 200 ms survived one instance, i.e. the trigger is an interleaving race, not a per-packet bug. Coverage by existing fixes: the initiation rate limiter changed by commit 89444f7 does not cover this crash - the DH1 call executes before the rate-limit check in wireguard_process_initiation_message(), so MAC1-valid initiations still reach the ladder at the full flood rate; that commit is unmerged (it lived on an upstream work branch that has since been removed, and main has no such change). The x25519 zeroization added by commit cd329e56 on the same unmerged branch likewise does not change the frame layout and is not expected to fix it. As of this submission no fix for this crash exists in main or in any release. Mitigation / fix direction: make the under-load gate genuinely load-driven (the example platform's wireguard_is_under_load() stub returns a constant false, so the MAC2/cookie defense never engages; in a build with a load-driven gate the same flood was fully survivable, 0/3); reduce the response-path stack budget of tcpip_thread (run the DH computation off the tcpip thread or bound the call depth so the ladder frame cannot overlap its caller); add a regression test feeding initiations at a fixed period for 60 seconds on the unix port. Discoverer credit: reported during black-box differential compliance testing of five WireGuard implementations. Proof and external disclosure: vendor informed via the GitHub issue tracker at https://github.com/smartalock/wireguard-lwip/issues/21 (full technical write-up, trigger parameters, four core dumps, gdb captures, packet captures and the bisect matrix available on request; the GitHub issue is the vendor notification).
원천⚠️ https://github.com/smartalock/wireguard-lwip/issues/21
사용자
 Timmmy (UID 102264)
제출2026. 10. 20. PM 04:45 (1 월 ago)
모더레이션2026. 11. 19. PM 03:57 (1 month later)
상태수락
VulDB 항목440237 [smartalock wireguard-lwip 까지 cfba91666590e86bd67842c71cedf9a423be823a X25519 Ladder src/crypto/refc/x25519.c mul 메모리 손상]
포인트들20

Do you want to use VulDB in your project?

Use the official API to access entries easily!