[Openvpn-devel,v2] forward: drop datagrams from an unspecified source address

Message ID 20261202145451.19416-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v2] forward: drop datagrams from an unspecified source address |

Commit Message

Gert Doering Dec. 2, 2026, 2:54 p.m. UTC
  From: Razvan Cojocaru <razvanc@mailbox.org>

A UDP packet from 0.0.0.0 (sent to 255.255.255.255) or from :: crashed
the receiving process before any authentication:

- p2p without --remote: link_socket_bad_incoming_addr() dereferenced
  the NULL remote_list
- server: the stateless HMAC reset reply was sent to the unspecified
  address and hit the ASSERT in process_outgoing_link(); 2.5 crashed
  like p2p instead

tls-auth/tls-crypt don't prevent it on a server, since a replayed client
reset is answered. Such packets can be sent by hosts on the same link,
and by authenticated clients of a TAP server through their tunnel.

Drop them right after reading, before any other processing.

CVE: 2026-142094
Change-Id: I625256cd3a3054cf94510137f3f4579fc5e8098c
Signed-off-by: Razvan Cojocaru <razvanc@mailbox.org>
Acked-by: Ralf Lici <ralf@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn-private/+/2385
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn-private/+/2385
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Ralf Lici <ralf@mandelbit.com>
  

Patch

diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index b4277db..12ba552 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -1004,6 +1004,15 @@ 
 
     /* Remove socks header if applicable */
     socks_postprocess_incoming_link(c, sock);
+
+    /* A datagram from an unspecified source address (0.0.0.0 or ::)
+     * cannot be answered, and later processing assumes a defined peer */
+    if (c->c2.buf.len > 0 && proto_is_udp(sock->info.proto)
+        && !link_socket_actual_defined(&c->c2.from))
+    {
+        msg(D_LINK_ERRORS, "UDP: dropping packet from unspecified source address");
+        c->c2.buf.len = 0;
+    }
 }
 
 bool