| 제목 | smartalock wireguard-lwip 6e65ae6f (verified); c54f20db (main, affected) Business Logic Errors |
|---|
| 설명 | wireguard-lwip (https://github.com/smartalock/wireguard-lwip) is a WireGuard implementation for the lwIP embedded network stack. A logic flaw in its local session index allocation silently breaks deployments with more than one peer configured: a newly allocated session index that collides with an earlier peer's session is accepted instead of rejected, and the affected peer is silently denied service.
Vulnerability class: logic error - a broken uniqueness check in the session index allocator.
Affected component and parameter (verified on commit 6e65ae6f): wireguard_generate_unique_index() at src/wireguard.c:378-403 allocates the 32-bit local session index carried in the sender_index and receiver_index fields that route all handshake and transport frames. Its uniqueness loop overwrites the existing flag on every iteration instead of accumulating (src/wireguard.c:392-399), so after the loop only the comparison against the LAST peer slot survives: an index colliding with any earlier peer's session is accepted. src/wireguard.c compares identical on current main c54f20db, so main is affected. Condition: the shipped default of a single peer is unaffected - the single-slot loop is semantically correct and the defect is latent; deployments that raise WIREGUARD_MAX_PEERS above 1 are affected. An additional aggravation: unconfigured peer slots hold all-zero indexes while the drawn value excludes zero, so as long as any peer slot is free, the final loop iteration forces the uniqueness verdict to false and defeats the check for every earlier slot - even a single active peer on a multi-peer build is exposed.
Impact: peer lookups by index are first-match, so on a collision both peers share one session identity. The later peer's handshake completion is routed to the earlier peer's slot, fails authentication outside its key context, and that session does not activate; its transport frames are misrouted and dropped. The affected peer may experience a persistent, silent loss of data-plane connectivity while the conflicting session indexes remain in use - from its own point of view its handshakes appear to succeed, and no explicit error or warning was observed in the tested build. The uniqueness invariant that an index identifies exactly one session per device is broken, and transport routing becomes ambiguous by construction. AEAD keys remain peer-specific: index-based peer lookups can select the wrong peer slot for messages carrying a colliding receiver index, and subsequent authentication under the incorrect peer's key context fails, causing the affected messages to be dropped. The damage is availability and routing integrity, not confidentiality.
Attack vector: for a single existing index, the collision probability is approximately 2^-32 per independent uniformly random index allocation, and the probability of colliding with any already-allocated index increases with the number of allocated indexes. The collision cannot be practically forced remotely - forcing one would require on the order of hundreds of millions of handshakes. The condition is reached through configuration (more than one peer slot) plus an unlucky random draw, not through a crafted input: configuring more than one peer does not by itself cause any failure, it only enables the broken uniqueness check to accept a duplicate instead of rejecting it. This is a correctness and availability defect for multi-peer deployments, not a remotely exploitable memory-safety issue; the single-peer default is unaffected.
Patch status: as of the report date (2026-10-21), the defect remains present in the inspected upstream main revision (c54f20db), where the uniqueness loop matches the description; no corresponding fix was identified there.
Fix direction: accumulate the comparison across iterations (existing |= ...) instead of overwriting it, or hoist the loop into a small helper returning a bool. A regression test would configure multiple peers and force an index allocation after the first to observe acceptance versus rejection.
Proof and external disclosure: vendor informed via the GitHub issue at https://github.com/smartalock/wireguard-lwip/issues/22 |
|---|
| 원천 | ⚠️ https://github.com/smartalock/wireguard-lwip/issues/22 |
|---|
| 사용자 | Timmmy (UID 102264) |
|---|
| 제출 | 2026. 10. 21. AM 02:46 (1 월 ago) |
|---|
| 모더레이션 | 2026. 11. 19. PM 07:54 (30 days later) |
|---|
| 상태 | 수락 |
|---|
| VulDB 항목 | 440647 [smartalock wireguard-lwip 까지 cfba91666590e86bd67842c71cedf9a423be823a Session Index Allocator src/wireguard.c wireguard_generate_unique_index receiver_index 서비스 거부] |
|---|
| 포인트들 | 20 |
|---|