libssh2: CVE-2019-17498.patch
PATCH 1/1 libssh2: CVE-2019-17498.patch
Security Advisory
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-17498
--- .../libssh2/libssh2/CVE-2019-17498.patch | 131 ++++++++++++++++++ .../recipes-support/libssh2/libssh2_1.8.2.bb | 1 + 2 files changed, 132 insertions(+) create mode 100644 meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patch
meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patch new file +131 -0
@@ -0,0 +1,131 @@ +From dedcbd106f8e52d5586b0205bc7677e4c9868f9c Mon Sep 17 00:00:00 2001 +From: Will Cosgrove <[email protected]> +Date: Fri, 30 Aug 2019 09:57:38 -0700 +Subject: [PATCH] packet.c: improve message parsing (#402) + +* packet.c: improve parsing of packets + +file: packet.c + +notes: +Use _libssh2_get_string API in SSH_MSG_DEBUG/SSH_MSG_DISCONNECT. Additional uint32 bounds check in SSH_MSG_GLOBAL_REQUEST. + +Upstream-Status: Accepted +CVE: CVE-2019-17498 + +Reference to upstream patch: +https://github.com/libssh2/libssh2/commit/dedcbd106f8e52d5586b0205bc7677e4c9868f9c + +--- + src/packet.c | 68 ++++++++++++++++++++++------------------------------ + 1 file changed, 29 insertions(+), 39 deletions(-) + +diff --git a/src/packet.c b/src/packet.c +index 38ab6294..2e01bfc5 100644 +--- a/src/packet.c ++++ b/src/packet.c +@@ -416,8 +416,8 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + size_t datalen, int macstate) + { + int rc = 0; +- char *message = NULL; +- char *language = NULL; ++ unsigned char *message = NULL; ++ unsigned char *language = NULL; + size_t message_len = 0; + size_t language_len = 0; + LIBSSH2_CHANNEL *channelp = NULL; +@@ -469,33 +469,23 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + + case SSH_MSG_DISCONNECT: + if(datalen >= 5) { +- size_t reason = _libssh2_ntohu32(data + 1); ++ uint32_t reason = 0; ++ struct string_buf buf; ++ buf.data = (unsigned char *)data; ++ buf.dataptr = buf.data; ++ buf.len = datalen; ++ buf.dataptr++; /* advance past type */ + +- if(datalen >= 9) { +- message_len = _libssh2_ntohu32(data + 5); ++ _libssh2_get_u32(&buf, &reason); ++ _libssh2_get_string(&buf, &message, &message_len); ++ _libssh2_get_string(&buf, &language, &language_len); + +- if(message_len < datalen-13) { +- /* 9 = packet_type(1) + reason(4) + message_len(4) */ +- message = (char *) data + 9; +- +- language_len = +- _libssh2_ntohu32(data + 9 + message_len); +- language = (char *) data + 9 + message_len + 4; +- +- if(language_len > (datalen-13-message_len)) { +- /* bad input, clear info */ +- language = message = NULL; +- language_len = message_len = 0; +- } +- } +- else +- /* bad size, clear it */ +- message_len = 0; +- } + if(session->ssh_msg_disconnect) { +- LIBSSH2_DISCONNECT(session, reason, message, +- message_len, language, language_len); ++ LIBSSH2_DISCONNECT(session, reason, (const char *)message, ++ message_len, (const char *)language, ++ language_len); + } ++ + _libssh2_debug(session, LIBSSH2_TRACE_TRANS, + "Disconnect(%d): %s(%s)", reason, + message, language); +@@ -534,23 +526,24 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + int always_display = data[1]; + + if(datalen >= 6) { +- message_len = _libssh2_ntohu32(data + 2); +- +- if(message_len <= (datalen - 10)) { +- /* 6 = packet_type(1) + display(1) + message_len(4) */ +- message = (char *) data + 6; +- language_len = _libssh2_ntohu32(data + 6 + +- message_len); +- +- if(language_len <= (datalen - 10 - message_len)) +- language = (char *) data + 10 + message_len; +- } ++ struct string_buf buf; ++ buf.data = (unsigned char *)data; ++ buf.dataptr = buf.data; ++ buf.len = datalen; ++ buf.dataptr += 2; /* advance past type & always display */ ++ ++ _libssh2_get_string(&buf, &message, &message_len); ++ _libssh2_get_string(&buf, &language, &language_len); + } + + if(session->ssh_msg_debug) { +- LIBSSH2_DEBUG(session, always_display, message, +- message_len, language, language_len); ++ LIBSSH2_DEBUG(session, always_display, ++ (const char *)message, ++ message_len, (const char *)language, ++ language_len); + } + } ++ + /* + * _libssh2_debug will actually truncate this for us so + * that it's not an inordinate about of data +@@ -576,7 +566,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + uint32_t len = 0; + unsigned char want_reply = 0; + len = _libssh2_ntohu32(data + 1); +- if(datalen >= (6 + len)) { ++ if((len <= (UINT_MAX - 6)) && (datalen >= (6 + len))) { + want_reply = data[5 + len]; + _libssh2_debug(session, + LIBSSH2_TRACE_CONN,
meta-oe/recipes-support/libssh2/libssh2_1.8.2.bb +1 -0
@@ -17,6 +17,7 @@ inherit autotools pkgconfig EXTRA_OECONF += "\ --with-libz \ --with-libz-prefix=${STAGING_LIBDIR} \ + file://CVE-2019-17498.patch \ " # only one of openssl and gcrypt could be set
Signature · 1 line
2.17.1
PATCH 1/1 opensc: CVE-2019-19479 CVE-2019-19480
Security Advisory
References
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19479
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19480
--- .../opensc/opensc/CVE-2019-19479.patch | 30 ++++++++++++++++ .../opensc/opensc/CVE-2019-19480.patch | 34 +++++++++++++++++++ .../recipes-support/opensc/opensc_0.19.0.bb | 2 ++ 3 files changed, 66 insertions(+) create mode 100644 meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch create mode 100644 meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patch
meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch new file +30 -0
@@ -0,0 +1,30 @@ +From c3f23b836e5a1766c36617fe1da30d22f7b63de2 Mon Sep 17 00:00:00 2001 +From: Frank Morgner <[email protected]> +Date: Sun, 3 Nov 2019 04:45:28 +0100 +Subject: [PATCH] fixed UNKNOWN READ + +Upstream-Status: Accepted <or Backport> +CVE: CVE-2019-19479 + +Reported by OSS-Fuzz +https://oss-fuzz.com/testcase-detail/5681169970757632 + +Reference to upstream patch: +https://github.com/OpenSC/OpenSC/commit/c3f23b836e5a1766c36617fe1da30d22f7b63de2 +--- + src/libopensc/card-setcos.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libopensc/card-setcos.c b/src/libopensc/card-setcos.c +index 4cf328ad6a..1b4e8f3e23 100644 +--- a/src/libopensc/card-setcos.c ++++ b/src/libopensc/card-setcos.c +@@ -868,7 +868,7 @@ static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len) + } + + /* Encryption key present ? */ +- iPinCount = iACLen - 1; ++ iPinCount = iACLen > 0 ? iACLen - 1 : 0; + + if (buf[iOffset] & 0x20) { + int iSC;
meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patch new file +34 -0
@@ -0,0 +1,34 @@ +From 6ce6152284c47ba9b1d4fe8ff9d2e6a3f5ee02c7 Mon Sep 17 00:00:00 2001 +From: Jakub Jelen <[email protected]> +Date: Wed, 23 Oct 2019 09:22:44 +0200 +Subject: [PATCH] pkcs15-prkey: Simplify cleaning memory after failure + +https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18478 + +Upstream-Status: Accepted +CVE: CVE-2019-19480 + +Reference to upstream patch: +https://github.com/OpenSC/OpenSC/commit/6ce6152284c47ba9b1d4fe8ff9d2e6a3f5ee02c7 +--- + src/libopensc/pkcs15-prkey.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/libopensc/pkcs15-prkey.c b/src/libopensc/pkcs15-prkey.c +index d3eee983..4b249582 100644 +--- a/src/libopensc/pkcs15-prkey.c ++++ b/src/libopensc/pkcs15-prkey.c +@@ -258,6 +258,10 @@ int sc_pkcs15_decode_prkdf_entry(struct sc_pkcs15_card *p15card, + memset(gostr3410_params, 0, sizeof(gostr3410_params)); + + r = sc_asn1_decode_choice(ctx, asn1_prkey, *buf, *buflen, buf, buflen); ++ if (r < 0) { ++ /* This might have allocated something. If so, clear it now */ ++ free(info.subject.value); ++ } + if (r == SC_ERROR_ASN1_END_OF_CONTENTS) + return r; + LOG_TEST_RET(ctx, r, "PrKey DF ASN.1 decoding failed"); +-- +2.17.1 +
meta-oe/recipes-support/opensc/opensc_0.19.0.bb +2 -0
@@ -15,6 +15,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34" SRCREV = "f1691fc91fc113191c3a8aaf5facd6983334ec47" SRC_URI = "git://github.com/OpenSC/OpenSC \ file://0001-Remove-redundant-logging.patch \ + file://CVE-2019-19479.patch \ + file://CVE-2019-19480.patch \ " DEPENDS = "openct pcsc-lite virtual/libiconv openssl"
Signature · 1 line
2.17.1
Re: [meta-oe][zeus][PATCH] opensc: CVE-2019-19479 CVE-2019-19480
Quoted 5 lines · Wang Mingyu
Security Advisory
References
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19479
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19480
Is this fix in master?
Quoted 19 lines
Signed-off-by Wang Mingyu <[email protected]>--- .../opensc/opensc/CVE-2019-19479.patch | 30 ++++++++++++++++ .../opensc/opensc/CVE-2019-19480.patch | 34 +++++++++++++++++++ .../recipes-support/opensc/opensc_0.19.0.bb | 2 ++ 3 files changed, 66 insertions(+) create mode 100644 meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch create mode 100644 meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patchmeta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch new file +3
-0@@ -0,0 +1,30 @@ +From c3f23b836e5a1766c36617fe1da30d22f7b63de2 Mon Sep 17 00:00:00 2001 +From: Frank Morgner <[email protected]> +Date: Sun, 3 Nov 2019 04:45:28 +0100
meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch line 13
Quoted 10 lines
meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch new file +10
-0+Subject: [PATCH] fixed UNKNOWN READ + +Upstream-Status: Accepted <or Backport> +CVE: CVE-2019-19479 + +Reported by OSS-Fuzz +https://oss-fuzz.com/testcase-detail/5681169970757632 + +Reference to upstream patch: +https://github.com/OpenSC/OpenSC/commit/c3f23b836e5a1766c36617fe1da30d22f7b63de2
Missing signed-off-by
Quoted 70 lines
meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch new file +17
-0+--- + src/libopensc/card-setcos.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libopensc/card-setcos.c b/src/libopensc/card-setcos.c +index 4cf328ad6a..1b4e8f3e23 100644 +--- a/src/libopensc/card-setcos.c ++++ b/src/libopensc/card-setcos.c +@@ -868,7 +868,7 @@ static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len) + } + + /* Encryption key present ? */ +- iPinCount = iACLen - 1; ++ iPinCount = iACLen > 0 ? iACLen - 1 : 0; + + if (buf[iOffset] & 0x20) { + int iSC;meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patch new file +34
-0@@ -0,0 +1,34 @@ +From 6ce6152284c47ba9b1d4fe8ff9d2e6a3f5ee02c7 Mon Sep 17 00:00:00 2001 +From: Jakub Jelen <[email protected]> +Date: Wed, 23 Oct 2019 09:22:44 +0200 +Subject: [PATCH] pkcs15-prkey: Simplify cleaning memory after failure + +https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18478 + +Upstream-Status: Accepted +CVE: CVE-2019-19480 + +Reference to upstream patch: +https://github.com/OpenSC/OpenSC/commit/6ce6152284c47ba9b1d4fe8ff9d2e6a3f5ee02c7 +--- + src/libopensc/pkcs15-prkey.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/libopensc/pkcs15-prkey.c b/src/libopensc/pkcs15-prkey.c +index d3eee983..4b249582 100644 +--- a/src/libopensc/pkcs15-prkey.c ++++ b/src/libopensc/pkcs15-prkey.c +@@ -258,6 +258,10 @@ int sc_pkcs15_decode_prkdf_entry(struct sc_pkcs15_card *p15card, + memset(gostr3410_params, 0, sizeof(gostr3410_params)); + + r = sc_asn1_decode_choice(ctx, asn1_prkey, *buf, *buflen, buf, buflen); ++ if (r < 0) { ++ /* This might have allocated something. If so, clear it now */ ++ free(info.subject.value); ++ } + if (r == SC_ERROR_ASN1_END_OF_CONTENTS) + return r; + LOG_TEST_RET(ctx, r, "PrKey DF ASN.1 decoding failed"); +-- +2.17.1 +meta-oe/recipes-support/opensc/opensc_0.19.0.bb +2
-0@@ -15,6 +15,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34" SRCREV = "f1691fc91fc113191c3a8aaf5facd6983334ec47" SRC_URI = "git://github.com/OpenSC/OpenSC \ file://0001-Remove-redundant-logging.patch \ + file://CVE-2019-19479.patch \ + file://CVE-2019-19480.patch \ " DEPENDS = "openct pcsc-lite virtual/libiconv openssl"
Re: [meta-oe][zeus][PATCH] opensc: CVE-2019-19479 CVE-2019-19480
Quoted 4 lines
Quoted 3 lines
References
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19479
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19480Is this fix in master?
Yes. It's fix in master.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of akuster808
Sent: Friday, March 13, 2020 11:38 PM
To: [email protected]
Subject: Re: [oe] [meta-oe][zeus][PATCH] opensc: CVE-2019-19479 CVE-2019-19480
Quoted 5 lines · Wang Mingyu
Security Advisory
References
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19479
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19480
Is this fix in master?
Quoted 25 lines
Signed-off-by Wang Mingyu <[email protected]>--- .../opensc/opensc/CVE-2019-19479.patch | 30 ++++++++++++++++ .../opensc/opensc/CVE-2019-19480.patch | 34 +++++++++++++++++++ .../recipes-support/opensc/opensc_0.19.0.bb | 2 ++ 3 files changed, 66 insertions(+) create mode 100644 meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch create mode 100644
meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patch(quoted diff) +0
-0
a/meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patchb/meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patchnew file mode 100644
index 000000000..73222ee1ameta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch new file +5
-0@@ -0,0 +1,30 @@ +From c3f23b836e5a1766c36617fe1da30d22f7b63de2 Mon Sep 17 00:00:00 +2001 +From: Frank Morgner <[email protected]> +Date: Sun, 3 Nov 2019 04:45:28 +0100 +Subject: [PATCH] fixed UNKNOWN READ
meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch line 15
Quoted 10 lines
meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch new file +10
-0+ +Upstream-Status: Accepted <or Backport> +CVE: CVE-2019-19479 + +Reported by OSS-Fuzz +https://oss-fuzz.com/testcase-detail/5681169970757632 + +Reference to upstream patch: +https://github.com/OpenSC/OpenSC/commit/c3f23b836e5a1766c36617fe1da30 +d22f7b63de2
Missing signed-off-by
Quoted 68 lines
meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch new file +17
-0+--- + src/libopensc/card-setcos.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libopensc/card-setcos.c +b/src/libopensc/card-setcos.c index 4cf328ad6a..1b4e8f3e23 100644 +--- a/src/libopensc/card-setcos.c ++++ b/src/libopensc/card-setcos.c +@@ -868,7 +868,7 @@ static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len) + } + + /* Encryption key present ? */ +- iPinCount = iACLen - 1; ++ iPinCount = iACLen > 0 ? iACLen - 1 : 0; + + if (buf[iOffset] & 0x20) { + int iSC;(quoted diff) +0
-0
a/meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patchb/meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patchnew file mode 100644
index 000000000..12c1f0b4ameta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patch new file +37
-0@@ -0,0 +1,34 @@ +From 6ce6152284c47ba9b1d4fe8ff9d2e6a3f5ee02c7 Mon Sep 17 00:00:00 +2001 +From: Jakub Jelen <[email protected]> +Date: Wed, 23 Oct 2019 09:22:44 +0200 +Subject: [PATCH] pkcs15-prkey: Simplify cleaning memory after failure + +https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18478 + +Upstream-Status: Accepted +CVE: CVE-2019-19480 + +Reference to upstream patch: +https://github.com/OpenSC/OpenSC/commit/6ce6152284c47ba9b1d4fe8ff9d2e +6a3f5ee02c7 +--- + src/libopensc/pkcs15-prkey.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/libopensc/pkcs15-prkey.c +b/src/libopensc/pkcs15-prkey.c index d3eee983..4b249582 100644 +--- a/src/libopensc/pkcs15-prkey.c ++++ b/src/libopensc/pkcs15-prkey.c +@@ -258,6 +258,10 @@ int sc_pkcs15_decode_prkdf_entry(struct sc_pkcs15_card *p15card, + memset(gostr3410_params, 0, sizeof(gostr3410_params)); + + r = sc_asn1_decode_choice(ctx, asn1_prkey, *buf, *buflen, buf, + buflen); ++ if (r < 0) { ++ /* This might have allocated something. If so, clear it now */ ++ free(info.subject.value); ++ } + if (r == SC_ERROR_ASN1_END_OF_CONTENTS) + return r; + LOG_TEST_RET(ctx, r, "PrKey DF ASN.1 decoding failed"); +-- +2.17.1 +meta-oe/recipes-support/opensc/opensc_0.19.0.bb +0
-0
meta-oe/recipes-support/opensc/opensc_0.19.0.bb LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34" · line 22
Quoted 8 lines
meta-oe/recipes-support/opensc/opensc_0.19.0.bb +2
-0@@ -15,6 +15,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34" SRCREV = "f1691fc91fc113191c3a8aaf5facd6983334ec47" SRC_URI = "git://github.com/OpenSC/OpenSC \ file://0001-Remove-redundant-logging.patch \ + file://CVE-2019-19479.patch \ + file://CVE-2019-19480.patch \ " DEPENDS = "openct pcsc-lite virtual/libiconv openssl"
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Re: [oe] [meta-oe][zeus][PATCH] opensc: CVE-2019-19479 CVE-2019-19480
In reply to Wang MingyuPing
-----Original Message-----
From: Wang, Mingyu
Sent: Friday, March 13, 2020 7:10 PM
To: [email protected]
Cc: Wang, Mingyu <[email protected]>
Subject: [oe] [meta-oe][zeus][PATCH] opensc: CVE-2019-19479 CVE-2019-19480
Security Advisory
References
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19479
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19480
--- .../opensc/opensc/CVE-2019-19479.patch | 30 ++++++++++++++++ .../opensc/opensc/CVE-2019-19480.patch | 34 +++++++++++++++++++ .../recipes-support/opensc/opensc_0.19.0.bb | 2 ++ 3 files changed, 66 insertions(+) create mode 100644 meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch create mode 100644 meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patch
meta-oe/recipes-support/opensc/opensc/CVE-2019-19479.patch new file +30 -0
@@ -0,0 +1,30 @@ +From c3f23b836e5a1766c36617fe1da30d22f7b63de2 Mon Sep 17 00:00:00 2001 +From: Frank Morgner <[email protected]> +Date: Sun, 3 Nov 2019 04:45:28 +0100 +Subject: [PATCH] fixed UNKNOWN READ + +Upstream-Status: Accepted <or Backport> +CVE: CVE-2019-19479 + +Reported by OSS-Fuzz +https://oss-fuzz.com/testcase-detail/5681169970757632 + +Reference to upstream patch: +https://github.com/OpenSC/OpenSC/commit/c3f23b836e5a1766c36617fe1da30d2 +2f7b63de2 +--- + src/libopensc/card-setcos.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libopensc/card-setcos.c b/src/libopensc/card-setcos.c +index 4cf328ad6a..1b4e8f3e23 100644 +--- a/src/libopensc/card-setcos.c ++++ b/src/libopensc/card-setcos.c +@@ -868,7 +868,7 @@ static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len) + } + + /* Encryption key present ? */ +- iPinCount = iACLen - 1; ++ iPinCount = iACLen > 0 ? iACLen - 1 : 0; + + if (buf[iOffset] & 0x20) {
+ int iSC;
meta-oe/recipes-support/opensc/opensc/CVE-2019-19480.patch new file +34 -0
@@ -0,0 +1,34 @@ +From 6ce6152284c47ba9b1d4fe8ff9d2e6a3f5ee02c7 Mon Sep 17 00:00:00 2001 +From: Jakub Jelen <[email protected]> +Date: Wed, 23 Oct 2019 09:22:44 +0200 +Subject: [PATCH] pkcs15-prkey: Simplify cleaning memory after failure + +https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18478 + +Upstream-Status: Accepted +CVE: CVE-2019-19480 + +Reference to upstream patch: +https://github.com/OpenSC/OpenSC/commit/6ce6152284c47ba9b1d4fe8ff9d2e6a +3f5ee02c7 +--- + src/libopensc/pkcs15-prkey.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/libopensc/pkcs15-prkey.c +b/src/libopensc/pkcs15-prkey.c index d3eee983..4b249582 100644 +--- a/src/libopensc/pkcs15-prkey.c ++++ b/src/libopensc/pkcs15-prkey.c +@@ -258,6 +258,10 @@ int sc_pkcs15_decode_prkdf_entry(struct sc_pkcs15_card *p15card, + memset(gostr3410_params, 0, sizeof(gostr3410_params)); + + r = sc_asn1_decode_choice(ctx, asn1_prkey, *buf, *buflen, buf, + buflen); ++ if (r < 0) { ++ /* This might have allocated something. If so, clear it now */ ++ free(info.subject.value); ++ } + if (r == SC_ERROR_ASN1_END_OF_CONTENTS) + return r; + LOG_TEST_RET(ctx, r, "PrKey DF ASN.1 decoding failed"); +--
+2.17.1
+
meta-oe/recipes-support/opensc/opensc_0.19.0.bb +2 -0
@@ -15,6 +15,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34" SRCREV = "f1691fc91fc113191c3a8aaf5facd6983334ec47" SRC_URI = "git://github.com/OpenSC/OpenSC \ file://0001-Remove-redundant-logging.patch \ + file://CVE-2019-19479.patch \ + file://CVE-2019-19480.patch \ " DEPENDS = "openct pcsc-lite virtual/libiconv openssl"
--
2.17.1
PATCH 1/1 php: CVE-2019-11045.patch CVE-2019-11046.patch CVE-2019-11047.patch CVE-2019-11050.patch
In reply to Wang MingyuSecurity Advisory
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11045
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11046
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11047
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11050
--- .../php/php/CVE-2019-11045.patch | 78 +++++++++++++++++++ .../php/php/CVE-2019-11046.patch | 59 ++++++++++++++ .../php/php/CVE-2019-11047.patch | 57 ++++++++++++++ .../php/php/CVE-2019-11050.patch | 53 +++++++++++++ meta-oe/recipes-devtools/php/php_7.3.9.bb | 4 + 5 files changed, 251 insertions(+) create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11046.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11047.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11050.patch
meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch new file +78 -0
@@ -0,0 +1,78 @@ +From a5a15965da23c8e97657278fc8dfbf1dfb20c016 Mon Sep 17 00:00:00 2001 +From: "Christoph M. Becker" <[email protected]> +Date: Mon, 25 Nov 2019 16:56:34 +0100 +Subject: [PATCH] Fix #78863: DirectoryIterator class silently truncates after + a null byte + +Since the constructor of DirectoryIterator and friends is supposed to +accepts paths (i.e. strings without NUL bytes), we must not accept +arbitrary strings. + +Upstream-Status: Accepted +CVE: CVE-2019-11045 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=a5a15965da23c8e97657278fc8dfbf1dfb20c016 +http://git.php.net/?p=php-src.git;a=commit;h=d74907b8575e6edb83b728c2a94df434c23e1f79 +--- + ext/spl/spl_directory.c | 4 ++-- + ext/spl/tests/bug78863.phpt | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+), 2 deletions(-) + create mode 100644 ext/spl/tests/bug78863.phpt + +diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c +index 91ea2e0265..56e809b1c7 100644 +--- a/ext/spl/spl_directory.c ++++ b/ext/spl/spl_directory.c +@@ -708,10 +708,10 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, zend_long cto + + if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &path, &len, &flags); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &path, &len, &flags); + } else { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "s", &path, &len); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &len); + } + if (SPL_HAS_FLAG(ctor_flags, SPL_FILE_DIR_SKIPDOTS)) { + flags |= SPL_FILE_DIR_SKIPDOTS; +diff --git a/ext/spl/tests/bug78863.phpt b/ext/spl/tests/bug78863.phpt +new file mode 100644 +index 0000000000..dc88d98dee +--- /dev/null ++++ b/ext/spl/tests/bug78863.phpt +@@ -0,0 +1,31 @@ ++--TEST-- ++Bug #78863 (DirectoryIterator class silently truncates after a null byte) ++--FILE-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++mkdir($dir); ++touch("$dir/bad"); ++mkdir("$dir/sub"); ++touch("$dir/sub/good"); ++ ++$it = new DirectoryIterator(__DIR__ . "/bug78863\0/sub"); ++foreach ($it as $fileinfo) { ++ if (!$fileinfo->isDot()) { ++ var_dump($fileinfo->getFilename()); ++ } ++} ++?> ++--EXPECTF-- ++Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d ++Stack trace: ++#0 %s(%d): DirectoryIterator->__construct('%s') ++#1 {main} ++ thrown in %s on line %d ++--CLEAN-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++unlink("$dir/sub/good"); ++rmdir("$dir/sub"); ++unlink("$dir/bad"); ++rmdir($dir); ++?> +-- +2.11.0
meta-oe/recipes-devtools/php/php/CVE-2019-11046.patch new file +59 -0
59 lines not on this page · raw message
meta-oe/recipes-devtools/php/php/CVE-2019-11047.patch new file +57 -0
57 lines not on this page · raw message
meta-oe/recipes-devtools/php/php/CVE-2019-11050.patch new file +53 -0
53 lines not on this page · raw message
meta-oe/recipes-devtools/php/php_7.3.9.bb +4 -0
@@ -9,6 +9,10 @@ SRC_URI += "file://0001-acinclude.m4-don-t-unset-cache-variables.patch \ file://debian-php-fixheader.patch \ file://CVE-2019-6978.patch \ file://CVE-2019-11043.patch \ + file://CVE-2019-11045.patch \ + file://CVE-2019-11046.patch \ + file://CVE-2019-11047.patch \ + file://CVE-2019-11050.patch \ " SRC_URI_append_class-target = " \ file://pear-makefile.patch \
Signature · 1 line
2.17.1
Re: [meta-oe][zeus][PATCH] php: CVE-2019-11045.patch CVE-2019-11046.patch CVE-2019-11047.patch CVE-2019-11050.patch
Quoted 7 lines · Wang Mingyu
Security Advisory
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11045
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11046
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11047
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11050
are these fixes in master?
Quoted 21 lines
Signed-off-by Wang Mingyu <[email protected]>--- .../php/php/CVE-2019-11045.patch | 78 +++++++++++++++++++ .../php/php/CVE-2019-11046.patch | 59 ++++++++++++++ .../php/php/CVE-2019-11047.patch | 57 ++++++++++++++ .../php/php/CVE-2019-11050.patch | 53 +++++++++++++ meta-oe/recipes-devtools/php/php_7.3.9.bb | 4 + 5 files changed, 251 insertions(+) create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11046.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11047.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11050.patchmeta-oe/recipes-devtools/php/php/CVE-2019-11045.patch new file +1
-0@@ -0,0 +1,78 @@ +From a5a15965da23c8e97657278fc8dfbf1dfb20c016 Mon Sep 17 00:00:00 2001
meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch line 11
Quoted 10 lines
meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch new file +10
-0+From: "Christoph M. Becker" <[email protected]> +Date: Mon, 25 Nov 2019 16:56:34 +0100 +Subject: [PATCH] Fix #78863: DirectoryIterator class silently truncates after + a null byte + +Since the constructor of DirectoryIterator and friends is supposed to +accepts paths (i.e. strings without NUL bytes), we must not accept +arbitrary strings. + +Upstream-Status: Accepted
Accepted mean you sent the fix upstream and they took it. is this a "Backport"
Missing "Signed-off-by: "
Quoted 269 lines
meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch new file +67
-0+CVE: CVE-2019-11045 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=a5a15965da23c8e97657278fc8dfbf1dfb20c016 +http://git.php.net/?p=php-src.git;a=commit;h=d74907b8575e6edb83b728c2a94df434c23e1f79 +--- + ext/spl/spl_directory.c | 4 ++-- + ext/spl/tests/bug78863.phpt | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+), 2 deletions(-) + create mode 100644 ext/spl/tests/bug78863.phpt + +diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c +index 91ea2e0265..56e809b1c7 100644 +--- a/ext/spl/spl_directory.c ++++ b/ext/spl/spl_directory.c +@@ -708,10 +708,10 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, zend_long cto + + if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &path, &len, &flags); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &path, &len, &flags); + } else { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "s", &path, &len); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &len); + } + if (SPL_HAS_FLAG(ctor_flags, SPL_FILE_DIR_SKIPDOTS)) { + flags |= SPL_FILE_DIR_SKIPDOTS; +diff --git a/ext/spl/tests/bug78863.phpt b/ext/spl/tests/bug78863.phpt +new file mode 100644 +index 0000000000..dc88d98dee +--- /dev/null ++++ b/ext/spl/tests/bug78863.phpt +@@ -0,0 +1,31 @@ ++--TEST-- ++Bug #78863 (DirectoryIterator class silently truncates after a null byte) ++--FILE-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++mkdir($dir); ++touch("$dir/bad"); ++mkdir("$dir/sub"); ++touch("$dir/sub/good"); ++ ++$it = new DirectoryIterator(__DIR__ . "/bug78863\0/sub"); ++foreach ($it as $fileinfo) { ++ if (!$fileinfo->isDot()) { ++ var_dump($fileinfo->getFilename()); ++ } ++} ++?> ++--EXPECTF-- ++Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d ++Stack trace: ++#0 %s(%d): DirectoryIterator->__construct('%s') ++#1 {main} ++ thrown in %s on line %d ++--CLEAN-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++unlink("$dir/sub/good"); ++rmdir("$dir/sub"); ++unlink("$dir/bad"); ++rmdir($dir); ++?> +-- +2.11.0meta-oe/recipes-devtools/php/php/CVE-2019-11046.patch new file +59
-0@@ -0,0 +1,59 @@ +From 2d07f00b73d8f94099850e0f5983e1cc5817c196 Mon Sep 17 00:00:00 2001 +From: "Christoph M. Becker" <[email protected]> +Date: Sat, 30 Nov 2019 12:26:37 +0100 +Subject: [PATCH] Fix #78878: Buffer underflow in bc_shift_addsub + +We must not rely on `isdigit()` to detect digits, since we only support +decimal ASCII digits in the following processing. + +(cherry picked from commit eb23c6008753b1cdc5359dead3a096dce46c9018) + +Upstream-Status: Accepted +CVE: CVE-2019-11046 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=eb23c6008753b1cdc5359dead3a096dce46c9018 +http://git.php.net/?p=php-src.git;a=commit;h=2d07f00b73d8f94099850e0f5983e1cc5817c196 +--- + ext/bcmath/libbcmath/src/str2num.c | 4 ++-- + ext/bcmath/tests/bug78878.phpt | 13 +++++++++++++ + 2 files changed, 15 insertions(+), 2 deletions(-) + create mode 100644 ext/bcmath/tests/bug78878.phpt + +diff --git a/ext/bcmath/libbcmath/src/str2num.c b/ext/bcmath/libbcmath/src/str2num.c +index f38d341570..03aec15930 100644 +--- a/ext/bcmath/libbcmath/src/str2num.c ++++ b/ext/bcmath/libbcmath/src/str2num.c +@@ -57,9 +57,9 @@ bc_str2num (bc_num *num, char *str, int scale) + zero_int = FALSE; + if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */ + while (*ptr == '0') ptr++; /* Skip leading zeros. */ +- while (isdigit((int)*ptr)) ptr++, digits++; /* digits */ ++ while (*ptr >= '0' && *ptr <= '9') ptr++, digits++; /* digits */ + if (*ptr == '.') ptr++; /* decimal point */ +- while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */ ++ while (*ptr >= '0' && *ptr <= '9') ptr++, strscale++; /* digits */ + if ((*ptr != '\0') || (digits+strscale == 0)) + { + *num = bc_copy_num (BCG(_zero_)); +diff --git a/ext/bcmath/tests/bug78878.phpt b/ext/bcmath/tests/bug78878.phpt +new file mode 100644 +index 0000000000..2c9d72b946 +--- /dev/null ++++ b/ext/bcmath/tests/bug78878.phpt +@@ -0,0 +1,13 @@ ++--TEST-- ++Bug #78878 (Buffer underflow in bc_shift_addsub) ++--SKIPIF-- ++<?php ++if (!extension_loaded('bcmath')) die('skip bcmath extension not available'); ++?> ++--FILE-- ++<?php ++print @bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, 65535, -4e-4)); ++?> ++--EXPECT-- ++bc math warning: non-zero scale in modulus ++0 +-- +2.11.0meta-oe/recipes-devtools/php/php/CVE-2019-11047.patch new file +57
-0@@ -0,0 +1,57 @@ +From d348cfb96f2543565691010ade5e0346338be5a7 Mon Sep 17 00:00:00 2001 +From: Stanislav Malyshev <[email protected]> +Date: Mon, 16 Dec 2019 00:10:39 -0800 +Subject: [PATCH] Fixed bug #78910 + +Upstream-Status: Accepted +CVE-2019-11047 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=d348cfb96f2543565691010ade5e0346338be5a7 +http://git.php.net/?p=php-src.git;a=commit;h=57325460d2bdee01a13d8e6cf03345c90543ff4f +--- + ext/exif/exif.c | 3 ++- + ext/exif/tests/bug78910.phpt | 17 +++++++++++++++++ + 2 files changed, 19 insertions(+), 1 deletion(-) + create mode 100644 ext/exif/tests/bug78910.phpt + +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index 2804807e..a5780113 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3138,7 +3138,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu + /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s)", maker_note->make?maker_note->make:"");*/ + if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make))) + continue; +- if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len)) ++ if (maker_note->id_string && value_len >= maker_note->id_string_len ++ && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len)) + continue; + break; + } +diff --git a/ext/exif/tests/bug78910.phpt b/ext/exif/tests/bug78910.phpt +new file mode 100644 +index 00000000..f5b1c32c +--- /dev/null ++++ b/ext/exif/tests/bug78910.phpt +@@ -0,0 +1,17 @@ ++--TEST-- ++Bug #78910: Heap-buffer-overflow READ in exif (OSS-Fuzz #19044) ++--FILE-- ++<?php ++ ++var_dump(exif_read_data('data:image/jpg;base64,TU0AKgAAAAwgICAgAAIBDwAEAAAAAgAAACKSfCAgAAAAAEZVSklGSUxN')); ++ ++?> ++--EXPECTF-- ++Notice: exif_read_data(): Read from TIFF: tag(0x927C, MakerNote ): Illegal format code 0x2020, switching to BYTE in %s on line %d ++ ++Warning: exif_read_data(): Process tag(x927C=MakerNote ): Illegal format code 0x2020, suppose BYTE in %s on line %d ++ ++Warning: exif_read_data(): IFD data too short: 0x0000 offset 0x000C in %s on line %d ++ ++Warning: exif_read_data(): Invalid TIFF file in %s on line %d ++bool(false) +-- +2.17.1 +meta-oe/recipes-devtools/php/php/CVE-2019-11050.patch new file +53
-0@@ -0,0 +1,53 @@ +From c14eb8de974fc8a4d74f3515424c293bc7a40fba Mon Sep 17 00:00:00 2001 +From: Stanislav Malyshev <[email protected]> +Date: Mon, 16 Dec 2019 01:14:38 -0800 +Subject: [PATCH] Fix bug #78793 + +Upstream-Status: Accepted +CVE-2019-11050 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=c14eb8de974fc8a4d74f3515424c293bc7a40fba +http://git.php.net/?p=php-src.git;a=commit;h=1b3b4a0d367b6f0b67e9f73d82f53db6c6b722b2 +--- + ext/exif/exif.c | 5 +++-- + ext/exif/tests/bug78793.phpt | 12 ++++++++++++ + 2 files changed, 15 insertions(+), 2 deletions(-) + create mode 100644 ext/exif/tests/bug78793.phpt + +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index c0be05922f..7fe055f381 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3240,8 +3240,9 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu + } + + for (de=0;de<NumDirEntries;de++) { +- if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, +- offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) { ++ size_t offset = 2 + 12 * de; ++ if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset, ++ offset_base, data_len - offset, displacement, section_index, 0, maker_note->tag_table)) { + return FALSE; + } + } +diff --git a/ext/exif/tests/bug78793.phpt b/ext/exif/tests/bug78793.phpt +new file mode 100644 +index 0000000000..033f255ace +--- /dev/null ++++ b/ext/exif/tests/bug78793.phpt +@@ -0,0 +1,12 @@ ++--TEST-- ++Bug #78793: Use-after-free in exif parsing under memory sanitizer ++--FILE-- ++<?php ++$f = "ext/exif/tests/bug77950.tiff"; ++for ($i = 0; $i < 10; $i++) { ++ @exif_read_data($f); ++} ++?> ++===DONE=== ++--EXPECT-- ++===DONE=== +-- +2.11.0meta-oe/recipes-devtools/php/php_7.3.9.bb +4
-0@@ -9,6 +9,10 @@ SRC_URI += "file://0001-acinclude.m4-don-t-unset-cache-variables.patch \ file://debian-php-fixheader.patch \ file://CVE-2019-6978.patch \ file://CVE-2019-11043.patch \ + file://CVE-2019-11045.patch \ + file://CVE-2019-11046.patch \ + file://CVE-2019-11047.patch \ + file://CVE-2019-11050.patch \ " SRC_URI_append_class-target = " \ file://pear-makefile.patch \
Re: [meta-oe][zeus][PATCH] php: CVE-2019-11045.patch CVE-2019-11046.patch CVE-2019-11047.patch CVE-2019-11050.patch
Quoted 6 lines
Quoted 5 lines
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11045
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11046
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11047
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11050are these fixes in master?
These problems also need to be fixed in master. I will submit a patch later.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of akuster808
Sent: Friday, March 13, 2020 11:39 PM
To: [email protected]
Subject: Re: [oe] [meta-oe][zeus][PATCH] php: CVE-2019-11045.patch CVE-2019-11046.patch CVE-2019-11047.patch CVE-2019-11050.patch
Quoted 7 lines · Wang Mingyu
Security Advisory
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11045
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11046
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11047
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11050
are these fixes in master?
Quoted 27 lines
Signed-off-by Wang Mingyu <[email protected]>--- .../php/php/CVE-2019-11045.patch | 78 +++++++++++++++++++ .../php/php/CVE-2019-11046.patch | 59 ++++++++++++++ .../php/php/CVE-2019-11047.patch | 57 ++++++++++++++ .../php/php/CVE-2019-11050.patch | 53 +++++++++++++ meta-oe/recipes-devtools/php/php_7.3.9.bb | 4 + 5 files changed, 251 insertions(+) create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11046.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11047.patch create mode 100644
meta-oe/recipes-devtools/php/php/CVE-2019-11050.patchmeta-oe/recipes-devtools/php/php/CVE-2019-11045.patch new file +2
-0@@ -0,0 +1,78 @@ +From a5a15965da23c8e97657278fc8dfbf1dfb20c016 Mon Sep 17 00:00:00 +2001
meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch line 12
Quoted 10 lines
meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch new file +10
-0+From: "Christoph M. Becker" <[email protected]> +Date: Mon, 25 Nov 2019 16:56:34 +0100 +Subject: [PATCH] Fix #78863: DirectoryIterator class silently +truncates after a null byte + +Since the constructor of DirectoryIterator and friends is supposed to +accepts paths (i.e. strings without NUL bytes), we must not accept +arbitrary strings. + +Upstream-Status: Accepted
Accepted mean you sent the fix upstream and they took it. is this a "Backport"
Missing "Signed-off-by: "
Quoted 283 lines
meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch new file +73
-0+CVE: CVE-2019-11045 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=a5a15965da23c8e97657278f +c8dfbf1dfb20c016 +http://git.php.net/?p=php-src.git;a=commit;h=d74907b8575e6edb83b728c2 +a94df434c23e1f79 +--- + ext/spl/spl_directory.c | 4 ++-- + ext/spl/tests/bug78863.phpt | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+), 2 deletions(-) create mode +100644 ext/spl/tests/bug78863.phpt + +diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index +91ea2e0265..56e809b1c7 100644 +--- a/ext/spl/spl_directory.c ++++ b/ext/spl/spl_directory.c +@@ -708,10 +708,10 @@ void +spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, +zend_long cto + + if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &path, &len, &flags); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &path, ++&len, &flags); + } else { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "s", &path, &len); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &len); + } + if (SPL_HAS_FLAG(ctor_flags, SPL_FILE_DIR_SKIPDOTS)) { + flags |= SPL_FILE_DIR_SKIPDOTS; +diff --git a/ext/spl/tests/bug78863.phpt +b/ext/spl/tests/bug78863.phpt new file mode 100644 index +0000000000..dc88d98dee +--- /dev/null ++++ b/ext/spl/tests/bug78863.phpt +@@ -0,0 +1,31 @@ ++--TEST-- ++Bug #78863 (DirectoryIterator class silently truncates after a null ++byte) ++--FILE-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++mkdir($dir); ++touch("$dir/bad"); ++mkdir("$dir/sub"); ++touch("$dir/sub/good"); ++ ++$it = new DirectoryIterator(__DIR__ . "/bug78863\0/sub"); foreach ++($it as $fileinfo) { ++ if (!$fileinfo->isDot()) { ++ var_dump($fileinfo->getFilename()); ++ } ++} ++?> ++--EXPECTF-- ++Fatal error: Uncaught UnexpectedValueException: ++DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d Stack trace: ++#0 %s(%d): DirectoryIterator->__construct('%s') ++#1 {main} ++ thrown in %s on line %d ++--CLEAN-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++unlink("$dir/sub/good"); ++rmdir("$dir/sub"); ++unlink("$dir/bad"); ++rmdir($dir); ++?> +-- +2.11.0meta-oe/recipes-devtools/php/php/CVE-2019-11046.patch new file +62
-0@@ -0,0 +1,59 @@ +From 2d07f00b73d8f94099850e0f5983e1cc5817c196 Mon Sep 17 00:00:00 +2001 +From: "Christoph M. Becker" <[email protected]> +Date: Sat, 30 Nov 2019 12:26:37 +0100 +Subject: [PATCH] Fix #78878: Buffer underflow in bc_shift_addsub + +We must not rely on `isdigit()` to detect digits, since we only +support decimal ASCII digits in the following processing. + +(cherry picked from commit eb23c6008753b1cdc5359dead3a096dce46c9018) + +Upstream-Status: Accepted +CVE: CVE-2019-11046 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=eb23c6008753b1cdc5359dea +d3a096dce46c9018 +http://git.php.net/?p=php-src.git;a=commit;h=2d07f00b73d8f94099850e0f +5983e1cc5817c196 +--- + ext/bcmath/libbcmath/src/str2num.c | 4 ++-- + ext/bcmath/tests/bug78878.phpt | 13 +++++++++++++ + 2 files changed, 15 insertions(+), 2 deletions(-) create mode +100644 ext/bcmath/tests/bug78878.phpt + +diff --git a/ext/bcmath/libbcmath/src/str2num.c +b/ext/bcmath/libbcmath/src/str2num.c +index f38d341570..03aec15930 100644 +--- a/ext/bcmath/libbcmath/src/str2num.c ++++ b/ext/bcmath/libbcmath/src/str2num.c +@@ -57,9 +57,9 @@ bc_str2num (bc_num *num, char *str, int scale) + zero_int = FALSE; + if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */ + while (*ptr == '0') ptr++; /* Skip leading zeros. */ +- while (isdigit((int)*ptr)) ptr++, digits++; /* digits */ ++ while (*ptr >= '0' && *ptr <= '9') ptr++, digits++; /* digits */ + if (*ptr == '.') ptr++; /* decimal point */ +- while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */ ++ while (*ptr >= '0' && *ptr <= '9') ptr++, strscale++; /* digits */ + if ((*ptr != '\0') || (digits+strscale == 0)) + { + *num = bc_copy_num (BCG(_zero_)); diff --git +a/ext/bcmath/tests/bug78878.phpt b/ext/bcmath/tests/bug78878.phpt new +file mode 100644 index 0000000000..2c9d72b946 +--- /dev/null ++++ b/ext/bcmath/tests/bug78878.phpt +@@ -0,0 +1,13 @@ ++--TEST-- ++Bug #78878 (Buffer underflow in bc_shift_addsub) ++--SKIPIF-- ++<?php ++if (!extension_loaded('bcmath')) die('skip bcmath extension not ++available'); ?> ++--FILE-- ++<?php ++print @bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, ++65535, -4e-4)); ?> ++--EXPECT-- ++bc math warning: non-zero scale in modulus ++0 +-- +2.11.0meta-oe/recipes-devtools/php/php/CVE-2019-11047.patch new file +65
-0@@ -0,0 +1,57 @@ +From d348cfb96f2543565691010ade5e0346338be5a7 Mon Sep 17 00:00:00 +2001 +From: Stanislav Malyshev <[email protected]> +Date: Mon, 16 Dec 2019 00:10:39 -0800 +Subject: [PATCH] Fixed bug #78910 + +Upstream-Status: Accepted +CVE-2019-11047 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=d348cfb96f2543565691010a +de5e0346338be5a7 +http://git.php.net/?p=php-src.git;a=commit;h=57325460d2bdee01a13d8e6c +f03345c90543ff4f +--- + ext/exif/exif.c | 3 ++- + ext/exif/tests/bug78910.phpt | 17 +++++++++++++++++ + 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 +ext/exif/tests/bug78910.phpt + +diff --git a/ext/exif/exif.c b/ext/exif/exif.c index +2804807e..a5780113 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3138,7 +3138,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu + /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s)", maker_note->make?maker_note->make:"");*/ + if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make))) + continue; +- if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len)) ++ if (maker_note->id_string && value_len >= maker_note->id_string_len ++ && strncmp(maker_note->id_string, value_ptr, ++maker_note->id_string_len)) + continue; + break; + } +diff --git a/ext/exif/tests/bug78910.phpt +b/ext/exif/tests/bug78910.phpt new file mode 100644 index +00000000..f5b1c32c +--- /dev/null ++++ b/ext/exif/tests/bug78910.phpt +@@ -0,0 +1,17 @@ ++--TEST-- ++Bug #78910: Heap-buffer-overflow READ in exif (OSS-Fuzz #19044) ++--FILE-- ++<?php ++ ++var_dump(exif_read_data('data:image/jpg;base64,TU0AKgAAAAwgICAgAAIBD ++wAEAAAAAgAAACKSfCAgAAAAAEZVSklGSUxN')); ++ ++?> ++--EXPECTF-- ++Notice: exif_read_data(): Read from TIFF: tag(0x927C, MakerNote ): ++Illegal format code 0x2020, switching to BYTE in %s on line %d ++ ++Warning: exif_read_data(): Process tag(x927C=MakerNote ): Illegal ++format code 0x2020, suppose BYTE in %s on line %d ++ ++Warning: exif_read_data(): IFD data too short: 0x0000 offset 0x000C ++in %s on line %d ++ ++Warning: exif_read_data(): Invalid TIFF file in %s on line %d ++bool(false) +-- +2.17.1 +meta-oe/recipes-devtools/php/php/CVE-2019-11050.patch new file +56
-0@@ -0,0 +1,53 @@ +From c14eb8de974fc8a4d74f3515424c293bc7a40fba Mon Sep 17 00:00:00 +2001 +From: Stanislav Malyshev <[email protected]> +Date: Mon, 16 Dec 2019 01:14:38 -0800 +Subject: [PATCH] Fix bug #78793 + +Upstream-Status: Accepted +CVE-2019-11050 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=c14eb8de974fc8a4d74f3515 +424c293bc7a40fba +http://git.php.net/?p=php-src.git;a=commit;h=1b3b4a0d367b6f0b67e9f73d +82f53db6c6b722b2 +--- + ext/exif/exif.c | 5 +++-- + ext/exif/tests/bug78793.phpt | 12 ++++++++++++ + 2 files changed, 15 insertions(+), 2 deletions(-) create mode +100644 ext/exif/tests/bug78793.phpt + +diff --git a/ext/exif/exif.c b/ext/exif/exif.c index +c0be05922f..7fe055f381 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3240,8 +3240,9 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu + } + + for (de=0;de<NumDirEntries;de++) { +- if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, +- offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) { ++ size_t offset = 2 + 12 * de; ++ if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset, ++ offset_base, data_len - offset, displacement, ++section_index, 0, maker_note->tag_table)) { + return FALSE; + } + } +diff --git a/ext/exif/tests/bug78793.phpt +b/ext/exif/tests/bug78793.phpt new file mode 100644 index +0000000000..033f255ace +--- /dev/null ++++ b/ext/exif/tests/bug78793.phpt +@@ -0,0 +1,12 @@ ++--TEST-- ++Bug #78793: Use-after-free in exif parsing under memory sanitizer ++--FILE-- ++<?php ++$f = "ext/exif/tests/bug77950.tiff"; for ($i = 0; $i < 10; $i++) { ++ @exif_read_data($f); ++} ++?> ++===DONE=== ++--EXPECT-- ++===DONE=== +-- +2.11.0meta-oe/recipes-devtools/php/php_7.3.9.bb +0
-0
meta-oe/recipes-devtools/php/php_7.3.9.bb SRC_URI += "file://0001-acinclude.m4-don-t-unset-cache-variables.patch \ · line 18
Quoted 10 lines
meta-oe/recipes-devtools/php/php_7.3.9.bb +4
-0@@ -9,6 +9,10 @@ SRC_URI += "file://0001-acinclude.m4-don-t-unset-cache-variables.patch \ file://debian-php-fixheader.patch \ file://CVE-2019-6978.patch \ file://CVE-2019-11043.patch \ + file://CVE-2019-11045.patch \ + file://CVE-2019-11046.patch \ + file://CVE-2019-11047.patch \ + file://CVE-2019-11050.patch \ " SRC_URI_append_class-target = " \ file://pear-makefile.patch \
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Re: [oe] [meta-oe][zeus][PATCH] php: CVE-2019-11045.patch CVE-2019-11046.patch CVE-2019-11047.patch CVE-2019-11050.patch
In reply to Wang MingyuPing
-----Original Message-----
From: Wang, Mingyu
Sent: Friday, March 13, 2020 7:10 PM
To: [email protected]
Cc: Wang, Mingyu <[email protected]>
Subject: [oe] [meta-oe][zeus][PATCH] php: CVE-2019-11045.patch CVE-2019-11046.patch CVE-2019-11047.patch CVE-2019-11050.patch
Security Advisory
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11045
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11046
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11047
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11050
--- .../php/php/CVE-2019-11045.patch | 78 +++++++++++++++++++ .../php/php/CVE-2019-11046.patch | 59 ++++++++++++++ .../php/php/CVE-2019-11047.patch | 57 ++++++++++++++ .../php/php/CVE-2019-11050.patch | 53 +++++++++++++ meta-oe/recipes-devtools/php/php_7.3.9.bb | 4 + 5 files changed, 251 insertions(+) create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11046.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11047.patch create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2019-11050.patch
meta-oe/recipes-devtools/php/php/CVE-2019-11045.patch new file +78 -0
@@ -0,0 +1,78 @@ +From a5a15965da23c8e97657278fc8dfbf1dfb20c016 Mon Sep 17 00:00:00 2001 +From: "Christoph M. Becker" <[email protected]> +Date: Mon, 25 Nov 2019 16:56:34 +0100 +Subject: [PATCH] Fix #78863: DirectoryIterator class silently truncates +after a null byte + +Since the constructor of DirectoryIterator and friends is supposed to +accepts paths (i.e. strings without NUL bytes), we must not accept +arbitrary strings. + +Upstream-Status: Accepted +CVE: CVE-2019-11045 + +Reference to upstream patch: +http://git.php.net/?p=php-src.git;a=commit;h=a5a15965da23c8e97657278fc8 +dfbf1dfb20c016 +http://git.php.net/?p=php-src.git;a=commit;h=d74907b8575e6edb83b728c2a9 +4df434c23e1f79 +--- + ext/spl/spl_directory.c | 4 ++-- + ext/spl/tests/bug78863.phpt | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 +ext/spl/tests/bug78863.phpt + +diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index +91ea2e0265..56e809b1c7 100644 +--- a/ext/spl/spl_directory.c ++++ b/ext/spl/spl_directory.c +@@ -708,10 +708,10 @@ void +spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, zend_long +cto + + if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &path, &len, &flags); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &path, &len, ++&flags); + } else { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "s", &path, &len); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &len); + } + if (SPL_HAS_FLAG(ctor_flags, SPL_FILE_DIR_SKIPDOTS)) { + flags |= SPL_FILE_DIR_SKIPDOTS; +diff --git a/ext/spl/tests/bug78863.phpt b/ext/spl/tests/bug78863.phpt +new file mode 100644 index 0000000000..dc88d98dee +--- /dev/null ++++ b/ext/spl/tests/bug78863.phpt +@@ -0,0 +1,31 @@ ++--TEST-- ++Bug #78863 (DirectoryIterator class silently truncates after a null ++byte) ++--FILE-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++mkdir($dir); ++touch("$dir/bad"); ++mkdir("$dir/sub"); ++touch("$dir/sub/good"); ++ ++$it = new DirectoryIterator(__DIR__ . "/bug78863\0/sub"); foreach ($it ++as $fileinfo) { ++ if (!$fileinfo->isDot()) { ++ var_dump($fileinfo->getFilename()); ++ } ++} ++?> ++--EXPECTF-- ++Fatal error: Uncaught UnexpectedValueException: ++DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d Stack trace: ++#0 %s(%d): DirectoryIterator->__construct('%s') ++#1 {main} ++ thrown in %s on line %d ++--CLEAN-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++unlink("$dir/sub/good"); ++rmdir("$dir/sub");
++unlink("$dir/bad");
++rmdir($dir);
++?>
+--
+2.11.0
meta-oe/recipes-devtools/php/php/CVE-2019-11046.patch new file +59 -0
59 lines not on this page · raw message
+--
+2.11.0
meta-oe/recipes-devtools/php/php/CVE-2019-11047.patch new file +57 -0
57 lines not on this page · raw message
++%s on line %d
++
++Warning: exif_read_data(): Invalid TIFF file in %s on line %d ++bool(false)
+--
+2.17.1
+
meta-oe/recipes-devtools/php/php/CVE-2019-11050.patch new file +53 -0
53 lines not on this page · raw message
++===DONE===
+--
+2.11.0
meta-oe/recipes-devtools/php/php_7.3.9.bb +4 -0
@@ -9,6 +9,10 @@ SRC_URI += "file://0001-acinclude.m4-don-t-unset-cache-variables.patch \ file://debian-php-fixheader.patch \ file://CVE-2019-6978.patch \ file://CVE-2019-11043.patch \ + file://CVE-2019-11045.patch \ + file://CVE-2019-11046.patch \ + file://CVE-2019-11047.patch \ + file://CVE-2019-11050.patch \ " SRC_URI_append_class-target = " \ file://pear-makefile.patch \
--
2.17.1
Quoted 4 lines · Wang Mingyu
Security Advisory
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-17498
is this fix in master?
Quoted 157 lines
Signed-off-by Wang Mingyu <[email protected]>--- .../libssh2/libssh2/CVE-2019-17498.patch | 131 ++++++++++++++++++ .../recipes-support/libssh2/libssh2_1.8.2.bb | 1 + 2 files changed, 132 insertions(+) create mode 100644 meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patchmeta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patch new file +131
-0@@ -0,0 +1,131 @@ +From dedcbd106f8e52d5586b0205bc7677e4c9868f9c Mon Sep 17 00:00:00 2001 +From: Will Cosgrove <[email protected]> +Date: Fri, 30 Aug 2019 09:57:38 -0700 +Subject: [PATCH] packet.c: improve message parsing (#402) + +* packet.c: improve parsing of packets + +file: packet.c + +notes: +Use _libssh2_get_string API in SSH_MSG_DEBUG/SSH_MSG_DISCONNECT. Additional uint32 bounds check in SSH_MSG_GLOBAL_REQUEST. + +Upstream-Status: Accepted +CVE: CVE-2019-17498 + +Reference to upstream patch: +https://github.com/libssh2/libssh2/commit/dedcbd106f8e52d5586b0205bc7677e4c9868f9c + +--- + src/packet.c | 68 ++++++++++++++++++++++------------------------------ + 1 file changed, 29 insertions(+), 39 deletions(-) + +diff --git a/src/packet.c b/src/packet.c +index 38ab6294..2e01bfc5 100644 +--- a/src/packet.c ++++ b/src/packet.c +@@ -416,8 +416,8 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + size_t datalen, int macstate) + { + int rc = 0; +- char *message = NULL; +- char *language = NULL; ++ unsigned char *message = NULL; ++ unsigned char *language = NULL; + size_t message_len = 0; + size_t language_len = 0; + LIBSSH2_CHANNEL *channelp = NULL; +@@ -469,33 +469,23 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + + case SSH_MSG_DISCONNECT: + if(datalen >= 5) { +- size_t reason = _libssh2_ntohu32(data + 1); ++ uint32_t reason = 0; ++ struct string_buf buf; ++ buf.data = (unsigned char *)data; ++ buf.dataptr = buf.data; ++ buf.len = datalen; ++ buf.dataptr++; /* advance past type */ + +- if(datalen >= 9) { +- message_len = _libssh2_ntohu32(data + 5); ++ _libssh2_get_u32(&buf, &reason); ++ _libssh2_get_string(&buf, &message, &message_len); ++ _libssh2_get_string(&buf, &language, &language_len); + +- if(message_len < datalen-13) { +- /* 9 = packet_type(1) + reason(4) + message_len(4) */ +- message = (char *) data + 9; +- +- language_len = +- _libssh2_ntohu32(data + 9 + message_len); +- language = (char *) data + 9 + message_len + 4; +- +- if(language_len > (datalen-13-message_len)) { +- /* bad input, clear info */ +- language = message = NULL; +- language_len = message_len = 0; +- } +- } +- else +- /* bad size, clear it */ +- message_len = 0; +- } + if(session->ssh_msg_disconnect) { +- LIBSSH2_DISCONNECT(session, reason, message, +- message_len, language, language_len); ++ LIBSSH2_DISCONNECT(session, reason, (const char *)message, ++ message_len, (const char *)language, ++ language_len); + } ++ + _libssh2_debug(session, LIBSSH2_TRACE_TRANS, + "Disconnect(%d): %s(%s)", reason, + message, language); +@@ -534,23 +526,24 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + int always_display = data[1]; + + if(datalen >= 6) { +- message_len = _libssh2_ntohu32(data + 2); +- +- if(message_len <= (datalen - 10)) { +- /* 6 = packet_type(1) + display(1) + message_len(4) */ +- message = (char *) data + 6; +- language_len = _libssh2_ntohu32(data + 6 + +- message_len); +- +- if(language_len <= (datalen - 10 - message_len)) +- language = (char *) data + 10 + message_len; +- } ++ struct string_buf buf; ++ buf.data = (unsigned char *)data; ++ buf.dataptr = buf.data; ++ buf.len = datalen; ++ buf.dataptr += 2; /* advance past type & always display */ ++ ++ _libssh2_get_string(&buf, &message, &message_len); ++ _libssh2_get_string(&buf, &language, &language_len); + } + + if(session->ssh_msg_debug) { +- LIBSSH2_DEBUG(session, always_display, message, +- message_len, language, language_len); ++ LIBSSH2_DEBUG(session, always_display, ++ (const char *)message, ++ message_len, (const char *)language, ++ language_len); + } + } ++ + /* + * _libssh2_debug will actually truncate this for us so + * that it's not an inordinate about of data +@@ -576,7 +566,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + uint32_t len = 0; + unsigned char want_reply = 0; + len = _libssh2_ntohu32(data + 1); +- if(datalen >= (6 + len)) { ++ if((len <= (UINT_MAX - 6)) && (datalen >= (6 + len))) { + want_reply = data[5 + len]; + _libssh2_debug(session, + LIBSSH2_TRACE_CONN,meta-oe/recipes-support/libssh2/libssh2_1.8.2.bb +1
-0@@ -17,6 +17,7 @@ inherit autotools pkgconfig EXTRA_OECONF += "\ --with-libz \ --with-libz-prefix=${STAGING_LIBDIR} \ + file://CVE-2019-17498.patch \ " # only one of openssl and gcrypt could be set
Quoted 2 lines
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-17498
is this fix in master?
Yes. It's already fix in master.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of akuster808
Sent: Friday, March 13, 2020 11:37 PM
To: [email protected]
Subject: Re: [oe] [meta-oe][zeus][PATCH] libssh2: CVE-2019-17498.patch
Quoted 4 lines · Wang Mingyu
Security Advisory
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-17498
is this fix in master?
Quoted 159 lines
Signed-off-by Wang Mingyu <[email protected]>--- .../libssh2/libssh2/CVE-2019-17498.patch | 131 ++++++++++++++++++ .../recipes-support/libssh2/libssh2_1.8.2.bb | 1 + 2 files changed, 132 insertions(+) create mode 100644
meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patch(quoted diff) +0
-0
a/meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patchb/meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patchnew file mode 100644
index 000000000..f60764c92meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patch new file +136
-0@@ -0,0 +1,131 @@ +From dedcbd106f8e52d5586b0205bc7677e4c9868f9c Mon Sep 17 00:00:00 +2001 +From: Will Cosgrove <[email protected]> +Date: Fri, 30 Aug 2019 09:57:38 -0700 +Subject: [PATCH] packet.c: improve message parsing (#402) + +* packet.c: improve parsing of packets + +file: packet.c + +notes: +Use _libssh2_get_string API in SSH_MSG_DEBUG/SSH_MSG_DISCONNECT. Additional uint32 bounds check in SSH_MSG_GLOBAL_REQUEST. + +Upstream-Status: Accepted +CVE: CVE-2019-17498 + +Reference to upstream patch: +https://github.com/libssh2/libssh2/commit/dedcbd106f8e52d5586b0205bc7 +677e4c9868f9c + +--- + src/packet.c | 68 +++++++++++++++++++++++------------------------------ + 1 file changed, 29 insertions(+), 39 deletions(-) + +diff --git a/src/packet.c b/src/packet.c index 38ab6294..2e01bfc5 +100644 +--- a/src/packet.c ++++ b/src/packet.c +@@ -416,8 +416,8 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + size_t datalen, int macstate) { + int rc = 0; +- char *message = NULL; +- char *language = NULL; ++ unsigned char *message = NULL; ++ unsigned char *language = NULL; + size_t message_len = 0; + size_t language_len = 0; + LIBSSH2_CHANNEL *channelp = NULL; @@ -469,33 +469,23 @@ +_libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + + case SSH_MSG_DISCONNECT: + if(datalen >= 5) { +- size_t reason = _libssh2_ntohu32(data + 1); ++ uint32_t reason = 0; ++ struct string_buf buf; ++ buf.data = (unsigned char *)data; ++ buf.dataptr = buf.data; ++ buf.len = datalen; ++ buf.dataptr++; /* advance past type */ + +- if(datalen >= 9) { +- message_len = _libssh2_ntohu32(data + 5); ++ _libssh2_get_u32(&buf, &reason); ++ _libssh2_get_string(&buf, &message, &message_len); ++ _libssh2_get_string(&buf, &language, &language_len); + +- if(message_len < datalen-13) { +- /* 9 = packet_type(1) + reason(4) + message_len(4) */ +- message = (char *) data + 9; +- +- language_len = +- _libssh2_ntohu32(data + 9 + message_len); +- language = (char *) data + 9 + message_len + 4; +- +- if(language_len > (datalen-13-message_len)) { +- /* bad input, clear info */ +- language = message = NULL; +- language_len = message_len = 0; +- } +- } +- else +- /* bad size, clear it */ +- message_len = 0; +- } + if(session->ssh_msg_disconnect) { +- LIBSSH2_DISCONNECT(session, reason, message, +- message_len, language, language_len); ++ LIBSSH2_DISCONNECT(session, reason, (const char *)message, ++ message_len, (const char *)language, ++ language_len); + } ++ + _libssh2_debug(session, LIBSSH2_TRACE_TRANS, + "Disconnect(%d): %s(%s)", reason, + message, language); @@ -534,23 ++526,24 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + int always_display = data[1]; + + if(datalen >= 6) { +- message_len = _libssh2_ntohu32(data + 2); +- +- if(message_len <= (datalen - 10)) { +- /* 6 = packet_type(1) + display(1) + message_len(4) */ +- message = (char *) data + 6; +- language_len = _libssh2_ntohu32(data + 6 + +- message_len); +- +- if(language_len <= (datalen - 10 - message_len)) +- language = (char *) data + 10 + message_len; +- } ++ struct string_buf buf; ++ buf.data = (unsigned char *)data; ++ buf.dataptr = buf.data; ++ buf.len = datalen; ++ buf.dataptr += 2; /* advance past type & always ++ display */ ++ ++ _libssh2_get_string(&buf, &message, &message_len); ++ _libssh2_get_string(&buf, &language, ++ &language_len); + } + + if(session->ssh_msg_debug) { +- LIBSSH2_DEBUG(session, always_display, message, +- message_len, language, language_len); ++ LIBSSH2_DEBUG(session, always_display, ++ (const char *)message, ++ message_len, (const char *)language, ++ language_len); + } + } ++ + /* + * _libssh2_debug will actually truncate this for us so + * that it's not an inordinate about of data @@ -576,7 ++566,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + uint32_t len = 0; + unsigned char want_reply = 0; + len = _libssh2_ntohu32(data + 1); +- if(datalen >= (6 + len)) { ++ if((len <= (UINT_MAX - 6)) && (datalen >= (6 + ++ len))) { + want_reply = data[5 + len]; + _libssh2_debug(session, + LIBSSH2_TRACE_CONN,meta-oe/recipes-support/libssh2/libssh2_1.8.2.bb +0
-0
meta-oe/recipes-support/libssh2/libssh2_1.8.2.bb inherit autotools pkgconfig EXTRA_OECONF += "\ · line 22
Quoted 6 lines
meta-oe/recipes-support/libssh2/libssh2_1.8.2.bb +1
-0@@ -17,6 +17,7 @@ inherit autotools pkgconfig EXTRA_OECONF += "\ --with-libz \ --with-libz-prefix=${STAGING_LIBDIR} \ + file://CVE-2019-17498.patch \ " # only one of openssl and gcrypt could be set
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Ping
-----Original Message-----
From: Wang, Mingyu
Sent: Friday, March 13, 2020 7:10 PM
To: [email protected]
Cc: Wang, Mingyu<[email protected]>
Subject: [oe] [meta-oe][zeus][PATCH] libssh2: CVE-2019-17498.patch
Security Advisory
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-17498
--- .../libssh2/libssh2/CVE-2019-17498.patch | 131 ++++++++++++++++++ .../recipes-support/libssh2/libssh2_1.8.2.bb | 1 + 2 files changed, 132 insertions(+) create mode 100644 meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patch
meta-oe/recipes-support/libssh2/libssh2/CVE-2019-17498.patch new file +131 -0
@@ -0,0 +1,131 @@ +From dedcbd106f8e52d5586b0205bc7677e4c9868f9c Mon Sep 17 00:00:00 2001 +From: Will Cosgrove <[email protected]> +Date: Fri, 30 Aug 2019 09:57:38 -0700 +Subject: [PATCH] packet.c: improve message parsing (#402) + +* packet.c: improve parsing of packets + +file: packet.c + +notes: +Use _libssh2_get_string API in SSH_MSG_DEBUG/SSH_MSG_DISCONNECT. Additional uint32 bounds check in SSH_MSG_GLOBAL_REQUEST. + +Upstream-Status: Accepted +CVE: CVE-2019-17498 + +Reference to upstream patch: +https://github.com/libssh2/libssh2/commit/dedcbd106f8e52d5586b0205bc767 +7e4c9868f9c + +--- + src/packet.c | 68 ++++++++++++++++++++++------------------------------ + 1 file changed, 29 insertions(+), 39 deletions(-) + +diff --git a/src/packet.c b/src/packet.c index 38ab6294..2e01bfc5 +100644 +--- a/src/packet.c ++++ b/src/packet.c +@@ -416,8 +416,8 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + size_t datalen, int macstate) { + int rc = 0; +- char *message = NULL; +- char *language = NULL; ++ unsigned char *message = NULL; ++ unsigned char *language = NULL; + size_t message_len = 0; + size_t language_len = 0; + LIBSSH2_CHANNEL *channelp = NULL; +@@ -469,33 +469,23 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, +unsigned char *data, + + case SSH_MSG_DISCONNECT: + if(datalen >= 5) { +- size_t reason = _libssh2_ntohu32(data + 1); ++ uint32_t reason = 0; ++ struct string_buf buf; ++ buf.data = (unsigned char *)data; ++ buf.dataptr = buf.data; ++ buf.len = datalen; ++ buf.dataptr++; /* advance past type */ + +- if(datalen >= 9) { +- message_len = _libssh2_ntohu32(data + 5); ++ _libssh2_get_u32(&buf, &reason); ++ _libssh2_get_string(&buf, &message, &message_len); ++ _libssh2_get_string(&buf, &language, &language_len); + +- if(message_len < datalen-13) { +- /* 9 = packet_type(1) + reason(4) + message_len(4) */ +- message = (char *) data + 9; +- +- language_len = +- _libssh2_ntohu32(data + 9 + message_len); +- language = (char *) data + 9 + message_len + 4; +- +- if(language_len > (datalen-13-message_len)) { +- /* bad input, clear info */ +- language = message = NULL; +- language_len = message_len = 0; +- } +- } +- else +- /* bad size, clear it */ +- message_len = 0; +- } + if(session->ssh_msg_disconnect) { +- LIBSSH2_DISCONNECT(session, reason, message, +- message_len, language, language_len); ++ LIBSSH2_DISCONNECT(session, reason, (const char *)message, ++ message_len, (const char *)language, ++ language_len); + } ++ + _libssh2_debug(session, LIBSSH2_TRACE_TRANS, + "Disconnect(%d): %s(%s)", reason, + message, language); @@ -534,23 +526,24 +@@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + int always_display = data[1]; + + if(datalen >= 6) { +- message_len = _libssh2_ntohu32(data + 2); +- +- if(message_len <= (datalen - 10)) { +- /* 6 = packet_type(1) + display(1) + message_len(4) */ +- message = (char *) data + 6; +- language_len = _libssh2_ntohu32(data + 6 + +- message_len); +- +- if(language_len <= (datalen - 10 - message_len)) +- language = (char *) data + 10 + message_len; +- } ++ struct string_buf buf; ++ buf.data = (unsigned char *)data; ++ buf.dataptr = buf.data; ++ buf.len = datalen; ++ buf.dataptr += 2; /* advance past type & always ++ display */ ++ ++ _libssh2_get_string(&buf, &message, &message_len); ++ _libssh2_get_string(&buf, &language, ++ &language_len); + } + + if(session->ssh_msg_debug) { +- LIBSSH2_DEBUG(session, always_display, message, +- message_len, language, language_len); ++ LIBSSH2_DEBUG(session, always_display, ++ (const char *)message, ++ message_len, (const char *)language, ++ language_len); + } + } ++ + /* + * _libssh2_debug will actually truncate this for us so + * that it's not an inordinate about of data @@ -576,7 ++566,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, + uint32_t len = 0; + unsigned char want_reply = 0; + len = _libssh2_ntohu32(data + 1); +- if(datalen >= (6 + len)) { ++ if((len <= (UINT_MAX - 6)) && (datalen >= (6 + len)))
++ {
+ want_reply = data[5 + len];
+ _libssh2_debug(session,
+ LIBSSH2_TRACE_CONN,
meta-oe/recipes-support/libssh2/libssh2_1.8.2.bb +1 -1
@@ -17,6 +17,7 @@ inherit autotools pkgconfig EXTRA_OECONF += "\ --with-libz \ --with-libz-prefix=${STAGING_LIBDIR} \ + file://CVE-2019-17498.patch \ " # only one of openssl and gcrypt could be set --
2.17.1