patch 9.2.0202: [security]: command injection via newline in glob()

Problem:  The glob() function on Unix-like systems does not escape
          newline characters when expanding wildcards. A maliciously
          crafted string containing '\n' can be used as a command
          separator to execute arbitrary shell commands via
          mch_expand_wildcards(). This depends on the user's 'shell'
          setting.
Solution: Add the newline character ('\n') to the SHELL_SPECIAL
          definition to ensure it is properly escaped before being
          passed to the shell (pyllyukko).

closes: #19746

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-w5jw-f54h-x46c

Signed-off-by: pyllyukko <pyllyukko@maimed.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
pyllyukko
2026-03-19 19:58:05 +00:00
committed by Christian Brabandt
parent cc8798e719
commit 645ed6597d
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -7075,7 +7075,7 @@ mch_expandpath(
# define SEEK_END 2
# endif
# define SHELL_SPECIAL (char_u *)"\t \"&'$;<>()\\|"
# define SHELL_SPECIAL (char_u *)"\t \"&'$;<>()\\|\n"
int
mch_expand_wildcards(
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
202,
/**/
201,
/**/