From 8f08618a0d0e56a168834c56bdbd2c45617e8719 Mon Sep 17 00:00:00 2001 From: wangxp006 Date: Mon, 21 Dec 2020 16:33:17 +0800 Subject: [PATCH 1/3] CVE-2020-8037 --- CVE-2020-8037.patch | 65 +++++++++++++++++++++++++++++++++++++++++++++ tcpdump.spec | 8 +++++- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 CVE-2020-8037.patch diff --git a/CVE-2020-8037.patch b/CVE-2020-8037.patch new file mode 100644 index 0000000..b321549 --- /dev/null +++ b/CVE-2020-8037.patch @@ -0,0 +1,65 @@ +From 32027e199368dad9508965aae8cd8de5b6ab5231 Mon Sep 17 00:00:00 2001 +From: Guy Harris +Date: Sat, 18 Apr 2020 14:04:59 -0700 +Subject: [PATCH] PPP: When un-escaping, don't allocate a too-large +buffer. + +The buffer should be big enough to hold the captured data, but it +doesn't need to be big enough to hold the entire on-the-network packet, +if we haven't captured all of it. + +(backported from commit e4add0b010ed6f2180dcb05a13026242ed935334) +--- + print-ppp.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/print-ppp.c b/print-ppp.c +index 891761728..33fb03412 100644 +--- a/print-ppp.c ++++ b/print-ppp.c +@@ -1367,19 +1367,29 @@ + return 0; + } + ++/* ++ * Un-escape RFC 1662 PPP in HDLC-like framing, with octet escapes. ++ * The length argument is the on-the-wire length, not the captured ++ * length; we can only un-escape the captured part. ++ */ + static void + ppp_hdlc(netdissect_options *ndo, + const u_char *p, int length) + { ++ u_int caplen = ndo->ndo_snapend - p; + u_char *b, *t, c; + const u_char *s; +- int i, proto; ++ u_int i; ++ int proto; + const void *se; + ++ if (caplen == 0) ++ return; ++ + if (length <= 0) + return; + +- b = (u_char *)malloc(length); ++ b = (u_char *)malloc(caplen); + if (b == NULL) + return; + +@@ -1388,10 +1398,10 @@ + * Do this so that we dont overwrite the original packet + * contents. + */ +- for (s = p, t = b, i = length; i > 0 && ND_TTEST(*s); i--) { ++ for (s = p, t = b, i = caplen; i != 0; i--) { + c = *s++; + if (c == 0x7d) { +- if (i <= 1 || !ND_TTEST(*s)) ++ if (i <= 1) + break; + i--; + c = *s++ ^ 0x20; + diff --git a/tcpdump.spec b/tcpdump.spec index 2b8e07a..3f0cd46 100644 --- a/tcpdump.spec +++ b/tcpdump.spec @@ -1,7 +1,7 @@ Name: tcpdump Epoch: 14 Version: 4.9.3 -Release: 3 +Release: 4 Summary: A network traffic monitoring tool License: BSD with advertising URL: http://www.tcpdump.org @@ -89,6 +89,12 @@ exit 0 %{_mandir}/man8/tcpdump.8* %changelog +* Mon Dec 21 2020 wangxp006 - 4.9.3-4 +- Type:CVE +- ID:CVE-2020-8037 +- SUG:NA +- DESC:fix CVE-2020-8037 + * Tue Dec 31 2019 openEuler Buildteam - 4.9.3-3 - Type:bugfix - ID:NA From 6e08413d6cc5fcd65f4d5272c7ccdbda53db24d3 Mon Sep 17 00:00:00 2001 From: wangxp006 Date: Mon, 21 Dec 2020 16:45:31 +0800 Subject: [PATCH 2/3] add patch --- tcpdump.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tcpdump.spec b/tcpdump.spec index 3f0cd46..f2ea543 100644 --- a/tcpdump.spec +++ b/tcpdump.spec @@ -1,7 +1,7 @@ Name: tcpdump Epoch: 14 Version: 4.9.3 -Release: 4 +Release: 5 Summary: A network traffic monitoring tool License: BSD with advertising URL: http://www.tcpdump.org @@ -19,6 +19,7 @@ Patch0007: 0007-Introduce-nn-option.patch Patch0009: 0009-Change-n-flag-to-nn-in-TESTonce.patch Patch0011: 0011-Evp-cipher-buffers.patch Patch0012: 0012-Add-printing-support-for-vsockmon-devices.patch +Patch0013: CVE-2020-8037.patch Requires(pre): shadow-utils BuildRequires: automake openssl-devel libpcap-devel git-core gcc @@ -89,6 +90,12 @@ exit 0 %{_mandir}/man8/tcpdump.8* %changelog +* Mon Dec 21 2020 wangxp006 - 4.9.3-5 +- Type:CVE +- ID:CVE-2020-8037 +- SUG:NA +- DESC:fix CVE-2020-8037 + * Mon Dec 21 2020 wangxp006 - 4.9.3-4 - Type:CVE - ID:CVE-2020-8037 From 44bc4bca28f385f8cb06551d3f23c2ae90f2ac94 Mon Sep 17 00:00:00 2001 From: wangxp006 Date: Mon, 21 Dec 2020 16:52:57 +0800 Subject: [PATCH 3/3] modify version --- tcpdump.spec | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tcpdump.spec b/tcpdump.spec index f2ea543..70831f3 100644 --- a/tcpdump.spec +++ b/tcpdump.spec @@ -1,7 +1,7 @@ Name: tcpdump Epoch: 14 Version: 4.9.3 -Release: 5 +Release: 4 Summary: A network traffic monitoring tool License: BSD with advertising URL: http://www.tcpdump.org @@ -90,12 +90,6 @@ exit 0 %{_mandir}/man8/tcpdump.8* %changelog -* Mon Dec 21 2020 wangxp006 - 4.9.3-5 -- Type:CVE -- ID:CVE-2020-8037 -- SUG:NA -- DESC:fix CVE-2020-8037 - * Mon Dec 21 2020 wangxp006 - 4.9.3-4 - Type:CVE - ID:CVE-2020-8037