* [PATCH] gdhcp: fix stack buffer overflow in get_domains()
@ 2026-10-23 8:53 Andrei Miu
2026-10-23 10:54 ` Greg KH
2026-12-04 6:47 ` [PATCH] gdhcp: bound DHCPv6 domain-list parsing Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco)
0 siblings, 2 replies; 4+ messages in thread
From: Andrei Miu @ 2026-10-23 8:53 UTC (permalink / raw)
To: connman; +Cc: cve
[-- Attachment #1.1: Type: text/plain, Size: 3662 bytes --]
gdhcp: fix stack buffer overflow in get_domains()
get_domains() copied a fixed NS_MAXDNAME (1025) bytes from the
DOMAIN_LIST (option 24) value into the 1026-byte stack buffer
dns_name regardless of the actual option length, and then walked
DNS labels with an unbounded 'c += jump + 1' loop. A crafted
DHCPv6 REPLY with a DOMAIN_LIST option of >= 1025 non-zero bytes
makes the label walk leave the buffer and read/write '.' past its
end in attacker-chosen strides (stride = label byte + 1), i.e.
out-of-bounds accesses past the 1026-byte stack buffer in
connmand (running as root). On stack-zeroing kernels the walk
performs an out-of-bounds read instead and exits at the first
zero byte.
DHCPv6 REPLY messages are unauthenticated and the transaction id
and CLIENTID DUID are observable on the wire (INFORMATION-REQUEST
is multicast to ff02::1:2), so any on-link attacker can trigger
this.
Fix by bounding the copy to the remaining option length,
NUL-terminating the buffer, and
stopping the label walk at the
end of the copied data.
Fixes: bb06c47101ca24 ("gdhcp: Domain search list DHCPv6 option is checked")
---
Hello,
I found a stack out-of-bounds read/write in get_domains()
(gdhcp/client.c), reached from an accepted DHCPv6 REPLY
DOMAIN_LIST option. Details:
- Trigger requires only on-link position: a forgeable RA (O=1)
makes connmand start stateless DHCPv6, it multicasts an
INFORMATION-REQUEST with DOMAIN_LIST in the ORO to ff02::1:2,
and an attacker who lifts the xid and CLIENTID off the wire can
unicast a forged REPLY (matching xid, equal CLIENTID, one
SERVERID) carrying a long DOMAIN_LIST option. gdhcp's owner
check accepts it and get_dhcpv6_request() reaches get_domains().
- The out-of-bounds access is confirmed with an AddressSanitizer
harness built from the verbatim get_domains(): for a DOMAIN_LIST
value of >= 1025 non-zero bytes the label walk leaves the
1026-byte dns_name buffer, e.g. "stack-buffer-ove
rflow ...
'[48, 1074) dns_name' ... access at offset 1104 overflows this
variable", i.e. ~30 bytes past the buffer, in the
'while (c && *c)' loop.
- The out-of-bounds writes ('.' at attacker-chosen strides) reach
the stack canary / saved-register region. Whether the canary is
actually clobbered depends on the fill pattern and stack layout:
a small stride reliably corrupts it and aborts connmand (root)
with "*** stack smashing detected ***" / SIGABRT, while a large
stride can step over the canary and still perform OOB
read/writes. Net effect: an unauthenticated on-link attacker can
crash the root daemon.
- The patch below was tested against a 7505-case corpus (option
sizes 0..1500 x fill patterns {0x41, 0x00, 0xff, random,
random-with-NULs}) under ASAN + stack protector with zero
findings and no abort.
- The copy and walk are unchanged since 2013 (bb06c471), and I
did not find an existing CVE for get_domains() / option 24.
CVE-2023-2
8488 is the L2 DHCPv4 length fix (99e2c16e), a
different code path.
- Suggested CVSS 3.1: AV:A/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H = 7.6
(CWE-787 / CWE-125). Cc to cve@kernel.org in case a CVE is
warranted. I do not claim RCE; it is not demonstrated.
Separately, a smaller thing I'd ask you to confirm (probably no
CVE): dhcpv6_send_packet() in gdhcp/common.c binds a fresh
wildcard ::546 socket per send and passes IPV6_PKTINFO as a cmsg
only, without setsockopt(IPV6_PKTINFO), so stateless DHCPv6
requests appear to egress the default-route interface rather than
the service's interface (seen on a 3-interface host: the INFO-REQ
for a veth-hosted service left via eth0 with eth0's source
address).
Regards,
Andrei Miu
[-- Attachment #1.2: 0001-gdhcp-fix-stack-buffer-overflow-in-get_domains.patch --]
[-- Type: text/plain, Size: 2188 bytes --]
From 9c2e3f0f85370ecee33e09bfce1b8aa8c1c554d4 Mon Sep 17 00:00:00 2001
From: Andrei Miu <andimiu@pm.me>
Date: Thu, 23 Oct 2026 10:00:00 +0200
Subject: [PATCH] gdhcp: fix stack buffer overflow in get_domains()
get_domains() copied a fixed NS_MAXDNAME (1025) bytes from the
DOMAIN_LIST (option 24) value into the 1026-byte stack buffer
dns_name regardless of the actual option length, and then walked
DNS labels with an unbounded 'c += jump + 1' loop. A crafted
DHCPv6 REPLY with a DOMAIN_LIST option of >= 1025 non-zero bytes
makes the label walk leave the buffer and read/write '.' past its
end in attacker-chosen strides (stride = label byte + 1), i.e.
out-of-bounds writes into the canary/saved registers territory of
connmand (running as root). On stack-zeroing kernels the walk
performs an out-of-bounds read instead and exits at the first
zero byte.
DHCPv6 REPLY messages are unauthenticated and the transaction id
and CLIENTID DUID are observable on the wire (INFORMATION-REQUEST
is multicast to ff02::1:2), so any on-link attacker can trigger
this.
Fix by bounding the copy to the remaining option length,
NUL-terminating the buffer, and stopping the label walk at the
end of the copied data.
Fixes: bb06c47101ca24 ("gdhcp: Domain search list DHCPv6 option is checked")
---
gdhcp/client.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 976773ac..b594e349 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2217,13 +2217,25 @@ static GList *get_domains(int maxlen, unsigned char *value)
return NULL;
while (pos < maxlen) {
- strncpy(dns_name, (char *)&value[pos], NS_MAXDNAME);
+ int name_len = maxlen - pos;
+ char *name_end;
+ if (name_len > NS_MAXDNAME)
+ name_len = NS_MAXDNAME;
+
+ memcpy(dns_name, &value[pos], name_len);
+ dns_name[name_len] = '\0';
+
+ name_end = dns_name + name_len;
c = (unsigned char *)dns_name;
while (c && *c) {
int jump;
+ char *label = (char *)c;
+
jump = *c;
- *c = '.';
+ if (label + jump + 1 > name_end)
+ break;
+ *label = '.';
c += jump + 1;
}
list = g_list_prepend(list, g_strdup(&dns_name[1]));
--
2.55.0
[-- Attachment #1.3: publickey - andimiu@pm.me - 0x897A3D75.asc --]
[-- Type: application/pgp-keys, Size: 873 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 322 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gdhcp: fix stack buffer overflow in get_domains()
2026-10-23 8:53 [PATCH] gdhcp: fix stack buffer overflow in get_domains() Andrei Miu
@ 2026-10-23 10:54 ` Greg KH
2026-12-04 6:47 ` [PATCH] gdhcp: bound DHCPv6 domain-list parsing Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco)
1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-10-23 10:54 UTC (permalink / raw)
To: Andrei Miu; +Cc: connman, cve
On Fri, Oct 23, 2026 at 08:53:35AM +0000, Andrei Miu wrote:
> gdhcp: fix stack buffer overflow in get_domains()
<formletter>
Please see:
https://www.kernel.org/doc/html/latest/process/cve.html
for how kernel CVEs are assigned.
</formletter>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] gdhcp: bound DHCPv6 domain-list parsing
2026-10-23 8:53 [PATCH] gdhcp: fix stack buffer overflow in get_domains() Andrei Miu
2026-10-23 10:54 ` Greg KH
@ 2026-12-04 6:47 ` Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco)
2026-12-04 10:09 ` Greg KH
1 sibling, 1 reply; 4+ messages in thread
From: Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco) @ 2026-12-04 6:47 UTC (permalink / raw)
To: andimiu; +Cc: connman, cve, deeratho, vchavda, Ashishkumar Parmar
From: Ashishkumar Parmar <asparmar@cisco.com>
get_domains() copies a fixed NS_MAXDNAME bytes from the DHCPv6
domain-list option and follows label lengths without checking the
remaining bytes. A short option can make the copy read beyond its
input, while a malformed length can move the label walk beyond the
stack buffer.
Bound the copy by the remaining option length. Check each label length
and the terminating zero in the original option bytes before adding a
name. Reading those bytes from the option prevents strncpy() padding
from masquerading as a wire terminator. Reject label lengths above 63
and NUL bytes within labels before constructing the returned C string.
Reject ASCII whitespace in labels because ConnMan writes the returned
domains into resolv.conf without escaping; a newline could inject a
second directive. Limit each encoded domain name to 255 bytes,
including its root label. Return an empty-string entry for a root
domain, including a root-only list.
Add tests for root domains, malformed labels, NUL and whitespace in
labels, an injected resolv.conf line, and the 255/256-byte wire-name
boundary. Cover a nonterminated 1025-byte option that triggers the
original out-of-bounds walk, and a valid multi-name option longer than
255 bytes.
This adapts Andrei Miu's proposed fix:
<https://lore.kernel.org/connman/179274561161.81299.4579745057858200074@pm.me/>
Fixes: bb06c47101ca24 ("gdhcp: Domain search list DHCPv6 option is checked")
CVE: CVE-2026-115863
Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
---
Makefile.am | 12 +-
gdhcp/client.c | 31 +-----
gdhcp/domains.c | 81 ++++++++++++++
gdhcp/domains.h | 16 +++
unit/test-gdhcp-domains.c | 223 ++++++++++++++++++++++++++++++++++++++
5 files changed, 332 insertions(+), 31 deletions(-)
create mode 100644 gdhcp/domains.c
create mode 100644 gdhcp/domains.h
create mode 100644 unit/test-gdhcp-domains.c
diff --git a/Makefile.am b/Makefile.am
index 23c5dabe..7966cf48 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,7 +36,8 @@ if BACKTRACE
backtrace_sources = src/backtrace.c
endif
-gdhcp_sources = gdhcp/gdhcp.h gdhcp/common.h gdhcp/common.c gdhcp/client.c \
+gdhcp_sources = gdhcp/gdhcp.h gdhcp/common.h gdhcp/common.c gdhcp/domains.h \
+ gdhcp/domains.c gdhcp/client.c \
gdhcp/server.c gdhcp/unaligned.h
gweb_sources = gweb/gweb.h gweb/gweb.c gweb/gresolv.h gweb/gresolv.c
@@ -325,8 +326,15 @@ unit_test_ippool_LDADD = gdbus/libgdbus-internal.la \
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/build-aux/tap-driver.sh
+LOG_COMPILER = $(SHELL) -c 'exec "$$@" --tap' --
-TESTS = unit/test-ippool
+noinst_PROGRAMS += unit/test-gdhcp-domains
+
+unit_test_gdhcp_domains_SOURCES = gdhcp/domains.h gdhcp/domains.c \
+ unit/test-gdhcp-domains.c
+unit_test_gdhcp_domains_LDADD = @GLIB_LIBS@
+
+TESTS = unit/test-ippool unit/test-gdhcp-domains
if WISPR
noinst_PROGRAMS += tools/wispr
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 976773ac..1683b0cc 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -48,6 +48,7 @@
#include "../src/shared/arp.h"
#include "gdhcp.h"
#include "common.h"
+#include "domains.h"
#define DISCOVER_TIMEOUT 5
#define DISCOVER_RETRIES 6
@@ -2205,34 +2206,6 @@ static GList *get_addresses(GDHCPClient *dhcp_client,
return list;
}
-static GList *get_domains(int maxlen, unsigned char *value)
-
-{
- GList *list = NULL;
- int pos = 0;
- unsigned char *c;
- char dns_name[NS_MAXDNAME + 1];
-
- if (!value || maxlen < 3)
- return NULL;
-
- while (pos < maxlen) {
- strncpy(dns_name, (char *)&value[pos], NS_MAXDNAME);
-
- c = (unsigned char *)dns_name;
- while (c && *c) {
- int jump;
- jump = *c;
- *c = '.';
- c += jump + 1;
- }
- list = g_list_prepend(list, g_strdup(&dns_name[1]));
- pos += (char *)c - dns_name + 1;
- }
-
- return g_list_reverse(list);
-}
-
static GList *get_dhcpv6_option_value_list(GDHCPClient *dhcp_client,
int code, int len,
unsigned char *value,
@@ -2276,7 +2249,7 @@ static GList *get_dhcpv6_option_value_list(GDHCPClient *dhcp_client,
break;
case G_DHCPV6_DOMAIN_LIST:
- list = get_domains(len, value);
+ list = gdhcp_get_domains(len, value);
break;
default:
diff --git a/gdhcp/domains.c b/gdhcp/domains.c
new file mode 100644
index 00000000..a7846c35
--- /dev/null
+++ b/gdhcp/domains.c
@@ -0,0 +1,81 @@
+/*
+ * DHCPv6 domain-list parser.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <resolv.h>
+#include <string.h>
+
+#include "domains.h"
+
+#define DNS_MAX_WIRE_NAME 255
+
+GList *gdhcp_get_domains(int maxlen, unsigned char *value)
+{
+ GList *list = NULL;
+ int pos = 0;
+ char dns_name[NS_MAXDNAME + 1];
+
+ if (!value || maxlen < 1)
+ return NULL;
+
+ while (pos < maxlen) {
+ int name_len = maxlen - pos;
+ int label_pos = 0;
+
+ if (name_len > NS_MAXDNAME)
+ name_len = NS_MAXDNAME;
+ /* RFC 1035 limits each encoded name, including root, to 255 bytes. */
+ if (name_len > DNS_MAX_WIRE_NAME)
+ name_len = DNS_MAX_WIRE_NAME;
+
+ strncpy(dns_name, (char *)&value[pos], name_len);
+ dns_name[name_len] = '\0';
+
+ /* Read label lengths from the option, not the padded copy. */
+ while (label_pos < name_len && value[pos + label_pos]) {
+ int jump = value[pos + label_pos];
+ int remaining = name_len - label_pos;
+ int i;
+
+ /* A label needs its length byte, payload, and a root terminator. */
+ if (jump > 63 || jump + 1 >= remaining)
+ goto malformed;
+
+ /* NUL truncates the result; whitespace corrupts resolv.conf. */
+ for (i = 0; i < jump; i++) {
+ unsigned char c = value[pos + label_pos + 1 + i];
+
+ if (c == '\0' || c == ' ' ||
+ (c >= '\t' && c <= '\r'))
+ goto malformed;
+ }
+
+ dns_name[label_pos] = '.';
+ label_pos += jump + 1;
+ }
+
+ /* The option must contain the zero-length root label. */
+ if (label_pos == name_len)
+ goto malformed;
+
+ if (label_pos == 0)
+ list = g_list_prepend(list, g_strdup(""));
+ else
+ list = g_list_prepend(list, g_strdup(&dns_name[1]));
+ pos += label_pos + 1;
+ }
+
+ return g_list_reverse(list);
+
+malformed:
+ g_list_free_full(list, g_free);
+ return NULL;
+}
diff --git a/gdhcp/domains.h b/gdhcp/domains.h
new file mode 100644
index 00000000..b4ee6969
--- /dev/null
+++ b/gdhcp/domains.h
@@ -0,0 +1,16 @@
+/*
+ * DHCPv6 domain-list parser.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __G_DHCP_DOMAINS_H
+#define __G_DHCP_DOMAINS_H
+
+#include <glib.h>
+
+GList *gdhcp_get_domains(int maxlen, unsigned char *value);
+
+#endif /* __G_DHCP_DOMAINS_H */
diff --git a/unit/test-gdhcp-domains.c b/unit/test-gdhcp-domains.c
new file mode 100644
index 00000000..cdd43c76
--- /dev/null
+++ b/unit/test-gdhcp-domains.c
@@ -0,0 +1,223 @@
+/*
+ * DHCPv6 domain-list parser regression tests.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <string.h>
+
+#include "../gdhcp/domains.h"
+
+static void test_root_domain_only(void)
+{
+ unsigned char value[] = { 0 };
+ GList *domains = gdhcp_get_domains(sizeof(value), value);
+
+ g_assert_nonnull(domains);
+ g_assert_cmpuint(g_list_length(domains), ==, 1);
+ g_assert_cmpstr(domains->data, ==, "");
+ g_list_free_full(domains, g_free);
+}
+
+static void test_root_domain_followed_by_domain(void)
+{
+ unsigned char value[] = {
+ 0,
+ 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
+ 3, 'c', 'o', 'm', 0,
+ };
+ GList *domains = gdhcp_get_domains(sizeof(value), value);
+
+ g_assert_nonnull(domains);
+ g_assert_cmpuint(g_list_length(domains), ==, 2);
+ g_assert_cmpstr(domains->data, ==, "");
+ g_assert_cmpstr(domains->next->data, ==, "example.com");
+ g_list_free_full(domains, g_free);
+}
+
+static void test_truncated_label(void)
+{
+ unsigned char value[] = { 4, 't', 'e' };
+
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+}
+
+static void test_missing_terminator(void)
+{
+ unsigned char value[] = { 3, 'f', 'o', 'o' };
+
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+}
+
+static void test_padding_is_not_wire_terminator(void)
+{
+ unsigned char value[] = { 1, 'a', 3, 'f', '\0', 'x', 1, '\0' };
+
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+}
+
+static void test_embedded_nul_in_label(void)
+{
+ unsigned char value[] = { 3, 'a', '\0', 'b', 0 };
+
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+}
+
+static void test_whitespace_in_label(void)
+{
+ static const unsigned char whitespace[] = {
+ ' ', '\t', '\n', '\r', '\v', '\f',
+ };
+ unsigned char value[] = { 3, 'a', ' ', 'b', 0 };
+ unsigned int i;
+
+ for (i = 0; i < sizeof(whitespace); i++) {
+ value[2] = whitespace[i];
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+ }
+}
+
+static void test_resolv_conf_line_injection(void)
+{
+ unsigned char value[] = {
+ 20, 'a', '\n',
+ 'n', 'a', 'm', 'e', 's', 'e', 'r', 'v', 'e', 'r',
+ ' ', '1', '.', '2', '.', '3', '.', '4', 0,
+ };
+
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+}
+
+static void test_printable_punctuation_in_label(void)
+{
+ unsigned char value[] = { 7, 'f', 'o', 'o', '_', 'b', 'a', 'r', 0 };
+ GList *domains = gdhcp_get_domains(sizeof(value), value);
+
+ g_assert_nonnull(domains);
+ g_assert_cmpuint(g_list_length(domains), ==, 1);
+ g_assert_cmpstr(domains->data, ==, "foo_bar");
+ g_list_free_full(domains, g_free);
+}
+
+static void test_invalid_label_length(void)
+{
+ unsigned char value[194];
+
+ memset(value + 1, 'a', 64);
+ value[0] = 64;
+ value[65] = 0;
+ g_assert_null(gdhcp_get_domains(66, value));
+
+ memset(value + 1, 'a', 192);
+ value[0] = 0xc0;
+ value[193] = 0;
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+}
+
+static void test_wire_name_length_limit(void)
+{
+ unsigned char value[256];
+ GList *domains;
+ int pos = 0;
+ int i;
+
+ for (i = 0; i < 3; i++) {
+ value[pos++] = 63;
+ memset(value + pos, 'a' + i, 63);
+ pos += 63;
+ }
+ value[pos++] = 61;
+ memset(value + pos, 'd', 61);
+ pos += 61;
+ value[pos++] = 0;
+
+ g_assert_cmpint(pos, ==, 255);
+ domains = gdhcp_get_domains(pos, value);
+ g_assert_nonnull(domains);
+ g_assert_cmpuint(g_list_length(domains), ==, 1);
+ g_assert_cmpuint(strlen(domains->data), ==, 253);
+ g_list_free_full(domains, g_free);
+
+ /* Extend the last label by one byte: root is now byte 256. */
+ value[192] = 62;
+ value[254] = 'd';
+ value[255] = 0;
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+}
+
+static void test_nonterminated_long_option(void)
+{
+ unsigned char value[1025];
+
+ memset(value, 63, sizeof(value));
+ g_assert_null(gdhcp_get_domains(sizeof(value), value));
+}
+
+static void test_multiple_names_in_long_option(void)
+{
+ unsigned char value[258];
+ GList *domains;
+ GList *entry;
+ int pos = 0;
+ int i;
+
+ for (i = 0; i < 2; i++) {
+ value[pos++] = 63;
+ memset(value + pos, 'a' + i, 63);
+ pos += 63;
+ value[pos++] = 63;
+ memset(value + pos, 'c' + i, 63);
+ pos += 63;
+ value[pos++] = 0;
+ }
+
+ g_assert_cmpint(pos, ==, sizeof(value));
+ domains = gdhcp_get_domains(sizeof(value), value);
+ g_assert_nonnull(domains);
+ g_assert_cmpuint(g_list_length(domains), ==, 2);
+ for (entry = domains; entry; entry = entry->next) {
+ g_assert_cmpuint(strlen(entry->data), ==, 127);
+ g_assert_cmpint(((char *)entry->data)[63], ==, '.');
+ }
+ g_list_free_full(domains, g_free);
+}
+
+int main(int argc, char *argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+
+ g_test_add_func("/gdhcp/domains/root-only", test_root_domain_only);
+ g_test_add_func("/gdhcp/domains/root-followed-by-domain",
+ test_root_domain_followed_by_domain);
+ g_test_add_func("/gdhcp/domains/truncated-label",
+ test_truncated_label);
+ g_test_add_func("/gdhcp/domains/missing-terminator",
+ test_missing_terminator);
+ g_test_add_func("/gdhcp/domains/padding-is-not-wire-terminator",
+ test_padding_is_not_wire_terminator);
+ g_test_add_func("/gdhcp/domains/embedded-nul-in-label",
+ test_embedded_nul_in_label);
+ g_test_add_func("/gdhcp/domains/whitespace-in-label",
+ test_whitespace_in_label);
+ g_test_add_func("/gdhcp/domains/resolv-conf-line-injection",
+ test_resolv_conf_line_injection);
+ g_test_add_func("/gdhcp/domains/printable-punctuation-in-label",
+ test_printable_punctuation_in_label);
+ g_test_add_func("/gdhcp/domains/invalid-label-length",
+ test_invalid_label_length);
+ g_test_add_func("/gdhcp/domains/wire-name-length-limit",
+ test_wire_name_length_limit);
+ g_test_add_func("/gdhcp/domains/nonterminated-long-option",
+ test_nonterminated_long_option);
+ g_test_add_func("/gdhcp/domains/multiple-names-in-long-option",
+ test_multiple_names_in_long_option);
+
+ return g_test_run();
+}
--
2.35.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gdhcp: bound DHCPv6 domain-list parsing
2026-12-04 6:47 ` [PATCH] gdhcp: bound DHCPv6 domain-list parsing Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco)
@ 2026-12-04 10:09 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-12-04 10:09 UTC (permalink / raw)
To: Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco)
Cc: andimiu, connman, cve, deeratho, vchavda
On Thu, Dec 03, 2026 at 10:47:42PM -0800, Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco) wrote:
> From: Ashishkumar Parmar <asparmar@cisco.com>
>
> get_domains() copies a fixed NS_MAXDNAME bytes from the DHCPv6
> domain-list option and follows label lengths without checking the
> remaining bytes. A short option can make the copy read beyond its
> input, while a malformed length can move the label walk beyond the
> stack buffer.
>
> Bound the copy by the remaining option length. Check each label length
> and the terminating zero in the original option bytes before adding a
> name. Reading those bytes from the option prevents strncpy() padding
> from masquerading as a wire terminator. Reject label lengths above 63
> and NUL bytes within labels before constructing the returned C string.
> Reject ASCII whitespace in labels because ConnMan writes the returned
> domains into resolv.conf without escaping; a newline could inject a
> second directive. Limit each encoded domain name to 255 bytes,
> including its root label. Return an empty-string entry for a root
> domain, including a root-only list.
>
> Add tests for root domains, malformed labels, NUL and whitespace in
> labels, an injected resolv.conf line, and the 255/256-byte wire-name
> boundary. Cover a nonterminated 1025-byte option that triggers the
> original out-of-bounds walk, and a valid multi-name option longer than
> 255 bytes.
>
> This adapts Andrei Miu's proposed fix:
> <https://lore.kernel.org/connman/179274561161.81299.4579745057858200074@pm.me/>
>
> Fixes: bb06c47101ca24 ("gdhcp: Domain search list DHCPv6 option is checked")
> CVE: CVE-2026-115863
That's not a kernel.org CVE id, so why are you sending this to us?
confused,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-04 10:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 8:53 [PATCH] gdhcp: fix stack buffer overflow in get_domains() Andrei Miu
2026-10-23 10:54 ` Greg KH
2026-12-04 6:47 ` [PATCH] gdhcp: bound DHCPv6 domain-list parsing Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco)
2026-12-04 10:09 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.