public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/hivex] rawhide: Avoid out of bounds read in "db" record (CVE-2026-120740)
@ 2026-11-05  8:29 Richard W.M. Jones
  0 siblings, 0 replies; only message in thread
From: Richard W.M. Jones @ 2026-11-05  8:29 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/hivex
Branch : rawhide
Commit : 70b1c80dd8cd7ed0f871f4efbbaaacaccaca1fc7
Author : Richard W.M. Jones <rich@annexia.org>
Date   : 2026-11-05T08:28:33+00:00
Stats  : +66/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/hivex/c/70b1c80dd8cd7ed0f871f4efbbaaacaccaca1fc7?branch=rawhide

Log:
Avoid out of bounds read in "db" record (CVE-2026-120740)

---
diff --git a/0001-lib-value.c-Avoid-out-of-bounds-read-in-db-record-CV.patch b/0001-lib-value.c-Avoid-out-of-bounds-read-in-db-record-CV.patch
new file mode 100644
index 0000000..242769c
--- /dev/null
+++ b/0001-lib-value.c-Avoid-out-of-bounds-read-in-db-record-CV.patch
@@ -0,0 +1,56 @@
+From aa9acb0e2e980913ecf9fb47c561fe7988089e89 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rich@annexia.org>
+Date: Sun, 1 Nov 2026 11:50:20 +0000
+Subject: [PATCH] lib/value.c: Avoid out of bounds read in "db" record
+ (CVE-2026-120740)
+
+A "db" record in the registry references a list of blocks which get
+concatenated together to return the value.  The list of blocks itself
+is list of values stored in a block, with the number of values
+declared in the nr_blocks field of the db record.
+
+nr_blocks is read from the file, therefore controlled by an attacker.
+
+We did not check that nr_blocks does not exceed the size of the actual
+length of the block containing the list of values, or indeed of the
+entire hive file.
+
+Thus an attacker could cause hivex to read past the end of the hive
+file, resulting in (most likely) a denial of service, or reading other
+memory from the process.
+
+The commit adds the check.
+
+Reported-by: HaiND (Nguyen Dinh Hai), Post and Telecommunication Institute of Technology
+Link: https://hackmd.io/@haindpwn/hivex-value-db-blocklist-oob-read
+Link: https://access.redhat.com/security/cve/CVE-2026-120740
+Link: https://bugzilla.redhat.com/show_bug.cgi?id=2565405
+Fixes: https://github.com/libguestfs/hivex/issues/39
+---
+ lib/value.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/lib/value.c b/lib/value.c
+index 3257b53..862453e 100644
+--- a/lib/value.c
++++ b/lib/value.c
+@@ -408,6 +408,16 @@ hivex_value_value (hive_h *h, hive_value_h value,
+     }
+     struct ntreg_value_list *bl =
+       (struct ntreg_value_list *) ((char *) h->addr + blocklist_offset);
++    /* nr_blocks is an attacker-controlled field from the db record.
++     * The block list array must fit inside its own block.
++     */
++    size_t bllen = block_len (h, blocklist_offset, NULL);
++    if (4 + nr_blocks * 4 > bllen) {
++      SET_ERRNO (EFAULT, "db block list is too long (%zu, %zu)",
++                 nr_blocks, len);
++      free (ret);
++      return NULL;
++    }
+     size_t i, off;
+     for (i = off = 0; i < nr_blocks; ++i) {
+       size_t subblock_offset = le32toh (bl->offset[i]);
+-- 
+2.55.0
+

diff --git a/hivex.spec b/hivex.spec
index f5e6782..0ea7e10 100644
--- a/hivex.spec
+++ b/hivex.spec
@@ -10,7 +10,7 @@
 
 Name:           hivex
 Version:        1.3.24
-Release:        24%{?dist}
+Release:        25%{?dist}
 Summary:        Read and write Windows Registry binary hive files
 
 License:        LGPL-2.1-only AND LGPL-2.0-or-later AND GPL-2.0-or-later
@@ -26,6 +26,12 @@ Source1:        http://libguestfs.org/download/hivex/%{name}-%{version}.tar.gz.s
 Source2:       https://download.libguestfs.org/rich@annexia.org-pubkey.txt
 %endif
 
+# Fix for CVE-2026-120740
+# https://access.redhat.com/security/cve/CVE-2026-120740
+# https://bugzilla.redhat.com/show_bug.cgi?id=2565405
+# https://github.com/libguestfs/hivex/commit/aa9acb0e2e980913ecf9fb47c561fe7988089e89
+Patch:          0001-lib-value.c-Avoid-out-of-bounds-read-in-db-record-CV.patch
+
 BuildRequires:  make
 BuildRequires:  autoconf, automake, libtool, gettext-devel
 BuildRequires:  perl-interpreter
@@ -319,6 +325,9 @@ fi
 
 
 %changelog
+* Thu Nov 05 2026 Richard W.M. Jones <rjones@redhat.com> - 1.3.24-25
+- Avoid out of bounds read in "db" record (CVE-2026-120740)
+
 * Tue Nov 03 2026 Jakub Jelen <jjelen@redhat.com> - 1.3.24-24
 - Verify upstream source signatures with openpgpverify
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-05  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05  8:29 [rpms/hivex] rawhide: Avoid out of bounds read in "db" record (CVE-2026-120740) Richard W.M. Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox