]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0202: [security]: command injection via newline in glob() v9.2.0202
authorpyllyukko <pyllyukko@maimed.org>
Thu, 19 Mar 2026 19:58:05 +0000 (19:58 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 19 Mar 2026 20:07:51 +0000 (20:07 +0000)
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>
src/os_unix.c
src/version.c

index 03f7649090c965d8edfcc610c0f00f67ef64a3a5..91bfd63d0dcb2cb96fbba772850b993fd5f80d78 100644 (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(
index f4d0d87aee7262449e9f9528076f29f7fe0a12bb..79de52f6aa54bc4b92edc5d423852d7f8015a4d3 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    202,
 /**/
     201,
 /**/