Backport shellshock fixes to dylan branch
cover Backport shellshock fixes to dylan branch
The following changes since commit bf2d5380808bb3e0ad470e7853e3ae20617bbfd6:
openssl: fix for CVE-2010-5298 (2014-06-09 13:57:13 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/bash-fixes-dylan
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/bash-fixes-dylan
Catalin Popeanga (4):
bash: Fix for exported function namespace change
bash: Fix for CVE-2014-7186 and CVE-2014-7187
bash: Fix for CVE-2014-6277
bash: Fix-for-CVE-2014-6278
Khem Raj (1):
bash: Fix CVE-2014-7169
Ross Burton (1):
bash: fix CVE-2014-6271
...r-bash-exported-function-namespace-change.patch | 158 +++++++++++++++ .../bash/bash-3.2.48/cve-2014-6271.patch | 77 ++++++++ .../bash/bash-3.2.48/cve-2014-6277.patch | 44 +++++ .../bash/bash-3.2.48/cve-2014-6278.patch | 99 ++++++++++ .../bash/bash-3.2.48/cve-2014-7169.patch | 16 ++ .../bash-3.2.48/cve-2014-7186_cve-2014-7187.patch | 99 ++++++++++ ...r-bash-exported-function-namespace-change.patch | 212 +++++++++++++++++++++ .../bash/bash-4.2/cve-2014-6271.patch | 95 +++++++++ .../bash/bash-4.2/cve-2014-6277.patch | 44 +++++ .../bash/bash-4.2/cve-2014-6278.patch | 127 ++++++++++++ .../bash/bash-4.2/cve-2014-7169.patch | 16 ++ .../bash-4.2/cve-2014-7186_cve-2014-7187.patch | 167 ++++++++++++++++ meta/recipes-extended/bash/bash_3.2.48.bb | 6 + meta/recipes-extended/bash/bash_4.2.bb | 6 + 14 files changed, 1166 insertions(+) create mode 100644 meta/recipes-extended/bash/bash-3.2.48/Fix-for-bash-exported-function-namespace-change.patch create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-6271.patch create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-6277.patch create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-6278.patch create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-7169.patch create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-7186_cve-2014-7187.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/Fix-for-bash-exported-function-namespace-change.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-6271.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-6277.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-6278.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-7169.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-7186_cve-2014-7187.patch
Signature · 1 line
1.9.3
PATCH 1/6 bash: fix CVE-2014-6271
From: Ross Burton <[email protected]>
CVE-2014-6271 aka ShellShock.
"GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which allows remote attackers to execute arbitrary code via a crafted environment."
(From OE-Core master rev: 798d833c9d4bd9ab287fa86b85b4d5f128170ed3)
--- .../bash/bash-3.2.48/cve-2014-6271.patch | 77 ++++++++++++++++++ .../bash/bash-4.2/cve-2014-6271.patch | 95 ++++++++++++++++++++++ meta/recipes-extended/bash/bash_3.2.48.bb | 1 + meta/recipes-extended/bash/bash_4.2.bb | 1 + 4 files changed, 174 insertions(+) create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-6271.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-6271.patch
meta/recipes-extended/bash/bash-3.2.48/cve-2014-6271.patch new file +77 -0
@@ -0,0 +1,77 @@ +Fix CVE-2014-6271, aka ShellShock. + +Upstream-Status: Backport +Signed-off-by: Ross Burton <[email protected]> + +*** ../bash-3.2.51/builtins/common.h 2006-03-06 09:38:44.000000000 -0500 +--- builtins/common.h 2014-09-16 19:08:02.000000000 -0400 +*************** +*** 34,37 **** +--- 34,39 ---- + + /* Flags for describe_command, shared between type.def and command.def */ ++ #define SEVAL_FUNCDEF 0x080 /* only allow function definitions */ ++ #define SEVAL_ONECMD 0x100 /* only allow a single command */ + #define CDESC_ALL 0x001 /* type -a */ + #define CDESC_SHORTDESC 0x002 /* command -V */ +*** ../bash-3.2.51/builtins/evalstring.c 2008-11-15 17:47:04.000000000 -0500 +--- builtins/evalstring.c 2014-09-16 19:08:02.000000000 -0400 +*************** +*** 235,238 **** +--- 235,246 ---- + struct fd_bitmap *bitmap; + ++ if ((flags & SEVAL_FUNCDEF) && command->type != cm_function_def) ++ { ++ internal_warning ("%s: ignoring function definition attempt", from_file); ++ should_jump_to_top_level = 0; ++ last_result = last_command_exit_value = EX_BADUSAGE; ++ break; ++ } ++ + bitmap = new_fd_bitmap (FD_BITMAP_SIZE); + begin_unwind_frame ("pe_dispose"); +*************** +*** 292,295 **** +--- 300,306 ---- + dispose_fd_bitmap (bitmap); + discard_unwind_frame ("pe_dispose"); ++ ++ if (flags & SEVAL_ONECMD) ++ break; + } + } +*** ../bash-3.2.51/variables.c 2008-11-15 17:15:06.000000000 -0500 +--- variables.c 2014-09-16 19:10:39.000000000 -0400 +*************** +*** 319,328 **** + strcpy (temp_string + char_index + 1, string); + +! parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST); +! +! /* Ancient backwards compatibility. Old versions of bash exported +! functions like name()=() {...} */ +! if (name[char_index - 1] == ')' && name[char_index - 2] == '(') +! name[char_index - 2] = '\0'; + + if (temp_var = find_function (name)) +--- 319,326 ---- + strcpy (temp_string + char_index + 1, string); + +! /* Don't import function names that are invalid identifiers from the +! environment. */ +! if (legal_identifier (name)) +! parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD); + + if (temp_var = find_function (name)) +*************** +*** 333,340 **** + else + report_error (_("error importing function definition for `%s'"), name); +- +- /* ( */ +- if (name[char_index - 1] == ')' && name[char_index - 2] == '\0') +- name[char_index - 2] = '('; /* ) */ + } + #if defined (ARRAY_VARS) +--- 331,334 ----
meta/recipes-extended/bash/bash-4.2/cve-2014-6271.patch new file +95 -0
95 lines not on this page · raw message
meta/recipes-extended/bash/bash_3.2.48.bb +1 -0
@@ -10,6 +10,7 @@ SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \ ${GNU_MIRROR}/bash/bash-3.2-patches/bash32-050;apply=yes;striplevel=0;name=patch002 \ ${GNU_MIRROR}/bash/bash-3.2-patches/bash32-051;apply=yes;striplevel=0;name=patch003 \ file://mkbuiltins_have_stringize.patch \ + file://cve-2014-6271.patch;striplevel=0 \ " SRC_URI[tarball.md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"
meta/recipes-extended/bash/bash_4.2.bb +1 -0
@@ -19,6 +19,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \ ${GNU_MIRROR}/bash/bash-4.2-patches/bash42-010;apply=yes;striplevel=0;name=patch010 \ file://execute_cmd.patch;striplevel=0 \ file://mkbuiltins_have_stringize.patch \ + file://cve-2014-6271.patch;striplevel=0 \ file://build-tests.patch \ file://test-output.patch \ file://run-ptest \
Signature · 1 line
1.9.3
PATCH 2/6 bash: Fix CVE-2014-7169
In reply to Paul EggletonFrom: Khem Raj <[email protected]>
This is a followup patch to incomplete CVE-2014-6271 fix code execution via specially-crafted environment
Change-Id: Ibb0a587ee6e09b8174e92d005356e822ad40d4ed (From OE-Core master rev: 76a2d6b83472995edbe967aed80f0fcbb784b3fc)
--- .../bash/bash-3.2.48/cve-2014-7169.patch | 16 ++++++++++++++++ meta/recipes-extended/bash/bash-4.2/cve-2014-7169.patch | 16 ++++++++++++++++ meta/recipes-extended/bash/bash_3.2.48.bb | 1 + meta/recipes-extended/bash/bash_4.2.bb | 1 + 4 files changed, 34 insertions(+) create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-7169.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-7169.patch
meta/recipes-extended/bash/bash-3.2.48/cve-2014-7169.patch new file +16 -0
@@ -0,0 +1,16 @@ +Taken from http://www.openwall.com/lists/oss-security/2016/09/25/10 + +Upstream-Status: Backport +Index: bash-3.2.48/parse.y +=================================================================== +--- bash-3.2.48.orig/parse.y 2008-04-29 18:24:55.000000000 -0700 ++++ bash-3.2.48/parse.y 2014-09-26 13:07:31.956080056 -0700 +@@ -2503,6 +2503,8 @@ + FREE (word_desc_to_read); + word_desc_to_read = (WORD_DESC *)NULL; + ++ eol_ungetc_lookahead = 0; ++ + last_read_token = '\n'; + token_to_read = '\n'; + }
meta/recipes-extended/bash/bash-4.2/cve-2014-7169.patch new file +16 -0
@@ -0,0 +1,16 @@ +Taken from http://www.openwall.com/lists/oss-security/2016/09/25/10 + +Upstream-Status: Backport +Index: bash-4.3/parse.y +=================================================================== +--- bash-4.3.orig/parse.y 2014-09-26 13:10:44.340080056 -0700 ++++ bash-4.3/parse.y 2014-09-26 13:11:44.764080056 -0700 +@@ -2953,6 +2953,8 @@ + FREE (word_desc_to_read); + word_desc_to_read = (WORD_DESC *)NULL; + ++ eol_ungetc_lookahead = 0; ++ + current_token = '\n'; /* XXX */ + last_read_token = '\n'; + token_to_read = '\n';
meta/recipes-extended/bash/bash_3.2.48.bb +1 -0
@@ -11,6 +11,7 @@ SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \ ${GNU_MIRROR}/bash/bash-3.2-patches/bash32-051;apply=yes;striplevel=0;name=patch003 \ file://mkbuiltins_have_stringize.patch \ file://cve-2014-6271.patch;striplevel=0 \ + file://cve-2014-7169.patch \ " SRC_URI[tarball.md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"
meta/recipes-extended/bash/bash_4.2.bb +1 -0
@@ -20,6 +20,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \ file://execute_cmd.patch;striplevel=0 \ file://mkbuiltins_have_stringize.patch \ file://cve-2014-6271.patch;striplevel=0 \ + file://cve-2014-7169.patch \ file://build-tests.patch \ file://test-output.patch \ file://run-ptest \
Signature · 1 line
1.9.3
PATCH 3/6 bash: Fix for exported function namespace change
In reply to Paul EggletonFrom: Catalin Popeanga <[email protected]>
This is a followup patch to incomplete CVE-2014-6271 fix code execution via specially-crafted environment
This patch changes the encoding bash uses for exported functions to avoid clashes with shell variables and to avoid depending only on an environment variable's contents to determine whether or not to interpret it as a shell function.
(From OE-Core daisy rev: 6c51cc96d03df26d1c10867633e7a10dfbec7c45)
--- ...r-bash-exported-function-namespace-change.patch | 158 +++++++++++++++ ...r-bash-exported-function-namespace-change.patch | 212 +++++++++++++++++++++ meta/recipes-extended/bash/bash_3.2.48.bb | 1 + meta/recipes-extended/bash/bash_4.2.bb | 1 + 4 files changed, 372 insertions(+) create mode 100644 meta/recipes-extended/bash/bash-3.2.48/Fix-for-bash-exported-function-namespace-change.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/Fix-for-bash-exported-function-namespace-change.patch
meta/recipes-extended/bash/bash-3.2.48/Fix-for-bash-exported-function-namespace-change.patch new file +158 -0
@@ -0,0 +1,158 @@ +Fix for exported function namespace change + +Upstream-Status: Backport + +Downloaded from: http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-054 + +Author: Chet Ramey <[email protected]> +Signed-off-by: Sona Sarmadi <[email protected]> + + + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-054 + +Bug-Reported-by: Florian Weimer <[email protected]> +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +This patch changes the encoding bash uses for exported functions to avoid +clashes with shell variables and to avoid depending only on an environment +variable's contents to determine whether or not to interpret it as a shell +function. +--- +--- a/variables.c 2014-09-16 19:10:39.000000000 -0400 ++++ b/variables.c 2014-09-27 21:02:08.000000000 -0400 +@@ -75,4 +75,9 @@ + #define ifsname(s) ((s)[0] == 'I' && (s)[1] == 'F' && (s)[2] == 'S' && (s)[3] == '\0') + ++#define BASHFUNC_PREFIX "BASH_FUNC_" ++#define BASHFUNC_PREFLEN 10 /* == strlen(BASHFUNC_PREFIX */ ++#define BASHFUNC_SUFFIX "%%" ++#define BASHFUNC_SUFFLEN 2 /* == strlen(BASHFUNC_SUFFIX) */ ++ + extern char **environ; + +@@ -242,5 +247,5 @@ + static void dispose_temporary_env __P((sh_free_func_t *)); + +-static inline char *mk_env_string __P((const char *, const char *)); ++static inline char *mk_env_string __P((const char *, const char *, int)); + static char **make_env_array_from_var_list __P((SHELL_VAR **)); + static char **make_var_export_array __P((VAR_CONTEXT *)); +@@ -310,19 +315,30 @@ + /* If exported function, define it now. Don't import functions from + the environment in privileged mode. */ +- if (privmode == 0 && read_but_dont_execute == 0 && STREQN ("() {", string, 4)) ++ if (privmode == 0 && read_but_dont_execute == 0 && ++ STREQN (BASHFUNC_PREFIX, name, BASHFUNC_PREFLEN) && ++ STREQ (BASHFUNC_SUFFIX, name + char_index - BASHFUNC_SUFFLEN) && ++ STREQN ("() {", string, 4)) + { ++ size_t namelen; ++ char *tname; /* desired imported function name */ ++ ++ namelen = char_index - BASHFUNC_PREFLEN - BASHFUNC_SUFFLEN; ++ ++ tname = name + BASHFUNC_PREFLEN; /* start of func name */ ++ tname[namelen] = '\0'; /* now tname == func name */ ++ + string_length = strlen (string); +- temp_string = (char *)xmalloc (3 + string_length + char_index); ++ temp_string = (char *)xmalloc (namelen + string_length + 2); + +- strcpy (temp_string, name); +- temp_string[char_index] = ' '; +- strcpy (temp_string + char_index + 1, string); ++ memcpy (temp_string, tname, namelen); ++ temp_string[namelen] = ' '; ++ memcpy (temp_string + namelen + 1, string, string_length + 1); + + /* Don't import function names that are invalid identifiers from the + environment. */ +- if (legal_identifier (name)) +- parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD); ++ if (absolute_program (tname) == 0 && (posixly_correct == 0 || legal_identifier (tname))) ++ parse_and_execute (temp_string, tname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD); + +- if (temp_var = find_function (name)) ++ if (temp_var = find_function (tname)) + { + VSETATTR (temp_var, (att_exported|att_imported)); +@@ -330,5 +346,8 @@ + } + else +- report_error (_("error importing function definition for `%s'"), name); ++ report_error (_("error importing function definition for `%s'"), tname); ++ ++ /* Restore original suffix */ ++ tname[namelen] = BASHFUNC_SUFFIX[0]; + } + #if defined (ARRAY_VARS) +@@ -2208,5 +2227,5 @@ + + INVALIDATE_EXPORTSTR (var); +- var->exportstr = mk_env_string (name, value); ++ var->exportstr = mk_env_string (name, value, 0); + + array_needs_making = 1; +@@ -2999,19 +3018,40 @@ + + static inline char * +-mk_env_string (name, value) ++mk_env_string (name, value, isfunc) + const char *name, *value; ++ int isfunc; + { +- int name_len, value_len; +- char *p; ++ size_t name_len, value_len; ++ char *p, *q; + + name_len = strlen (name); + value_len = STRLEN (value); +- p = (char *)xmalloc (2 + name_len + value_len); +- strcpy (p, name); +- p[name_len] = '='; ++ ++ /* If we are exporting a shell function, construct the encoded function ++ name. */ ++ if (isfunc && value) ++ { ++ p = (char *)xmalloc (BASHFUNC_PREFLEN + name_len + BASHFUNC_SUFFLEN + value_len + 2); ++ q = p; ++ memcpy (q, BASHFUNC_PREFIX, BASHFUNC_PREFLEN); ++ q += BASHFUNC_PREFLEN; ++ memcpy (q, name, name_len); ++ q += name_len; ++ memcpy (q, BASHFUNC_SUFFIX, BASHFUNC_SUFFLEN); ++ q += BASHFUNC_SUFFLEN; ++ } ++ else ++ { ++ p = (char *)xmalloc (2 + name_len + value_len); ++ memcpy (p, name, name_len); ++ q = p + name_len; ++ } ++ ++ q[0] = '='; + if (value && *value) +- strcpy (p + name_len + 1, value); ++ memcpy (q + 1, value, value_len + 1); + else +- p[name_len + 1] = '\0'; ++ q[1] = '\0'; ++ + return (p); + } +@@ -3088,5 +3128,5 @@ + using the cached exportstr... */ + list[list_index] = USE_EXPORTSTR ? savestring (value) +- : mk_env_string (var->name, value); ++ : mk_env_string (var->name, value, function_p (var)); + + if (USE_EXPORTSTR == 0)
meta/recipes-extended/bash/bash-4.2/Fix-for-bash-exported-function-namespace-change.patch new file +212 -0
212 lines not on this page · raw message
meta/recipes-extended/bash/bash_3.2.48.bb +1 -0
@@ -12,6 +12,7 @@ SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \ file://mkbuiltins_have_stringize.patch \ file://cve-2014-6271.patch;striplevel=0 \ file://cve-2014-7169.patch \ + file://Fix-for-bash-exported-function-namespace-change.patch \ " SRC_URI[tarball.md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"
meta/recipes-extended/bash/bash_4.2.bb +1 -0
@@ -23,6 +23,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \ file://cve-2014-7169.patch \ file://build-tests.patch \ file://test-output.patch \ + file://Fix-for-bash-exported-function-namespace-change.patch;striplevel=0 \ file://run-ptest \ "
Signature · 1 line
1.9.3
PATCH 4/6 bash: Fix for CVE-2014-7186 and CVE-2014-7187
In reply to Paul EggletonFrom: Catalin Popeanga <[email protected]>
This is a followup patch to incomplete CVE-2014-6271 fix code execution via specially-crafted environment
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-7186
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-7187
(From OE-Core daisy rev: 153d1125659df9e5c09e35a58bd51be184cb13c1)
--- .../bash-3.2.48/cve-2014-7186_cve-2014-7187.patch | 99 ++++++++++++ .../bash-4.2/cve-2014-7186_cve-2014-7187.patch | 167 +++++++++++++++++++++ meta/recipes-extended/bash/bash_3.2.48.bb | 1 + meta/recipes-extended/bash/bash_4.2.bb | 1 + 4 files changed, 268 insertions(+) create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-7186_cve-2014-7187.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-7186_cve-2014-7187.patch
meta/recipes-extended/bash/bash-3.2.48/cve-2014-7186_cve-2014-7187.patch new file +99 -0
@@ -0,0 +1,99 @@ +bash: Fix for CVE-2014-7186 and CVE-2014-7187 + +Upstream-Status: Backport {GNU Patch-ID: bash32-055} + +Downloaded from: http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-055 + +Author: Chet Ramey <[email protected]> +Signed-off-by: Sona Sarmadi <[email protected]> + + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-055 + +Bug-Reported-by: Florian Weimer <[email protected]> +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +There are two local buffer overflows in parse.y that can cause the shell +to dump core when given many here-documents attached to a single command +or many nested loops. +--- +--- a/parse.y 2014-09-27 12:17:16.000000000 -0400 ++++ b/parse.y 2014-09-30 19:43:22.000000000 -0400 +@@ -166,4 +166,7 @@ + static int reserved_word_acceptable __P((int)); + static int yylex __P((void)); ++ ++static void push_heredoc __P((REDIRECT *)); ++static char *mk_alexpansion __P((char *)); + static int alias_expand_token __P((char *)); + static int time_command_acceptable __P((void)); +@@ -254,5 +257,7 @@ + /* Variables to manage the task of reading here documents, because we need to + defer the reading until after a complete command has been collected. */ +-static REDIRECT *redir_stack[10]; ++#define HEREDOC_MAX 16 ++ ++static REDIRECT *redir_stack[HEREDOC_MAX]; + int need_here_doc; + +@@ -280,5 +285,5 @@ + index is decremented after a case, select, or for command is parsed. */ + #define MAX_CASE_NEST 128 +-static int word_lineno[MAX_CASE_NEST]; ++static int word_lineno[MAX_CASE_NEST+1]; + static int word_top = -1; + +@@ -425,5 +430,5 @@ + redir.filename = $2; + $$ = make_redirection (0, r_reading_until, redir); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | NUMBER LESS_LESS WORD +@@ -431,5 +436,5 @@ + redir.filename = $3; + $$ = make_redirection ($1, r_reading_until, redir); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | LESS_LESS_LESS WORD +@@ -488,5 +493,5 @@ + $$ = make_redirection + (0, r_deblank_reading_until, redir); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | NUMBER LESS_LESS_MINUS WORD +@@ -495,5 +500,5 @@ + $$ = make_redirection + ($1, r_deblank_reading_until, redir); +- redir_stack[need_here_doc++] = $$; ++ push_heredoc ($$); + } + | GREATER_AND '-' +@@ -2214,4 +2219,19 @@ + static int esacs_needed_count; + ++static void ++push_heredoc (r) ++ REDIRECT *r; ++{ ++ if (need_here_doc >= HEREDOC_MAX) ++ { ++ last_command_exit_value = EX_BADUSAGE; ++ need_here_doc = 0; ++ report_syntax_error (_("maximum here-document count exceeded")); ++ reset_parser (); ++ exit_shell (last_command_exit_value); ++ } ++ redir_stack[need_here_doc++] = r; ++} ++ + void + gather_here_documents ()
meta/recipes-extended/bash/bash-4.2/cve-2014-7186_cve-2014-7187.patch new file +167 -0
167 lines not on this page · raw message
meta/recipes-extended/bash/bash_3.2.48.bb +1 -0
@@ -13,6 +13,7 @@ SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \ file://cve-2014-6271.patch;striplevel=0 \ file://cve-2014-7169.patch \ file://Fix-for-bash-exported-function-namespace-change.patch \ + file://cve-2014-7186_cve-2014-7187.patch \ " SRC_URI[tarball.md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"
meta/recipes-extended/bash/bash_4.2.bb +1 -0
@@ -24,6 +24,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \ file://build-tests.patch \ file://test-output.patch \ file://Fix-for-bash-exported-function-namespace-change.patch;striplevel=0 \ + file://cve-2014-7186_cve-2014-7187.patch;striplevel=0 \ file://run-ptest \ "
Signature · 1 line
1.9.3
PATCH 5/6 bash: Fix for CVE-2014-6277
In reply to Paul EggletonFrom: Catalin Popeanga <[email protected]>
Follow up bash42-049 to parse properly function definitions in the values of environment variables, to not allow remote attackers to execute arbitrary code or to cause a denial of service.
See: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-6277
(From OE-Core daisy rev: 85961bcf81650992259cebb0ef1f1c6cdef3fefa)
--- .../bash/bash-3.2.48/cve-2014-6277.patch | 44 ++++++++++++++++++++++ .../bash/bash-4.2/cve-2014-6277.patch | 44 ++++++++++++++++++++++ meta/recipes-extended/bash/bash_3.2.48.bb | 1 + meta/recipes-extended/bash/bash_4.2.bb | 1 + 4 files changed, 90 insertions(+) create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-6277.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-6277.patch
meta/recipes-extended/bash/bash-3.2.48/cve-2014-6277.patch new file +44 -0
@@ -0,0 +1,44 @@ +bash: Fix CVE-2014-6277 (shellshock) + +Upstream-status: backport + +Downloaded from: +ftp://ftp.gnu.org/pub/bash/bash-3.2-patches/bash32-056 + +Author: Chet Ramey <[email protected]> +Signed-off-by: Catalin Popeanga <[email protected]> + + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-056 + +Bug-Reported-by: Michal Zalewski <[email protected]> +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +When bash is parsing a function definition that contains a here-document +delimited by end-of-file (or end-of-string), it leaves the closing delimiter +uninitialized. This can result in an invalid memory access when the parsed +function is later copied. +--- +--- a/make_cmd.c 2006-09-12 09:21:22.000000000 -0400 ++++ b/make_cmd.c 2014-10-02 11:41:40.000000000 -0400 +@@ -677,4 +677,5 @@ + temp->redirector = source; + temp->redirectee = dest_and_filename; ++ temp->here_doc_eof = 0; + temp->instruction = instruction; + temp->flags = 0; +--- a/copy_cmd.c 2003-10-07 11:43:44.000000000 -0400 ++++ b/copy_cmd.c 2014-10-02 11:41:40.000000000 -0400 +@@ -117,5 +117,5 @@ + case r_reading_until: + case r_deblank_reading_until: +- new_redirect->here_doc_eof = savestring (redirect->here_doc_eof); ++ new_redirect->here_doc_eof = redirect->here_doc_eof ? savestring (redirect->here_doc_eof) : 0; + /*FALLTHROUGH*/ + case r_reading_string:
meta/recipes-extended/bash/bash-4.2/cve-2014-6277.patch new file +44 -0
44 lines not on this page · raw message
meta/recipes-extended/bash/bash_3.2.48.bb +1 -0
@@ -14,6 +14,7 @@ SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \ file://cve-2014-7169.patch \ file://Fix-for-bash-exported-function-namespace-change.patch \ file://cve-2014-7186_cve-2014-7187.patch \ + file://cve-2014-6277.patch \ " SRC_URI[tarball.md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"
meta/recipes-extended/bash/bash_4.2.bb +1 -0
@@ -25,6 +25,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \ file://test-output.patch \ file://Fix-for-bash-exported-function-namespace-change.patch;striplevel=0 \ file://cve-2014-7186_cve-2014-7187.patch;striplevel=0 \ + file://cve-2014-6277.patch \ file://run-ptest \ "
Signature · 1 line
1.9.3
PATCH 6/6 bash: Fix-for-CVE-2014-6278
In reply to Paul EggletonFrom: Catalin Popeanga <[email protected]>
This vulnerability exists because of an incomplete fix for CVE-2014-6271, CVE-2014-7169, and CVE-2014-6277
See: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-6278
(From OE-Core daisy rev: de596b5f31e837dcd2ce991245eb5548f12d72ae)
--- .../bash/bash-3.2.48/cve-2014-6278.patch | 99 ++++++++++++++++ .../bash/bash-4.2/cve-2014-6278.patch | 127 +++++++++++++++++++++ meta/recipes-extended/bash/bash_3.2.48.bb | 1 + meta/recipes-extended/bash/bash_4.2.bb | 1 + 4 files changed, 228 insertions(+) create mode 100644 meta/recipes-extended/bash/bash-3.2.48/cve-2014-6278.patch create mode 100644 meta/recipes-extended/bash/bash-4.2/cve-2014-6278.patch
meta/recipes-extended/bash/bash-3.2.48/cve-2014-6278.patch new file +99 -0
@@ -0,0 +1,99 @@ +bash: Fix CVE-2014-6278 (shellshock) + +Upstream-status: backport + +Downloaded from: +ftp://ftp.gnu.org/pub/bash/bash-3.2-patches/bash32-057 + +Author: Chet Ramey <[email protected]> +Signed-off-by: Catalin Popeanga <[email protected]> + + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-057 + +Bug-Reported-by: Michal Zalewski <[email protected]> +Bug-Reference-ID: +Bug-Reference-URL: + +Bug-Description: + +A combination of nested command substitutions and function importing from +the environment can cause bash to execute code appearing in the environment +variable value following the function definition. + +--- a/builtins/evalstring.c 2014-09-16 19:08:02.000000000 -0400 ++++ b/builtins/evalstring.c 2014-10-04 15:58:35.000000000 -0400 +@@ -44,4 +44,5 @@ + #include "../redir.h" + #include "../trap.h" ++#include "../bashintl.h" + + #if defined (HISTORY) +@@ -235,10 +236,23 @@ + struct fd_bitmap *bitmap; + +- if ((flags & SEVAL_FUNCDEF) && command->type != cm_function_def) ++ if (flags & SEVAL_FUNCDEF) + { +- internal_warning ("%s: ignoring function definition attempt", from_file); +- should_jump_to_top_level = 0; +- last_result = last_command_exit_value = EX_BADUSAGE; +- break; ++ char *x; ++ ++ /* If the command parses to something other than a straight ++ function definition, or if we have not consumed the entire ++ string, or if the parser has transformed the function ++ name (as parsing will if it begins or ends with shell ++ whitespace, for example), reject the attempt */ ++ if (command->type != cm_function_def || ++ ((x = parser_remaining_input ()) && *x) || ++ (STREQ (from_file, command->value.Function_def->name->word) == 0)) ++ { ++ internal_warning (_("%s: ignoring function definition attempt"), from_file); ++ should_jump_to_top_level = 0; ++ last_result = last_command_exit_value = EX_BADUSAGE; ++ reset_parser (); ++ break; ++ } + } + +@@ -302,5 +316,8 @@ + + if (flags & SEVAL_ONECMD) +- break; ++ { ++ reset_parser (); ++ break; ++ } + } + } +--- a/parse.y 2014-09-30 19:43:22.000000000 -0400 ++++ b/parse.y 2014-10-04 15:58:35.000000000 -0400 +@@ -2125,4 +2125,14 @@ + } + ++char * ++parser_remaining_input () ++{ ++ if (shell_input_line == 0) ++ return 0; ++ if (shell_input_line_index < 0 || shell_input_line_index >= shell_input_line_len) ++ return '\0'; /* XXX */ ++ return (shell_input_line + shell_input_line_index); ++} ++ + #ifdef INCLUDE_UNUSED + /* Back the input pointer up by one, effectively `ungetting' a character. */ +--- a/shell.h 2008-04-28 22:00:24.000000000 -0400 ++++ b/shell.h 2014-10-04 15:58:35.000000000 -0400 +@@ -161,4 +161,6 @@ + + /* Let's try declaring these here. */ ++extern char *parser_remaining_input __P((void)); ++ + extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *)); + extern void restore_parser_state __P((sh_parser_state_t *));
meta/recipes-extended/bash/bash-4.2/cve-2014-6278.patch new file +127 -0
127 lines not on this page · raw message
meta/recipes-extended/bash/bash_3.2.48.bb +1 -0
@@ -15,6 +15,7 @@ SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \ file://Fix-for-bash-exported-function-namespace-change.patch \ file://cve-2014-7186_cve-2014-7187.patch \ file://cve-2014-6277.patch \ + file://cve-2014-6278.patch \ " SRC_URI[tarball.md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"
meta/recipes-extended/bash/bash_4.2.bb +1 -0
@@ -26,6 +26,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \ file://Fix-for-bash-exported-function-namespace-change.patch;striplevel=0 \ file://cve-2014-7186_cve-2014-7187.patch;striplevel=0 \ file://cve-2014-6277.patch \ + file://cve-2014-6278.patch;striplevel=0 \ file://run-ptest \ "
Signature · 1 line
1.9.3