CVE-2018-18312
--------------
heap-buffer-overflow write can happen during compilation for a
specially crafted reqular expression.
CVE-2018-18314
--------------
Certain assumptions were made during first pass by extended character
class parser and does not do proper error checking resulting in heap
buffer overrun.
Note: The patches were rebuilt for perl 5.24.1 from following upstream
commits in https://github.com/Perl/perl5/ -
(1) 9506e94549891cb5a05414c9f66deab201a54b89
(2) b3d05682766f714d475eab328af413b3634363bf
(3) 19a498a461d7c81ae3507c450953d1148efecf4f
Change-Id: I05bf74cf5292b28c42a8b127c649af4b419e86e6
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6814
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
Tested-by: Anish Swaminathan <anishs@vmware.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,21 @@ |
| 0 |
+From df2858ea28eb2c7e00a4bd6a5ed95e4782f88333 Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: Karl Williamson <khw@cpan.org> |
|
| 2 |
+Date: Mon, 24 Sep 2018 11:54:41 -0600 |
|
| 3 |
+Subject: [PATCH 242/242] PATCH: [perl #133423] for 5.26 maint |
|
| 4 |
+ |
|
| 5 |
+--- |
|
| 6 |
+ regcomp.c | 1 - |
|
| 7 |
+ 1 files changed, 1 deletion(-) |
|
| 8 |
+ |
|
| 9 |
+diff --git a/regcomp.c b/regcomp.c |
|
| 10 |
+index ca47db7573..431006e855 100644 |
|
| 11 |
+--- a/regcomp.c |
|
| 12 |
+@@ -15109,7 +15109,6 @@ redo_curchar: |
|
| 13 |
+ if (UCHARAT(RExC_parse) != ')') |
|
| 14 |
+ vFAIL("Expecting close paren for wrapper for nested extended charclass");
|
|
| 15 |
+ |
|
| 16 |
+- RExC_parse++; |
|
| 17 |
+ RExC_flags = save_flags; |
|
| 18 |
+ goto handle_operand; |
|
| 19 |
+ } |
| 0 | 20 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,77 @@ |
| 0 |
+--- a/regcomp.c 2016-07-15 00:38:08.000000000 +0530 |
|
| 1 |
+@@ -14582,7 +14582,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t * |
|
| 2 |
+ * these things, we need to realize that something preceded by a backslash |
|
| 3 |
+ * is escaped, so we have to keep track of backslashes */ |
|
| 4 |
+ if (SIZE_ONLY) {
|
|
| 5 |
+- UV depth = 0; /* how many nested (?[...]) constructs */ |
|
| 6 |
++ UV nest_depth = 0; /* how many nested (?[...]) constructs */ |
|
| 7 |
+ |
|
| 8 |
+ while (RExC_parse < RExC_end) {
|
|
| 9 |
+ SV* current = NULL; |
|
| 10 |
+@@ -14591,8 +14591,9 @@ S_handle_regex_sets(pTHX_ RExC_state_t * |
|
| 11 |
+ TRUE /* Force /x */ ); |
|
| 12 |
+ |
|
| 13 |
+ switch (*RExC_parse) {
|
|
| 14 |
+- case '?': |
|
| 15 |
+- if (RExC_parse[1] == '[') depth++, RExC_parse++; |
|
| 16 |
++ case '(':
|
|
| 17 |
++ if (RExC_parse[1] == '?' && RExC_parse[2] == '[') |
|
| 18 |
++ nest_depth++, RExC_parse+=2; |
|
| 19 |
+ /* FALLTHROUGH */ |
|
| 20 |
+ default: |
|
| 21 |
+ break; |
|
| 22 |
+@@ -14649,9 +14650,9 @@ S_handle_regex_sets(pTHX_ RExC_state_t * |
|
| 23 |
+ } |
|
| 24 |
+ |
|
| 25 |
+ case ']': |
|
| 26 |
+- if (depth--) break; |
|
| 27 |
+- RExC_parse++; |
|
| 28 |
+- if (*RExC_parse == ')') {
|
|
| 29 |
++ if (RExC_parse[1] == ')') {
|
|
| 30 |
++ RExC_parse++; |
|
| 31 |
++ if (nest_depth--) break; |
|
| 32 |
+ node = reganode(pRExC_state, ANYOF, 0); |
|
| 33 |
+ RExC_size += ANYOF_SKIP; |
|
| 34 |
+ nextchar(pRExC_state); |
|
| 35 |
+@@ -14663,7 +14664,13 @@ S_handle_regex_sets(pTHX_ RExC_state_t * |
|
| 36 |
+ |
|
| 37 |
+ return node; |
|
| 38 |
+ } |
|
| 39 |
+- goto no_close; |
|
| 40 |
++ /* We output the messages even if warnings are off, because we'll fail |
|
| 41 |
++ * the very next thing, and these give a likely diagnosis for that */ |
|
| 42 |
++ if (posix_warnings && av_tindex_nomg(posix_warnings) >= 0) {
|
|
| 43 |
++ output_or_return_posix_warnings(pRExC_state, posix_warnings, NULL); |
|
| 44 |
++ } |
|
| 45 |
++ RExC_parse++; |
|
| 46 |
++ vFAIL("Unexpected ']' with no following ')' in (?[...");
|
|
| 47 |
+ } |
|
| 48 |
+ |
|
| 49 |
+ RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1; |
|
| 50 |
+@@ -14676,7 +14683,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t * |
|
| 51 |
+ output_or_return_posix_warnings(pRExC_state, posix_warnings, NULL); |
|
| 52 |
+ } |
|
| 53 |
+ |
|
| 54 |
+- FAIL("Syntax error in (?[...])");
|
|
| 55 |
++ vFAIL("Syntax error in (?[...])");
|
|
| 56 |
+ } |
|
| 57 |
+ |
|
| 58 |
+ /* Pass 2 only after this. */ |
|
| 59 |
+@@ -14850,12 +14857,14 @@ redo_curchar: |
|
| 60 |
+ * inversion list, and RExC_parse points to the trailing |
|
| 61 |
+ * ']'; the next character should be the ')' */ |
|
| 62 |
+ RExC_parse++; |
|
| 63 |
+- assert(UCHARAT(RExC_parse) == ')'); |
|
| 64 |
++ if (UCHARAT(RExC_parse) != ')') |
|
| 65 |
++ vFAIL("Expecting close paren for nested extended charclass");
|
|
| 66 |
+ |
|
| 67 |
+ /* Then the ')' matching the original '(' handled by this
|
|
| 68 |
+ * case: statement */ |
|
| 69 |
+ RExC_parse++; |
|
| 70 |
+- assert(UCHARAT(RExC_parse) == ')'); |
|
| 71 |
++ if (UCHARAT(RExC_parse) != ')') |
|
| 72 |
++ vFAIL("Expecting close paren for wrapper for nested extended charclass");
|
|
| 73 |
+ |
|
| 74 |
+ RExC_parse++; |
|
| 75 |
+ RExC_flags = save_flags; |
| ... | ... |
@@ -9,7 +9,7 @@ |
| 9 | 9 |
Summary: Practical Extraction and Report Language |
| 10 | 10 |
Name: perl |
| 11 | 11 |
Version: 5.24.1 |
| 12 |
-Release: 7%{?dist}
|
|
| 12 |
+Release: 8%{?dist}
|
|
| 13 | 13 |
License: GPLv1+ |
| 14 | 14 |
URL: http://www.perl.org/ |
| 15 | 15 |
Group: Development/Languages |
| ... | ... |
@@ -27,6 +27,8 @@ Patch5: perl-CVE-2018-6913.patch |
| 27 | 27 |
Patch6: perl-CVE-2018-12015.patch |
| 28 | 28 |
Patch7: perl-CVE-2018-18311.patch |
| 29 | 29 |
Patch8: perl-CVE-2018-18313.patch |
| 30 |
+Patch9: perl-CVE-2018-18314.patch |
|
| 31 |
+Patch10: perl-CVE-2018-18312.patch |
|
| 30 | 32 |
Provides: perl >= 0:5.003000 |
| 31 | 33 |
Provides: perl(getopts.pl) |
| 32 | 34 |
Provides: /bin/perl |
| ... | ... |
@@ -52,6 +54,8 @@ sed -i 's/-fstack-protector/&-all/' Configure |
| 52 | 52 |
%patch6 -p1 |
| 53 | 53 |
%patch7 -p1 |
| 54 | 54 |
%patch8 -p1 |
| 55 |
+%patch9 -p1 |
|
| 56 |
+%patch10 -p1 |
|
| 55 | 57 |
|
| 56 | 58 |
%build |
| 57 | 59 |
export BUILD_ZLIB=False |
| ... | ... |
@@ -88,6 +92,8 @@ make test TEST_SKIP_VERSION_CHECK=1 |
| 88 | 88 |
%{_libdir}/perl5/%{version}/*
|
| 89 | 89 |
%{_mandir}/*/*
|
| 90 | 90 |
%changelog |
| 91 |
+* Fri Mar 01 2019 Dweep Advani <dadvani@vmware.com> 5.24.1-8 |
|
| 92 |
+- Fixed CVE-2018-18312 and CVE-2018-18314 |
|
| 91 | 93 |
* Fri Feb 22 2019 Dweep Advani <dadvani@vmware.com> 5.24.1-7 |
| 92 | 94 |
- Fixed CVE-2018-18311 and CVE-2018-18313 |
| 93 | 95 |
* Mon Aug 13 2018 Dweep Advani <dadvani@vmware.com> 5.24.1-6 |