merge openEuler-24.03-LTS-SP3 into openEuler-24.03-LTS-SP3
3 file(s) changed+112-1
Abackport-CVE-2026-95508-1.patch+69-0
| @@ -0,0 +1,69 @@ | |||
| 1 | +From 97f2dd0afea0db8b31135f768ecafe0775722a25 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: Stuart Thomas <stuart.thomas@triageforge.co.uk> | ||
| 3 | +Date: Thu, 17 Sep 2026 00:36:27 +0200 | ||
| 4 | +Subject: [PATCH] dhcpv6: bound the reply against the interface MTU | ||
| 5 | + | ||
| 6 | +dhcpv6_info_request() builds the DHCPv6 REPLY into an mbuf from m_get(), whose | ||
| 7 | +data area is sized to the interface MTU. Two writes into that mbuf are not | ||
| 8 | +bounded against it, so a guest INFO_REQUEST can overflow the reply when the host | ||
| 9 | +interface MTU is small (SlirpConfig.if_mtu; IF_MTU_MIN is 68). The default MTU | ||
| 10 | +(1500) is not affected. | ||
| 11 | + | ||
| 12 | +1) CLIENTID echo (dhcpv6.c:164): memcpy(resp, ri.client_id, ri.client_id_len), | ||
| 13 | + client_id_len guest-controlled up to 256. Overflow iff client_id_len > if_mtu-8 | ||
| 14 | + (attacker-controlled content). | ||
| 15 | + | ||
| 16 | +2) Boot-URL option (dhcpv6.c:181-182): smaxlen is a signed int computed as | ||
| 17 | + m_data + if_mtu - (resp+2). Once the CLIENTID and/or DNS options have advanced | ||
| 18 | + resp past the MTU window, smaxlen is negative; it is passed to slirp_fmt() whose | ||
| 19 | + size parameter is size_t, so the negative value becomes huge and slirp_fmt no | ||
| 20 | + longer truncates -> the formatted URL is written unbounded past the mbuf. Reached | ||
| 21 | + with an ORO requesting OPTION_DNS_SERVERS + OPTION_BOOTFILE_URL (host-controlled | ||
| 22 | + content, but a guest-triggerable OOB write). | ||
| 23 | + | ||
| 24 | +Reject/skip when the reply would not fit the interface-MTU-sized mbuf. | ||
| 25 | +--- | ||
| 26 | + src/dhcpv6.c | 13 +++++++++++++ | ||
| 27 | + 1 file changed, 13 insertions(+) | ||
| 28 | + | ||
| 29 | +diff --git a/src/dhcpv6.c b/src/dhcpv6.c | ||
| 30 | +index 77b451b9..5821d6de 100644 | ||
| 31 | +--- a/src/dhcpv6.c | ||
| 32 | ++++ b/src/dhcpv6.c | ||
| 33 | +@@ -157,6 +157,11 @@ static void dhcpv6_info_request(Slirp *slirp, struct sockaddr_in6 *srcsas, | ||
| 34 | + *resp++ = (uint8_t)xid; | ||
| 35 | + | ||
| 36 | + if (ri.client_id) { | ||
| 37 | ++ if (resp + 4 + ri.client_id_len > | ||
| 38 | ++ (uint8_t *)m->m_data + slirp->if_mtu) { | ||
| 39 | ++ m_free(m); /* response would overflow the interface-MTU-sized mbuf */ | ||
| 40 | ++ return; | ||
| 41 | ++ } | ||
| 42 | + *resp++ = OPTION_CLIENTID >> 8; /* option-code high byte */ | ||
| 43 | + *resp++ = OPTION_CLIENTID; /* option-code low byte */ | ||
| 44 | + *resp++ = ri.client_id_len >> 8; /* option-len high byte */ | ||
| 45 | +@@ -165,6 +170,10 @@ static void dhcpv6_info_request(Slirp *slirp, struct sockaddr_in6 *srcsas, | ||
| 46 | + resp += ri.client_id_len; | ||
| 47 | + } | ||
| 48 | + if (ri.want_dns) { | ||
| 49 | ++ if (resp + 4 + 16 > (uint8_t *)m->m_data + slirp->if_mtu) { | ||
| 50 | ++ m_free(m); /* reply would not fit the interface-MTU-sized mbuf */ | ||
| 51 | ++ return; | ||
| 52 | ++ } | ||
| 53 | + *resp++ = OPTION_DNS_SERVERS >> 8; /* option-code high byte */ | ||
| 54 | + *resp++ = OPTION_DNS_SERVERS; /* option-code low byte */ | ||
| 55 | + *resp++ = 0; /* option-len high byte */ | ||
| 56 | +@@ -179,6 +188,10 @@ static void dhcpv6_info_request(Slirp *slirp, struct sockaddr_in6 *srcsas, | ||
| 57 | + *resp++ = OPTION_BOOTFILE_URL >> 8; /* option-code high byte */ | ||
| 58 | + *resp++ = OPTION_BOOTFILE_URL; /* option-code low byte */ | ||
| 59 | + smaxlen = (uint8_t *)m->m_data + slirp->if_mtu - (resp + 2); | ||
| 60 | ++ if (smaxlen < 0) { | ||
| 61 | ++ m_free(m); /* boot-url would not fit the interface-MTU-sized mbuf */ | ||
| 62 | ++ return; | ||
| 63 | ++ } | ||
| 64 | + slen = slirp_fmt((char *)resp + 2, smaxlen, | ||
| 65 | + "tftp://[%02x%02x:%02x%02x:%02x%02x:%02x%02x:" | ||
| 66 | + "%02x%02x:%02x%02x:%02x%02x:%02x%02x]/%s", | ||
| 67 | +-- | ||
| 68 | +GitLab | ||
| 69 | + | ||
Abackport-CVE-2026-95508-2.patch+37-0
Mlibslirp.spec+6-1
Comments
Sign in to comment