Re: [oe] [scarthgap][meta-networking][PATCH v2] dnsmasq: fix CVE-2026-4890

Anuj Mittal <[email protected]>
Newsgroups org.openembedded.lists.openembedded-devel
Message-ID <CA+s=J=y-Qxfp5jWcPZi63HYLamsV+G56hZG4wX-4BLvC5KH+CA@mail.gmail.com>
Hi,

On Wed, Jul 1, 2026 at 8:55 PM Benjamin Robin via
lists.openembedded.org
<[email protected]> wrote:
>
> A Denial of Service (DoS) vulnerability in the DNSSEC validation of
> dnsmasq allows remote attackers to cause a denial of service via a
> crafted DNS packet.
>
> This patch is used by debian bookworm (2.90-4_deb12u2).
>
> Signed-off-by: Benjamin Robin (Schneider Electric) <[email protected]>
> ---
> This patch needs to be applied on top of the previous CVE-2026-2291 patch
> ---
> Changes in v2:
> - Fix email subject
> - Link to v1: https://patch.msgid.link/[email protected]
> ---
>  .../recipes-support/dnsmasq/dnsmasq_2.90.bb        |  1 +
>  .../dnsmasq/files/CVE-2026-4890.patch              | 74 ++++++++++++++++++++++

This doesn't apply.

patching file src/dnssec.c
Hunk #1 FAILED at 1270.
Hunk #2 FAILED at 1301.
Hunk #3 succeeded at 1433 (offset 4 lines).
Hunk #4 FAILED at 1458.
3 out of 4 hunks FAILED -- rejects in file src/dnssec.c
Patch CVE-2026-4890.patch does not apply (enforce with -f)

The final patch merged upstream for this seems different from this
earlier version. But, it'd be good to mention source as:
https://thekelleys.org.uk/dnsmasq/CVE/CVE-2026-4890.dnsmasq-2.91.diff

>  2 files changed, 75 insertions(+)
>
> diff --git a/meta-networking/recipes-support/dnsmasq/dnsmasq_2.90.bb b/meta-networking/recipes-support/dnsmasq/dnsmasq_2.90.bb
> index 3a7af56c34d7..ad79a3bfa828 100644
> --- a/meta-networking/recipes-support/dnsmasq/dnsmasq_2.90.bb
> +++ b/meta-networking/recipes-support/dnsmasq/dnsmasq_2.90.bb
> @@ -21,6 +21,7 @@ SRC_URI = "http://www.thekelleys.org.uk/dnsmasq/${@['archive/', ''][float(d.getV
>             file://CVE-2026-4893.patch \
>             file://CVE-2026-5172.patch \
>             file://CVE-2026-2291.patch \
> +           file://CVE-2026-4890.patch \
>  "
>  SRC_URI[sha256sum] = "8f6666b542403b5ee7ccce66ea73a4a51cf19dd49392aaccd37231a2c51b303b"
>
> diff --git a/meta-networking/recipes-support/dnsmasq/files/CVE-2026-4890.patch b/meta-networking/recipes-support/dnsmasq/files/CVE-2026-4890.patch
> new file mode 100644
> index 000000000000..1c60ae0b798f
> --- /dev/null
> +++ b/meta-networking/recipes-support/dnsmasq/files/CVE-2026-4890.patch
> @@ -0,0 +1,74 @@
> +From 12e5ee3495842ededf8057758ef8da59745bbf33 Mon Sep 17 00:00:00 2001
> +From: Simon Kelley <[email protected]>
> +Date: Fri, 10 Apr 2026 22:16:45 +0100
> +Subject: [PATCH] Fix NSEC bitmap parsing infinite loop. CVE-2026-4890
> +
> +Report from Royce M <[email protected]>.
> +
> +Location: dnssec.c:1290-1306, dnssec.c:1450-1463
> +
> +The bitmap window iteration advances by p[1] instead of p[1]+2 (missing the 2-byte window header). With bitmap_length=0, both rdlen and p are
> +unchanged, causing an infinite loop and dnsmasq stops responding to all queries.
> +
> +The same code accesses p[2] after only checking rdlen >= 2 without verifying p[1] >= 1, causing OOB reads at 6 locations.
> +
> +Both bugs are reachable before RRSIG validation (confirmed by the source comment at line 2125), so no valid DNSSEC signatures are needed.
> +
> +CVE: CVE-2026-4890
> +Upstream-Status: Backport [https://sources.debian.org/src/dnsmasq/2.90-4~deb12u2/debian/patches/CVE-2026-4890.patch]
> +
> +Signed-off-by: Benjamin Robin <[email protected]>
> +---
> + src/dnssec.c | 14 +++++++-------
> + 1 file changed, 7 insertions(+), 7 deletions(-)
> +
> +diff --git a/src/dnssec.c b/src/dnssec.c
> +index ed2f53ff..68f1b5d0 100644
> +--- a/src/dnssec.c
> ++++ b/src/dnssec.c
> +@@ -1270,10 +1270,10 @@ static int prove_non_existence_nsec(struct dns_header *header, size_t plen, unsi
> +            packet checked to be as long as rdlen implies in prove_non_existence() */
> +
> +         /* If we can prove that there's no NS record, return that information. */
> +-        if (nons && rdlen >= 2 && p[0] == 0 && (p[2] & (0x80 >> T_NS)) != 0)
> ++        if (nons && rdlen >= 2 && p[0] == 0 && p[1] >= 1  && (p[2] & (0x80 >> T_NS)) != 0)
> +           *nons = 0;
> +
> +-        if (rdlen >= 2 && p[0] == 0)
> ++        if (rdlen >= 2 && p[0] == 0 && p[1] >= 1)
> +           {
> +             /* A CNAME answer would also be valid, so if there's a CNAME is should
> +                have been returned. */
> +@@ -1301,8 +1301,8 @@ static int prove_non_existence_nsec(struct dns_header *header, size_t plen, unsi
> +                 break; /* finished checking */
> +               }
> +
> +-            rdlen -= p[1];
> +-            p +=  p[1];
> ++            rdlen -= p[1] + 2;
> ++            p +=  p[1] + 2;
> +           }
> +
> +         return 0;
> +@@ -1429,7 +1429,7 @@ static int check_nsec3_coverage(struct dns_header *header, size_t plen, int dige
> +               p += hash_len; /* skip next-domain hash */
> +               rdlen -= p - psave;
> +
> +-              if (rdlen >= 2 && p[0] == 0)
> ++              if (rdlen >= 2 && p[0] == 0 && p[1] >= 1)
> +                 {
> +                   /* If we can prove that there's no NS record, return that information. */
> +                   if (nons && (p[2] & (0x80 >> T_NS)) != 0)
> +@@ -1458,8 +1458,8 @@ static int check_nsec3_coverage(struct dns_header *header, size_t plen, int dige
> +                       break; /* finished checking */
> +                     }
> +
> +-                  rdlen -= p[1];
> +-                  p +=  p[1];
> ++                  rdlen -= p[1] + 2;
> ++                  p +=  p[1] + 2;
> +                 }
> +
> +               return 1;
> +--
> +2.43.0
>
> ---
> base-commit: b0c2c648a1af89e7a8dd4c2ec841f3bc0ed0ccb9
> change-id: 20260701-dnsmasq-cve-2026-4890-f5b3a76de3ad
> prerequisite-change-id: 20260701-dnsmasq-cve-2026-2291-fc2db33dde8d:v1
> prerequisite-patch-id: e7e3fdcabd23649336d34bd2f492f09007d73472
>
> Best regards,
> --
> Benjamin Robin (Schneider Electric) <[email protected]>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#127995): https://lists.openembedded.org/g/openembedded-devel/message/127995
> Mute This Topic: https://lists.openembedded.org/mt/120064454/3616702
> Group Owner: [email protected]
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
> -=-=-=-=-=-=-=-=-=-=-=-
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.