* [OE-core] [scarthgap] [PATCH 1/2] libsolv: Fix CVE-2026-9150
@ 2026-06-16 6:31 Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco)
2026-06-16 6:31 ` [OE-core] [scarthgap] [PATCH 2/2] libsolv: Fix CVE-2026-9149 Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco)
0 siblings, 1 reply; 5+ messages in thread
From: Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco) @ 2026-06-16 6:31 UTC (permalink / raw)
To: openembedded-core; +Cc: xe-linux-external, Shubham Pushpkar
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 4696 bytes --]
From: Shubham Pushpkar <spushpka@cisco.com>
This patch applies the upstream fix as referenced in [1], using the CVE advisory shown in [2].
[1] https://github.com/openSUSE/libsolv/commit/c5b5db52aebde00bdeacecf4d0569c217ab3187d
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-9150
Signed-off-by: Shubham Pushpkar <spushpka@cisco.com>
---
.../libsolv/0001-Fix-CVE-2026-9150.patch | 71 +++++++++++++++++++
.../libsolv/libsolv_0.7.28.bb | 1 +
2 files changed, 72 insertions(+)
create mode 100644 meta/recipes-extended/libsolv/libsolv/0001-Fix-CVE-2026-9150.patch
diff --git a/meta/recipes-extended/libsolv/libsolv/0001-Fix-CVE-2026-9150.patch b/meta/recipes-extended/libsolv/libsolv/0001-Fix-CVE-2026-9150.patch
new file mode 100644
index 0000000000..d1f02b8956
--- /dev/null
+++ b/meta/recipes-extended/libsolv/libsolv/0001-Fix-CVE-2026-9150.patch
@@ -0,0 +1,71 @@
+From 5393983e5b71808151fea4b895a0952ab6bd8a48 Mon Sep 17 00:00:00 2001
+From: Petr Písař <ppisar@redhat.com>
+Date: Wed, 22 Apr 2026 09:18:29 +0200
+Subject: [PATCH 1/2] Fix a buffer overflow when copying SHA-384/512 checksum
+ from a Debian repository
+
+When parsing Debian repository, control2solvable() copies a package
+checksum string from the repository into a stack-allocated "char
+checksum[32 * 2 + 1]" array.
+
+If the repository defined a SHA384 or SHA512 tag, a buffer overflow
+occured (as can be seen when compiling libsolv with CFLAGS='-O0 -g
+-fsanitize=address') because those tag values are longer:
+
+ $ cat /tmp/Packages
+ Package: p
+ Version: 1
+ Architecture: all
+ SHA512: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+ $ /tmp/b/tools/deb2solv -r /tmp/Packages
+ =================================================================
+ ==3695==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7b685ecf0071 at pc 0x7f6861683722 b
+ p 0x7fff37e3e7a0 sp 0x7fff37e3df60
+ WRITE of size 129 at 0x7b685ecf0071 thread T0
+ #0 0x7f6861683721 in strcpy.part.0 (/lib64/libasan.so.8+0x83721) (BuildId: 80bfc4ae44fdec6ef5fecfb01e2b57d28660991c)
+ #1 0x7f6861d7f34d in control2solvable /home/test/libsolv/ext/repo_deb.c:491
+ #2 0x7f6861d804ea in repo_add_debpackages /home/test/libsolv/ext/repo_deb.c:622
+ #3 0x000000400fd5 in main /home/test/libsolv/tools/deb2solv.c:134
+ #4 0x7f686123c680 in __libc_start_call_main (/lib64/libc.so.6+0x3680) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #5 0x7f686123c797 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3797) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #6 0x000000400694 in _start (/tmp/b/tools/deb2solv+0x400694) (BuildId: a3350337819a51edd0c75293970d3458b5033bc9)
+
+ Address 0x7b685ecf0071 is located in stack of thread T0 at offset 113 in frame
+ #0 0x7f6861d7de2a in control2solvable /home/test/libsolv/ext/repo_deb.c:365
+
+ This frame has 1 object(s):
+ [48, 113) 'checksum' (line 371) <== Memory access at offset 113 overflows this variable
+
+This patch fixes it by enlarging the buffer to accomodate the longest
+supported digest string.
+
+This flaw was introduced with c8164bfecf2ba8bcf4c24329534d3104f19da73c
+commit ("[ABI BREAKAGE] add support for SHA224/384/512").
+
+Reported by Aisle Research.
+
+CVE: CVE-2026-9150
+Upstream-Status: Backport [https://github.com/openSUSE/libsolv/commit/c5b5db52aebde00bdeacecf4d0569c217ab3187d]
+
+(cherry picked from commit c5b5db52aebde00bdeacecf4d0569c217ab3187d)
+Signed-off-by: Shubham Pushpkar <spushpka@cisco.com>
+---
+ ext/repo_deb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ext/repo_deb.c b/ext/repo_deb.c
+index d400f959..25eaf8cb 100644
+--- a/ext/repo_deb.c
++++ b/ext/repo_deb.c
+@@ -368,7 +368,7 @@ control2solvable(Solvable *s, Repodata *data, char *control)
+ char *p, *q, *end, *tag;
+ int x, l;
+ int havesource = 0;
+- char checksum[32 * 2 + 1];
++ char checksum[64 * 2 + 1];
+ Id checksumtype = 0;
+ Id newtype;
+
+--
+2.35.6
diff --git a/meta/recipes-extended/libsolv/libsolv_0.7.28.bb b/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
index 201059323a..2b1b079ce1 100644
--- a/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
+++ b/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
@@ -10,6 +10,7 @@ DEPENDS = "expat zlib zstd"
SRC_URI = "git://github.com/openSUSE/libsolv.git;branch=master;protocol=https \
file://0001-utils-Conside-musl-when-wrapping-qsort_r.patch \
+ file://0001-Fix-CVE-2026-9150.patch \
"
SRCREV = "c8dbb3a77c86600ce09d4f80a504cf4e78a3c359"
--
2.35.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [OE-core] [scarthgap] [PATCH 2/2] libsolv: Fix CVE-2026-9149
2026-06-16 6:31 [OE-core] [scarthgap] [PATCH 1/2] libsolv: Fix CVE-2026-9150 Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco)
@ 2026-06-16 6:31 ` Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco)
2026-06-22 21:48 ` Yoann Congal
2026-07-24 12:55 ` [OE-core][scarthgap][PATCH v2] " Deepak Rathore -X (deeratho - E INFOCHIPS PRIVATE LIMITED at Cisco)
0 siblings, 2 replies; 5+ messages in thread
From: Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco) @ 2026-06-16 6:31 UTC (permalink / raw)
To: openembedded-core; +Cc: xe-linux-external, Shubham Pushpkar
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 7869 bytes --]
From: Shubham Pushpkar <spushpka@cisco.com>
This patch applies the upstream fix as referenced in [1], using the CVE advisory shown in [2].
[1] https://github.com/openSUSE/libsolv/commit/210386037c892a720972ad35a3d8f7073b4d763b
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-9149
Signed-off-by: Shubham Pushpkar <spushpka@cisco.com>
---
.../libsolv/0002-Fix-CVE-2026-9149.patch | 152 ++++++++++++++++++
.../libsolv/libsolv_0.7.28.bb | 1 +
2 files changed, 153 insertions(+)
create mode 100644 meta/recipes-extended/libsolv/libsolv/0002-Fix-CVE-2026-9149.patch
diff --git a/meta/recipes-extended/libsolv/libsolv/0002-Fix-CVE-2026-9149.patch b/meta/recipes-extended/libsolv/libsolv/0002-Fix-CVE-2026-9149.patch
new file mode 100644
index 0000000000..11acf758b5
--- /dev/null
+++ b/meta/recipes-extended/libsolv/libsolv/0002-Fix-CVE-2026-9149.patch
@@ -0,0 +1,152 @@
+From 175bd2008d3b3a4b54253bd6657cc46948360534 Mon Sep 17 00:00:00 2001
+From: Petr Písař <ppisar@redhat.com>
+Date: Thu, 23 Apr 2026 18:04:24 +0200
+Subject: [PATCH 2/2] Cope with integer overflow in data size arithmetics in
+ repo_add_solv()
+
+When parsing solv files with maliciously large "maxsize" or "allsize"
+data size, e.g. this maxsize value at offset 0x29--0x2E:
+
+ 00000000 53 4f 4c 56 00 00 00 08 00 00 00 01 00 00 00 00 |SOLV............|
+ 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 |................|
+ 00000020 00 00 00 00 00 00 00 00 00 8f ff ff bf 77 86 8d |.............w..|
+ 00000030 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ...............|
+ 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+ *
+ 00002030 00 |.|
+ 00002031
+
+read_id() function will decode and return 4294959095 value, and a subsequent
+assignment:
+
+ int maxsize;
+ [...]
+ maxsize = read_id(&data, 0);
+
+will experience an integer overflow on plaforms where signed int has 4-byte
+size (e.g. x86_64).
+
+The same flaw is possible at the next line:
+
+ allsize = read_id(&data, 0);
+
+Subsequent arithmetics will interpreter the value as a very large negative
+number, possibly doing wrong decisions:
+
+ maxsize += 5; /* so we can read the next schema of an array */
+ if (maxsize > allsize)
+ maxsize = allsize;
+
+and finally, the negative value passed to solv_calloc():
+
+ buf = solv_calloc(maxsize + DATA_READ_CHUNK + 4, 1); /* 4 extra bytes to detect overflows */
+
+will be coerced to an unsigned type (size_t) leading to allocating a smaller
+buffer then intended. Then writing to the small buffer will experience a heap
+buffer overflow:
+
+ l = maxsize;
+ if (l < DATA_READ_CHUNK)
+ l = DATA_READ_CHUNK;
+ if (l > allsize)
+ l = allsize;
+ if (!l || fread(buf, l, 1, data.fp) != 1)
+
+This flaw can be demostrated by passing that solv file to the dumpsolv tool which
+will crash if compiled with ASAN:
+
+ $ /tmp/b/tools/dumpsolv /tmp/vuln_1_101_1_negative_maxsize.solv
+ =================================================================
+ ==17608==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7c0a2ede00b1 at pc 0x7fea30451468 b
+ p 0x7ffe07220a50 sp 0x7ffe07220220
+ WRITE of size 8192 at 0x7c0a2ede00b1 thread T0
+ #0 0x7fea30451467 in fread.part.0 (/lib64/libasan.so.8+0x51467) (BuildId: 80bfc4ae44fdec6ef5fecfb01
+ e2b57d28660991c)
+ #1 0x7fea3028eef1 in repo_add_solv /home/test/libsolv/src/repo_solv.c:1034
+ #2 0x0000004041cc in main /home/test/libsolv/tools/dumpsolv.c:471
+ #3 0x7fea3003c680 in __libc_start_call_main (/lib64/libc.so.6+0x3680) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #4 0x7fea3003c797 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3797) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #5 0x000000400694 in _start (/tmp/b/tools/dumpsolv+0x400694) (BuildId: 0a70b5b14e5cd81f90a309bb2ff3219dfbf30bb8)
+
+ 0x7c0a2ede00b1 is located 0 bytes after 1-byte region [0x7c0a2ede00b0,0x7c0a2ede00b1)
+ allocated by thread T0 here:
+ #0 0x7fea304ef41f in malloc (/lib64/libasan.so.8+0xef41f) (BuildId: 80bfc4ae44fdec6ef5fecfb01e2b57d28660991c)
+ #1 0x7fea302e4b4c in solv_calloc /home/test/libsolv/src/util.c:77
+ #2 0x7fea3028ee38 in repo_add_solv /home/test/libsolv/src/repo_solv.c:1025
+ #3 0x0000004041cc in main /home/test/libsolv/tools/dumpsolv.c:471
+ #4 0x7fea3003c680 in __libc_start_call_main (/lib64/libc.so.6+0x3680) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #5 0x7fea3003c797 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3797) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #6 0x000000400694 in _start (/tmp/b/tools/dumpsolv+0x400694) (BuildId: 0a70b5b14e5cd81f90a309bb2ff3219dfbf30bb8)
+
+ SUMMARY: AddressSanitizer: heap-buffer-overflow /home/test/libsolv/src/repo_solv.c:1034 in repo_add_solv
+
+This patch catches the integer overflow, sets an error and jumps to the end of
+the function just after deallocation of the buffer (which would contain an
+undefined pointer). This patch also handles a possible integer overflow at
+"maxsize += 5" line.
+
+I originally wanted to replace read_id() with read_u32(), but
+complemtary repowriter_write() function also stored the value as
+a signed integer, so I guess the the Id type is inteded there.
+
+There are probably other ways how to fix it, like passing INT_MAX-5
+limit to read_id(), though the error message would be less
+understandable.
+
+It's also possible to reject this patch with an explanation that loading
+untrusted solv files is not supported. Though some kind of
+fortification would be welcomed by people who debug solver problems
+from reported solv files.
+
+Reported by Aisle Research.
+
+CVE: CVE-2026-9149
+Upstream-Status: Backport [https://github.com/openSUSE/libsolv/commit/210386037c892a720972ad35a3d8f7073b4d763b]
+
+(cherry picked from commit 210386037c892a720972ad35a3d8f7073b4d763b)
+Signed-off-by: Shubham Pushpkar <spushpka@cisco.com>
+---
+ src/repo_solv.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/src/repo_solv.c b/src/repo_solv.c
+index 629ac683..00639aa0 100644
+--- a/src/repo_solv.c
++++ b/src/repo_solv.c
+@@ -18,6 +18,7 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <string.h>
++#include <limits.h>
+
+ #include "repo_solv.h"
+ #include "util.h"
+@@ -1078,6 +1079,18 @@ repo_add_solv(Repo *repo, FILE *fp, int flags)
+
+ maxsize = read_id(&data, 0);
+ allsize = read_id(&data, 0);
++ if (maxsize < 0 || allsize < 0)
++ {
++ data.error = pool_error(pool, SOLV_ERROR_CORRUPT, "negative data size in solv header");
++ id = 0;
++ goto data_error;
++ }
++ if (maxsize > INT_MAX - 5)
++ {
++ data.error = pool_error(pool, SOLV_ERROR_OVERFLOW, "data size overflow in solv header");
++ id = 0;
++ goto data_error;
++ }
+ maxsize += 5; /* so we can read the next schema of an array */
+ if (maxsize > allsize)
+ maxsize = allsize;
+@@ -1403,6 +1416,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key
+ }
+ solv_free(buf);
+
++data_error:
+ if (data.error)
+ {
+ /* free solvables */
+--
+2.35.6
diff --git a/meta/recipes-extended/libsolv/libsolv_0.7.28.bb b/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
index 2b1b079ce1..4a9dd1278a 100644
--- a/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
+++ b/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
@@ -11,6 +11,7 @@ DEPENDS = "expat zlib zstd"
SRC_URI = "git://github.com/openSUSE/libsolv.git;branch=master;protocol=https \
file://0001-utils-Conside-musl-when-wrapping-qsort_r.patch \
file://0001-Fix-CVE-2026-9150.patch \
+ file://0002-Fix-CVE-2026-9149.patch \
"
SRCREV = "c8dbb3a77c86600ce09d4f80a504cf4e78a3c359"
--
2.35.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-core] [scarthgap] [PATCH 2/2] libsolv: Fix CVE-2026-9149
2026-06-16 6:31 ` [OE-core] [scarthgap] [PATCH 2/2] libsolv: Fix CVE-2026-9149 Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco)
@ 2026-06-22 21:48 ` Yoann Congal
2026-07-24 12:56 ` Deepak Rathore
2026-07-24 12:55 ` [OE-core][scarthgap][PATCH v2] " Deepak Rathore -X (deeratho - E INFOCHIPS PRIVATE LIMITED at Cisco)
1 sibling, 1 reply; 5+ messages in thread
From: Yoann Congal @ 2026-06-22 21:48 UTC (permalink / raw)
To: spushpka, openembedded-core; +Cc: xe-linux-external
On Tue Jun 16, 2026 at 8:31 AM CEST, Shubham Pushpkar via lists.openembedded.org wrote:
> From: Shubham Pushpkar <spushpka@cisco.com>
>
> This patch applies the upstream fix as referenced in [1], using the CVE advisory shown in [2].
> [1] https://github.com/openSUSE/libsolv/commit/210386037c892a720972ad35a3d8f7073b4d763b
> [2] https://nvd.nist.gov/vuln/detail/CVE-2026-9149
>
> Signed-off-by: Shubham Pushpkar <spushpka@cisco.com>
> ---
Hello,
Looks to me that this patch is also needed on wrynose.
Can you send it there, and then, send a v2 of this patch?
Thanks!
> .../libsolv/0002-Fix-CVE-2026-9149.patch | 152 ++++++++++++++++++
Those patch are usually named "CVE-2026-9149.patch"
> .../libsolv/libsolv_0.7.28.bb | 1 +
> 2 files changed, 153 insertions(+)
> create mode 100644 meta/recipes-extended/libsolv/libsolv/0002-Fix-CVE-2026-9149.patch
> [...]
> diff --git a/meta/recipes-extended/libsolv/libsolv_0.7.28.bb b/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
> index 2b1b079ce1..4a9dd1278a 100644
> --- a/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
> +++ b/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
> @@ -11,6 +11,7 @@ DEPENDS = "expat zlib zstd"
> SRC_URI = "git://github.com/openSUSE/libsolv.git;branch=master;protocol=https \
> file://0001-utils-Conside-musl-when-wrapping-qsort_r.patch \
> file://0001-Fix-CVE-2026-9150.patch \
CVE-2026-9150 was already fixed by a very similar patch sent earlier so
you will need to rebase once it merges.
> + file://0002-Fix-CVE-2026-9149.patch \
> "
>
> SRCREV = "c8dbb3a77c86600ce09d4f80a504cf4e78a3c359"
--
Yoann Congal
Smile ECS
^ permalink raw reply [flat|nested] 5+ messages in thread
* [OE-core][scarthgap][PATCH v2] libsolv: Fix CVE-2026-9149
2026-06-16 6:31 ` [OE-core] [scarthgap] [PATCH 2/2] libsolv: Fix CVE-2026-9149 Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco)
2026-06-22 21:48 ` Yoann Congal
@ 2026-07-24 12:55 ` Deepak Rathore -X (deeratho - E INFOCHIPS PRIVATE LIMITED at Cisco)
1 sibling, 0 replies; 5+ messages in thread
From: Deepak Rathore -X (deeratho - E INFOCHIPS PRIVATE LIMITED at Cisco) @ 2026-07-24 12:55 UTC (permalink / raw)
To: openembedded-core
From: Shubham Pushpkar <spushpka@cisco.com>
This patch applies the upstream fix as referenced in [1], using the CVE advisory shown in [2].
[1] https://github.com/openSUSE/libsolv/commit/210386037c892a720972ad35a3d8f7073b4d763b
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-9149
Signed-off-by: Shubham Pushpkar <spushpka@cisco.com>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
(cherry picked from commit d3fc48836349e81369f5680d808d2e469fce626a)
Signed-off-by: Deepak Rathore <deeratho@cisco.com>
---
- Changes from v1 to v2: Rebased on top of latest merge commit of scarthgap
and cherry pick it from wrynose
diff --git a/meta/recipes-extended/libsolv/libsolv/CVE-2026-9149.patch b/meta/recipes-extended/libsolv/libsolv/CVE-2026-9149.patch
new file mode 100644
index 0000000000..11acf758b5
--- /dev/null
+++ b/meta/recipes-extended/libsolv/libsolv/CVE-2026-9149.patch
@@ -0,0 +1,152 @@
+From 175bd2008d3b3a4b54253bd6657cc46948360534 Mon Sep 17 00:00:00 2001
+From: Petr Písař <ppisar@redhat.com>
+Date: Thu, 23 Apr 2026 18:04:24 +0200
+Subject: [PATCH 2/2] Cope with integer overflow in data size arithmetics in
+ repo_add_solv()
+
+When parsing solv files with maliciously large "maxsize" or "allsize"
+data size, e.g. this maxsize value at offset 0x29--0x2E:
+
+ 00000000 53 4f 4c 56 00 00 00 08 00 00 00 01 00 00 00 00 |SOLV............|
+ 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 |................|
+ 00000020 00 00 00 00 00 00 00 00 00 8f ff ff bf 77 86 8d |.............w..|
+ 00000030 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ...............|
+ 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
+ *
+ 00002030 00 |.|
+ 00002031
+
+read_id() function will decode and return 4294959095 value, and a subsequent
+assignment:
+
+ int maxsize;
+ [...]
+ maxsize = read_id(&data, 0);
+
+will experience an integer overflow on plaforms where signed int has 4-byte
+size (e.g. x86_64).
+
+The same flaw is possible at the next line:
+
+ allsize = read_id(&data, 0);
+
+Subsequent arithmetics will interpreter the value as a very large negative
+number, possibly doing wrong decisions:
+
+ maxsize += 5; /* so we can read the next schema of an array */
+ if (maxsize > allsize)
+ maxsize = allsize;
+
+and finally, the negative value passed to solv_calloc():
+
+ buf = solv_calloc(maxsize + DATA_READ_CHUNK + 4, 1); /* 4 extra bytes to detect overflows */
+
+will be coerced to an unsigned type (size_t) leading to allocating a smaller
+buffer then intended. Then writing to the small buffer will experience a heap
+buffer overflow:
+
+ l = maxsize;
+ if (l < DATA_READ_CHUNK)
+ l = DATA_READ_CHUNK;
+ if (l > allsize)
+ l = allsize;
+ if (!l || fread(buf, l, 1, data.fp) != 1)
+
+This flaw can be demostrated by passing that solv file to the dumpsolv tool which
+will crash if compiled with ASAN:
+
+ $ /tmp/b/tools/dumpsolv /tmp/vuln_1_101_1_negative_maxsize.solv
+ =================================================================
+ ==17608==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7c0a2ede00b1 at pc 0x7fea30451468 b
+ p 0x7ffe07220a50 sp 0x7ffe07220220
+ WRITE of size 8192 at 0x7c0a2ede00b1 thread T0
+ #0 0x7fea30451467 in fread.part.0 (/lib64/libasan.so.8+0x51467) (BuildId: 80bfc4ae44fdec6ef5fecfb01
+ e2b57d28660991c)
+ #1 0x7fea3028eef1 in repo_add_solv /home/test/libsolv/src/repo_solv.c:1034
+ #2 0x0000004041cc in main /home/test/libsolv/tools/dumpsolv.c:471
+ #3 0x7fea3003c680 in __libc_start_call_main (/lib64/libc.so.6+0x3680) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #4 0x7fea3003c797 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3797) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #5 0x000000400694 in _start (/tmp/b/tools/dumpsolv+0x400694) (BuildId: 0a70b5b14e5cd81f90a309bb2ff3219dfbf30bb8)
+
+ 0x7c0a2ede00b1 is located 0 bytes after 1-byte region [0x7c0a2ede00b0,0x7c0a2ede00b1)
+ allocated by thread T0 here:
+ #0 0x7fea304ef41f in malloc (/lib64/libasan.so.8+0xef41f) (BuildId: 80bfc4ae44fdec6ef5fecfb01e2b57d28660991c)
+ #1 0x7fea302e4b4c in solv_calloc /home/test/libsolv/src/util.c:77
+ #2 0x7fea3028ee38 in repo_add_solv /home/test/libsolv/src/repo_solv.c:1025
+ #3 0x0000004041cc in main /home/test/libsolv/tools/dumpsolv.c:471
+ #4 0x7fea3003c680 in __libc_start_call_main (/lib64/libc.so.6+0x3680) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #5 0x7fea3003c797 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3797) (BuildId: c04494d63bca865bedf571a4075ef8867ccf9fa9)
+ #6 0x000000400694 in _start (/tmp/b/tools/dumpsolv+0x400694) (BuildId: 0a70b5b14e5cd81f90a309bb2ff3219dfbf30bb8)
+
+ SUMMARY: AddressSanitizer: heap-buffer-overflow /home/test/libsolv/src/repo_solv.c:1034 in repo_add_solv
+
+This patch catches the integer overflow, sets an error and jumps to the end of
+the function just after deallocation of the buffer (which would contain an
+undefined pointer). This patch also handles a possible integer overflow at
+"maxsize += 5" line.
+
+I originally wanted to replace read_id() with read_u32(), but
+complemtary repowriter_write() function also stored the value as
+a signed integer, so I guess the the Id type is inteded there.
+
+There are probably other ways how to fix it, like passing INT_MAX-5
+limit to read_id(), though the error message would be less
+understandable.
+
+It's also possible to reject this patch with an explanation that loading
+untrusted solv files is not supported. Though some kind of
+fortification would be welcomed by people who debug solver problems
+from reported solv files.
+
+Reported by Aisle Research.
+
+CVE: CVE-2026-9149
+Upstream-Status: Backport [https://github.com/openSUSE/libsolv/commit/210386037c892a720972ad35a3d8f7073b4d763b]
+
+(cherry picked from commit 210386037c892a720972ad35a3d8f7073b4d763b)
+Signed-off-by: Shubham Pushpkar <spushpka@cisco.com>
+---
+ src/repo_solv.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/src/repo_solv.c b/src/repo_solv.c
+index 629ac683..00639aa0 100644
+--- a/src/repo_solv.c
++++ b/src/repo_solv.c
+@@ -18,6 +18,7 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <string.h>
++#include <limits.h>
+
+ #include "repo_solv.h"
+ #include "util.h"
+@@ -1078,6 +1079,18 @@ repo_add_solv(Repo *repo, FILE *fp, int flags)
+
+ maxsize = read_id(&data, 0);
+ allsize = read_id(&data, 0);
++ if (maxsize < 0 || allsize < 0)
++ {
++ data.error = pool_error(pool, SOLV_ERROR_CORRUPT, "negative data size in solv header");
++ id = 0;
++ goto data_error;
++ }
++ if (maxsize > INT_MAX - 5)
++ {
++ data.error = pool_error(pool, SOLV_ERROR_OVERFLOW, "data size overflow in solv header");
++ id = 0;
++ goto data_error;
++ }
+ maxsize += 5; /* so we can read the next schema of an array */
+ if (maxsize > allsize)
+ maxsize = allsize;
+@@ -1403,6 +1416,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key
+ }
+ solv_free(buf);
+
++data_error:
+ if (data.error)
+ {
+ /* free solvables */
+--
+2.35.6
diff --git a/meta/recipes-extended/libsolv/libsolv_0.7.28.bb b/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
index 63534dce26..4ad8a20e2f 100644
--- a/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
+++ b/meta/recipes-extended/libsolv/libsolv_0.7.28.bb
@@ -11,6 +11,7 @@ DEPENDS = "expat zlib zstd"
SRC_URI = "git://github.com/openSUSE/libsolv.git;branch=master;protocol=https \
file://0001-utils-Conside-musl-when-wrapping-qsort_r.patch \
file://CVE-2026-9150.patch \
+ file://CVE-2026-9149.patch \
"
SRCREV = "c8dbb3a77c86600ce09d4f80a504cf4e78a3c359"
--
2.35.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [scarthgap] [PATCH 2/2] libsolv: Fix CVE-2026-9149
2026-06-22 21:48 ` Yoann Congal
@ 2026-07-24 12:56 ` Deepak Rathore
0 siblings, 0 replies; 5+ messages in thread
From: Deepak Rathore @ 2026-07-24 12:56 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
Hi Yoann,
I have submitted v2 patch for this after rebase.
openembedded-core@lists.openembedded.org | [scarthgap][PATCH v2] libsolv: Fix CVE-2026-9149 ( https://lists.openembedded.org/g/openembedded-core/topic/120425119 )
Please review.
Regards,
Deepak
[-- Attachment #2: Type: text/html, Size: 392 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-24 12:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16 6:31 [OE-core] [scarthgap] [PATCH 1/2] libsolv: Fix CVE-2026-9150 Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco)
2026-06-16 6:31 ` [OE-core] [scarthgap] [PATCH 2/2] libsolv: Fix CVE-2026-9149 Shubham Pushpkar -X (spushpka - E INFOCHIPS PRIVATE LIMITED at Cisco)
2026-06-22 21:48 ` Yoann Congal
2026-07-24 12:56 ` Deepak Rathore
2026-07-24 12:55 ` [OE-core][scarthgap][PATCH v2] " Deepak Rathore -X (deeratho - E INFOCHIPS PRIVATE LIMITED at Cisco)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox