* [oe-core][kirkstone][PATCH 1/3] expat: fix CVE-2024-45490
@ 2024-09-06 13:29 archana.polampalli
2024-09-06 13:29 ` [oe-core][kirkstone][PATCH 2/3] expat: fix CVE-2024-45491 archana.polampalli
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: archana.polampalli @ 2024-09-06 13:29 UTC (permalink / raw)
To: openembedded-core
From: Archana Polampalli <archana.polampalli@windriver.com>
An issue was discovered in libexpat before 2.6.3. xmlparse.c does not reject
a negative length for XML_ParseBuffer.
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
---
.../expat/expat/CVE-2024-45490-0001.patch | 35 +++++++++++++
.../expat/expat/CVE-2024-45490-0002.patch | 49 +++++++++++++++++++
meta/recipes-core/expat/expat_2.5.0.bb | 2 +
3 files changed, 86 insertions(+)
create mode 100644 meta/recipes-core/expat/expat/CVE-2024-45490-0001.patch
create mode 100644 meta/recipes-core/expat/expat/CVE-2024-45490-0002.patch
diff --git a/meta/recipes-core/expat/expat/CVE-2024-45490-0001.patch b/meta/recipes-core/expat/expat/CVE-2024-45490-0001.patch
new file mode 100644
index 0000000000..acdeb5b7df
--- /dev/null
+++ b/meta/recipes-core/expat/expat/CVE-2024-45490-0001.patch
@@ -0,0 +1,35 @@
+From 1d4f03d21b4f42031716522a6b96346b7a60d4c4 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Mon, 19 Aug 2024 22:26:07 +0200
+Subject: [PATCH] lib: Reject negative len for XML_ParseBuffer
+
+Reported by TaiYou
+
+CVE: CVE-2024-45490
+
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/commit/5c1a31642e243f4870c0bd1f2afc7597976521bf]
+
+Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
+---
+ lib/xmlparse.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 9984d02..6f0440b 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -1996,6 +1996,12 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) {
+
+ if (parser == NULL)
+ return XML_STATUS_ERROR;
++
++ if (len < 0) {
++ parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT;
++ return XML_STATUS_ERROR;
++ }
++
+ switch (parser->m_parsingStatus.parsing) {
+ case XML_SUSPENDED:
+ parser->m_errorCode = XML_ERROR_SUSPENDED;
+--
+2.40.0
diff --git a/meta/recipes-core/expat/expat/CVE-2024-45490-0002.patch b/meta/recipes-core/expat/expat/CVE-2024-45490-0002.patch
new file mode 100644
index 0000000000..e769182087
--- /dev/null
+++ b/meta/recipes-core/expat/expat/CVE-2024-45490-0002.patch
@@ -0,0 +1,49 @@
+From 2db233019f551fe4c701bbbc5eb0fa58ff349daa Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Sun, 25 Aug 2024 19:09:51 +0200
+Subject: [PATCH] doc: Document that XML_Parse/XML_ParseBuffer reject "len < 0"
+
+CVE: CVE-2024-45490
+
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/commit/2db233019f551fe4c701bbbc5eb0fa58ff349daa]
+
+Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
+---
+ doc/reference.html | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/doc/reference.html b/doc/reference.html
+index cdf3983..ebae824 100644
+--- a/doc/reference.html
++++ b/doc/reference.html
+@@ -1097,7 +1097,9 @@ containing part (or perhaps all) of the document. The number of bytes of s
+ that are part of the document is indicated by <code>len</code>. This means
+ that <code>s</code> doesn't have to be null terminated. It also means that
+ if <code>len</code> is larger than the number of bytes in the block of
+-memory that <code>s</code> points at, then a memory fault is likely. The
++memory that <code>s</code> points at, then a memory fault is likely.
++Negative values for <code>len</code> are rejected since Expat 2.2.1.
++The
+ <code>isFinal</code> parameter informs the parser that this is the last
+ piece of the document. Frequently, the last piece is empty (i.e.
+ <code>len</code> is zero.)
+@@ -1113,11 +1115,17 @@ XML_ParseBuffer(XML_Parser p,
+ int isFinal);
+ </pre>
+ <div class="fcndef">
++<p>
+ This is just like <code><a href= "#XML_Parse" >XML_Parse</a></code>,
+ except in this case Expat provides the buffer. By obtaining the
+ buffer from Expat with the <code><a href= "#XML_GetBuffer"
+ >XML_GetBuffer</a></code> function, the application can avoid double
+ copying of the input.
++</p>
++
++<p>
++Negative values for <code>len</code> are rejected since Expat 2.6.3.
++</p>
+ </div>
+
+ <h4 id="XML_GetBuffer">XML_GetBuffer</h4>
+--
+2.40.0
diff --git a/meta/recipes-core/expat/expat_2.5.0.bb b/meta/recipes-core/expat/expat_2.5.0.bb
index 31e989cfe2..6d927ec8c8 100644
--- a/meta/recipes-core/expat/expat_2.5.0.bb
+++ b/meta/recipes-core/expat/expat_2.5.0.bb
@@ -22,6 +22,8 @@ SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TA
file://CVE-2023-52426-009.patch \
file://CVE-2023-52426-010.patch \
file://CVE-2023-52426-011.patch \
+ file://CVE-2024-45490-0001.patch \
+ file://CVE-2024-45490-0002.patch \
"
UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/"
--
2.40.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [oe-core][kirkstone][PATCH 2/3] expat: fix CVE-2024-45491
2024-09-06 13:29 [oe-core][kirkstone][PATCH 1/3] expat: fix CVE-2024-45490 archana.polampalli
@ 2024-09-06 13:29 ` archana.polampalli
2024-09-06 13:29 ` [oe-core][kirkstone][PATCH 3/3] expat: fix CVE-2024-45492 archana.polampalli
2024-09-07 6:55 ` [kirkstone][PATCH 1/3] expat: fix CVE-2024-45490 Siddharth Doshi
2 siblings, 0 replies; 6+ messages in thread
From: archana.polampalli @ 2024-09-06 13:29 UTC (permalink / raw)
To: openembedded-core
From: Archana Polampalli <archana.polampalli@windriver.com>
An issue was discovered in libexpat before 2.6.3. dtdCopy in xmlparse.c can have
an integer overflow for nDefaultAtts on 32-bit platforms (where UINT_MAX equals SIZE_MAX).
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
---
.../expat/expat/CVE-2024-45491.patch | 39 +++++++++++++++++++
meta/recipes-core/expat/expat_2.5.0.bb | 1 +
2 files changed, 40 insertions(+)
create mode 100644 meta/recipes-core/expat/expat/CVE-2024-45491.patch
diff --git a/meta/recipes-core/expat/expat/CVE-2024-45491.patch b/meta/recipes-core/expat/expat/CVE-2024-45491.patch
new file mode 100644
index 0000000000..2231722f12
--- /dev/null
+++ b/meta/recipes-core/expat/expat/CVE-2024-45491.patch
@@ -0,0 +1,39 @@
+From 17e29cb8ff58a8356ad8ea363c169e227e93e444 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Mon, 19 Aug 2024 22:34:13 +0200
+Subject: [PATCH] lib: Detect integer overflow in dtdCopy
+
+Reported by TaiYou
+
+CVE: CVE-2024-45491
+
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/891/commits/8e439a9947e9dc80]
+
+Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
+---
+ lib/xmlparse.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 6f0440b..adb27e3 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -6913,6 +6913,16 @@ dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd,
+ if (! newE)
+ return 0;
+ if (oldE->nDefaultAtts) {
++ /* Detect and prevent integer overflow.
++ * The preprocessor guard addresses the "always false" warning
++ * from -Wtype-limits on platforms where
++ * sizeof(int) < sizeof(size_t), e.g. on x86_64. */
++#if UINT_MAX >= SIZE_MAX
++ if ((size_t)oldE->nDefaultAtts
++ > ((size_t)(-1) / sizeof(DEFAULT_ATTRIBUTE))) {
++ return 0;
++ }
++#endif
+ newE->defaultAtts
+ = ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
+ if (! newE->defaultAtts) {
+--
+2.40.0
diff --git a/meta/recipes-core/expat/expat_2.5.0.bb b/meta/recipes-core/expat/expat_2.5.0.bb
index 6d927ec8c8..bfd0961913 100644
--- a/meta/recipes-core/expat/expat_2.5.0.bb
+++ b/meta/recipes-core/expat/expat_2.5.0.bb
@@ -24,6 +24,7 @@ SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TA
file://CVE-2023-52426-011.patch \
file://CVE-2024-45490-0001.patch \
file://CVE-2024-45490-0002.patch \
+ file://CVE-2024-45491.patch \
"
UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/"
--
2.40.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [oe-core][kirkstone][PATCH 3/3] expat: fix CVE-2024-45492
2024-09-06 13:29 [oe-core][kirkstone][PATCH 1/3] expat: fix CVE-2024-45490 archana.polampalli
2024-09-06 13:29 ` [oe-core][kirkstone][PATCH 2/3] expat: fix CVE-2024-45491 archana.polampalli
@ 2024-09-06 13:29 ` archana.polampalli
2024-09-07 6:55 ` [kirkstone][PATCH 1/3] expat: fix CVE-2024-45490 Siddharth Doshi
2 siblings, 0 replies; 6+ messages in thread
From: archana.polampalli @ 2024-09-06 13:29 UTC (permalink / raw)
To: openembedded-core
From: Archana Polampalli <archana.polampalli@windriver.com>
An issue was discovered in libexpat before 2.6.3. nextScaffoldPart in xmlparse.c
can have an integer overflow for m_groupSize on 32-bit platforms (where UINT_MAX equals SIZE_MAX).
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
---
.../expat/expat/CVE-2024-45492.patch | 38 +++++++++++++++++++
meta/recipes-core/expat/expat_2.5.0.bb | 1 +
2 files changed, 39 insertions(+)
create mode 100644 meta/recipes-core/expat/expat/CVE-2024-45492.patch
diff --git a/meta/recipes-core/expat/expat/CVE-2024-45492.patch b/meta/recipes-core/expat/expat/CVE-2024-45492.patch
new file mode 100644
index 0000000000..a569f18067
--- /dev/null
+++ b/meta/recipes-core/expat/expat/CVE-2024-45492.patch
@@ -0,0 +1,38 @@
+From 9b0615959a4df00b4719c5beae286eb52fd32fe0 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Mon, 19 Aug 2024 22:37:16 +0200
+Subject: [PATCH] lib: Detect integer overflow in function nextScaffoldPart
+
+Reported by TaiYou
+
+CVE: CVE-2024-45492
+
+Upstream-Status: Backport [https://github.com/libexpat/libexpat/pull/892/commits/9bf0f2c16ee86f64]
+
+Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
+---
+ lib/xmlparse.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index adb27e3..6d7e92f 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -7465,6 +7465,15 @@ nextScaffoldPart(XML_Parser parser) {
+ int next;
+
+ if (! dtd->scaffIndex) {
++ /* Detect and prevent integer overflow.
++ * The preprocessor guard addresses the "always false" warning
++ * from -Wtype-limits on platforms where
++ * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
++#if UINT_MAX >= SIZE_MAX
++ if (parser->m_groupSize > ((size_t)(-1) / sizeof(int))) {
++ return -1;
++ }
++#endif
+ dtd->scaffIndex = (int *)MALLOC(parser, parser->m_groupSize * sizeof(int));
+ if (! dtd->scaffIndex)
+ return -1;
+--
+2.40.0
diff --git a/meta/recipes-core/expat/expat_2.5.0.bb b/meta/recipes-core/expat/expat_2.5.0.bb
index bfd0961913..8fccb8b27f 100644
--- a/meta/recipes-core/expat/expat_2.5.0.bb
+++ b/meta/recipes-core/expat/expat_2.5.0.bb
@@ -25,6 +25,7 @@ SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TA
file://CVE-2024-45490-0001.patch \
file://CVE-2024-45490-0002.patch \
file://CVE-2024-45491.patch \
+ file://CVE-2024-45492.patch \
"
UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/"
--
2.40.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [kirkstone][PATCH 1/3] expat: fix CVE-2024-45490
2024-09-06 13:29 [oe-core][kirkstone][PATCH 1/3] expat: fix CVE-2024-45490 archana.polampalli
2024-09-06 13:29 ` [oe-core][kirkstone][PATCH 2/3] expat: fix CVE-2024-45491 archana.polampalli
2024-09-06 13:29 ` [oe-core][kirkstone][PATCH 3/3] expat: fix CVE-2024-45492 archana.polampalli
@ 2024-09-07 6:55 ` Siddharth Doshi
2024-09-08 16:52 ` [OE-core] " Polampalli, Archana
2 siblings, 1 reply; 6+ messages in thread
From: Siddharth Doshi @ 2024-09-07 6:55 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
Hi Archana,
The fix for this CVE consists of 3 commits (fix in file, test to check for issue and doc update)
(ref-> https://github.com/libexpat/libexpat/pull/890/commits )
Out of which you have backported only 2 (Fix in file and doc update). the commit for "test to check len<0" is not added in the patch
is there any specific reason to exclude it ? if not, could you send a v2 incorporting the missing commit too ?
BR,
Siddharth
[-- Attachment #2: Type: text/html, Size: 645 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [OE-core] [kirkstone][PATCH 1/3] expat: fix CVE-2024-45490
2024-09-07 6:55 ` [kirkstone][PATCH 1/3] expat: fix CVE-2024-45490 Siddharth Doshi
@ 2024-09-08 16:52 ` Polampalli, Archana
2024-09-08 17:10 ` Siddharth Doshi
0 siblings, 1 reply; 6+ messages in thread
From: Polampalli, Archana @ 2024-09-08 16:52 UTC (permalink / raw)
To: openembedded-core@lists.openembedded.org, sdoshi@mvista.com
[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]
expat/tests/basic_tests.c is not present in recipe version, will add these changes to runtests.c and will send V2.
Thanks,
Archana
________________________________
From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> on behalf of Siddharth Doshi via lists.openembedded.org <sdoshi=mvista.com@lists.openembedded.org>
Sent: Saturday, September 7, 2024 12:25
To: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [kirkstone][PATCH 1/3] expat: fix CVE-2024-45490
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.
Hi Archana,
The fix for this CVE consists of 3 commits (fix in file, test to check for issue and doc update)
(ref-> https://github.com/libexpat/libexpat/pull/890/commits)
Out of which you have backported only 2 (Fix in file and doc update). the commit for "test to check len<0" is not added in the patch
is there any specific reason to exclude it ? if not, could you send a v2 incorporting the missing commit too ?
BR,
Siddharth
A
[-- Attachment #2: Type: text/html, Size: 2932 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kirkstone][PATCH 1/3] expat: fix CVE-2024-45490
2024-09-08 16:52 ` [OE-core] " Polampalli, Archana
@ 2024-09-08 17:10 ` Siddharth Doshi
0 siblings, 0 replies; 6+ messages in thread
From: Siddharth Doshi @ 2024-09-08 17:10 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
>
> expat/tests/basic_tests.c is not present in recipe version, will add these
> changes to runtests.c and will send V2.
>
>
- Yes, expat/tests/basic_tests.c seperated out from runtests.c from version 2.6.0.
- Afaik, the patch will apply directly to runtests.c as not major change except seperation was done in expat.
Thank-you for your work :) and sending V2 :)
BR,
Siddharth
[-- Attachment #2: Type: text/html, Size: 2863 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-09-08 17:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 13:29 [oe-core][kirkstone][PATCH 1/3] expat: fix CVE-2024-45490 archana.polampalli
2024-09-06 13:29 ` [oe-core][kirkstone][PATCH 2/3] expat: fix CVE-2024-45491 archana.polampalli
2024-09-06 13:29 ` [oe-core][kirkstone][PATCH 3/3] expat: fix CVE-2024-45492 archana.polampalli
2024-09-07 6:55 ` [kirkstone][PATCH 1/3] expat: fix CVE-2024-45490 Siddharth Doshi
2024-09-08 16:52 ` [OE-core] " Polampalli, Archana
2024-09-08 17:10 ` Siddharth Doshi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox