Pick patch per [1]. [1] https://nvd.nist.gov/vuln/detail/CVE-2026-57453 [2] https://github.com/vim/vim/security/advisories/GHSA-x5fg-h5w9-9frf
Signed-off-by: Vijay Anusuri <[email protected]> --- .../vim/files/CVE-2026-57453.patch | 248 ++++++++++++++++++ meta/recipes-support/vim/vim.inc | 1 + 2 files changed, 249 insertions(+) create mode 100644 meta/recipes-support/vim/files/CVE-2026-57453.patch diff --git a/meta/recipes-support/vim/files/CVE-2026-57453.patch b/meta/recipes-support/vim/files/CVE-2026-57453.patch new file mode 100644 index 0000000000..d1ad6d6f54 --- /dev/null +++ b/meta/recipes-support/vim/files/CVE-2026-57453.patch @@ -0,0 +1,248 @@ +From b2cc9be119d51212bf0d3f2a994c7e517c73f4a9 Mon Sep 17 00:00:00 2001 +From: Christian Brabandt <[email protected]> +Date: Sat, 20 Jun 2026 15:35:58 +0000 +Subject: [PATCH] patch 9.2.0678: [security]: potential powershell code + execution in zip.vim + +Problem: [security]: potential powershell code execution in zip.vim + (DDugs) +Solution: Cleanup zip.vim, introduce PSEscape() to escape() potential powershell code, + use consistent s:Escape() in the various PowerShell functions + +Github Security Advisory: +https://github.com/vim/vim/security/advisories/GHSA-x5fg-h5w9-9frf + +Signed-off-by: Christian Brabandt <[email protected]> + +Upstream-Status: Backport [https://github.com/vim/vim/commit/b2cc9be119d51212bf0d3f2a994c7e517c73f4a9] +CVE: CVE-2026-57453 +Signed-off-by: Vijay Anusuri <[email protected]> +--- + runtime/autoload/zip.vim | 78 +++++++++++++++++++--------------------- + runtime/doc/pi_zip.txt | 10 ------ + 2 files changed, 36 insertions(+), 52 deletions(-) + +diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim +index f4482fd7fc..752503a626 100644 +--- a/runtime/autoload/zip.vim ++++ b/runtime/autoload/zip.vim +@@ -22,6 +22,7 @@ + " 2026 Mar 08 by Vim Project: Make ZipUpdatePS() check for powershell + " 2026 Apr 01 by Vim Project: Detect more path traversal attacks + " 2026 Apr 05 by Vim Project: Detect more path traversal attacks ++" 2026 Jun 20 by Vim Project: Fix wrong escaping for the powershell calls + " License: Vim License (see vim's :help license) + " Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 + " Permission is hereby granted to use and distribute this code, +@@ -49,15 +50,6 @@ let s:NOTE = 0 + + " --------------------------------------------------------------------- + " Global Values: {{{1 +-if !exists("g:zip_shq") +- if &shq != "" +- let g:zip_shq= &shq +- elseif has("unix") +- let g:zip_shq= "'" +- else +- let g:zip_shq= '"' +- endif +-endif + if !exists("g:zip_zipcmd") + let g:zip_zipcmd= "zip" + endif +@@ -133,7 +125,7 @@ function! s:ZipBrowsePS(zipfile) + " Browse the contents of a zip file using PowerShell's + " Equivalent `unzip -Z1 -- zipfile` + let cmds = [ +- \ '$zip = [System.IO.Compression.ZipFile]::OpenRead(' . s:Escape(a:zipfile, 1) . ');', ++ \ '$zip = [System.IO.Compression.ZipFile]::OpenRead(' . s:PSEscape(a:zipfile) . ');', + \ '$zip.Entries | ForEach-Object { $_.FullName };', + \ '$zip.Dispose()' + \ ] +@@ -147,16 +139,16 @@ function! s:ZipReadPS(zipfile, fname, tempfile) + call s:Mess('WarningMsg', "***warning*** PowerShell can display, but cannot update, files in archive subfolders") + endif + let cmds = [ +- \ '$zip = [System.IO.Compression.ZipFile]::OpenRead(' . s:Escape(a:zipfile, 1) . ');', +- \ '$fileEntry = $zip.Entries | Where-Object { $_.FullName -eq ' . s:Escape(a:fname, 1) . ' };', ++ \ '$zip = [System.IO.Compression.ZipFile]::OpenRead(' . s:PSEscape(a:zipfile) . ');', ++ \ '$fileEntry = $zip.Entries | Where-Object { $_.FullName -eq ' . s:PSEscape(a:fname) . ' };', + \ '$stream = $fileEntry.Open();', +- \ '$fileStream = [System.IO.File]::Create(' . s:Escape(a:tempfile, 1) . ');', ++ \ '$fileStream = [System.IO.File]::Create(' . s:PSEscape(a:tempfile) . ');', + \ '$stream.CopyTo($fileStream);', + \ '$fileStream.Close();', + \ '$stream.Close();', + \ '$zip.Dispose()' + \ ] +- return 'pwsh -NoProfile -Command ' . s:Escape(join(cmds, ' '), 1) ++ return 'pwsh -NoProfile -Command ' . s:Escape(join(cmds, ' ')) + endfunction + + function! s:ZipUpdatePS(zipfile, fname) +@@ -166,7 +158,7 @@ function! s:ZipUpdatePS(zipfile, fname) + call s:Mess('Error', "***error*** PowerShell cannot update files in archive subfolders") + return ':' + endif +- return 'Compress-Archive -Path ' . a:fname . ' -Update -DestinationPath ' . a:zipfile ++ return 'Compress-Archive -Path ' . s:PSEscape(a:fname) . ' -Update -DestinationPath ' . s:PSEscape(a:zipfile) + endfunction + + function! s:ZipExtractFilePS(zipfile, fname) +@@ -177,16 +169,16 @@ function! s:ZipExtractFilePS(zipfile, fname) + return ':' + endif + let cmds = [ +- \ '$zip = [System.IO.Compression.ZipFile]::OpenRead(' . s:Escape(a:zipfile, 1) . ');', +- \ '$fileEntry = $zip.Entries | Where-Object { $_.FullName -eq ' . a:fname . ' };', ++ \ '$zip = [System.IO.Compression.ZipFile]::OpenRead(' . s:PSEscape(a:zipfile) . ');', ++ \ '$fileEntry = $zip.Entries | Where-Object { $_.FullName -eq ' . s:PSEscape(a:fname) . ' };', + \ '$stream = $fileEntry.Open();', +- \ '$fileStream = [System.IO.File]::Create(' . a:fname . ');', ++ \ '$fileStream = [System.IO.File]::Create(' . s:PSEscape(a:fname) . ');', + \ '$stream.CopyTo($fileStream);', + \ '$fileStream.Close();', + \ '$stream.Close();', + \ '$zip.Dispose()' + \ ] +- return 'pwsh -NoProfile -Command ' . s:Escape(join(cmds, ' '), 1) ++ return 'pwsh -NoProfile -Command ' . s:Escape(join(cmds, ' ')) + endfunction + + function! s:ZipDeleteFilePS(zipfile, fname) +@@ -194,12 +186,12 @@ function! s:ZipDeleteFilePS(zipfile, fname) + " Equivalent to `zip -d zipfile fname` + let cmds = [ + \ 'Add-Type -AssemblyName System.IO.Compression.FileSystem;', +- \ '$zip = [System.IO.Compression.ZipFile]::Open(' . s:Escape(a:zipfile, 1) . ', ''Update'');', +- \ '$entry = $zip.Entries | Where-Object { $_.Name -eq ' . s:Escape(a:fname, 1) . ' };', ++ \ '$zip = [System.IO.Compression.ZipFile]::Open(' . s:PSEscape(a:zipfile) . ', ''Update'');', ++ \ '$entry = $zip.Entries | Where-Object { $_.Name -eq ' . s:PSEscape(a:fname) . ' };', + \ 'if ($entry) { $entry.Delete(); $zip.Dispose() }', + \ 'else { $zip.Dispose() }' + \ ] +- return 'pwsh -NoProfile -Command ' . s:Escape(join(cmds, ' '), 1) ++ return 'pwsh -NoProfile -Command ' . s:Escape(join(cmds, ' ')) + endfunction + + " ---------------- +@@ -339,9 +331,9 @@ fun! zip#Read(fname,mode) + let temp = tempname() + let fn = expand('%:p') + +- let gnu_cmd = g:zip_unzipcmd . ' -p -- ' . s:Escape(zipfile, 0) . ' ' . s:Escape(fname, 0) . ' > ' . s:Escape(temp, 0) +- let gnu_cmd = 'call system(''' . substitute(gnu_cmd, "'", "''", 'g') . ''')' +- let ps_cmd = 'sil !' . s:ZipReadPS(zipfile, fname, temp) ++ let gnu_cmd = g:zip_unzipcmd . ' -p -- ' . s:Escape(zipfile) . ' ' . s:Escape(fname) . ' > ' . s:Escape(temp) ++ let gnu_cmd = 'call system(' . string(gnu_cmd) . ')' ++ let ps_cmd = $"call system({string(s:ZipDeleteFilePS(zipfile, fname))})" + call s:TryExecGnuFallBackToPs(g:zip_unzipcmd, gnu_cmd, ps_cmd) + + sil exe 'keepalt file '.temp +@@ -408,9 +400,9 @@ fun! zip#Write(fname) + " TODO: what to check on MS-Windows to avoid writing absolute paths? + endif + if fname =~ '^[.]\{1,2}/' +- let gnu_cmd = g:zip_zipcmd . ' -d ' . s:Escape(fnamemodify(zipfile,":p"),0) . ' ' . s:Escape(fname,0) +- let gnu_cmd = 'call system(''' . substitute(gnu_cmd, "'", "''", 'g') . ''')' +- let ps_cmd = $"call system({s:Escape(s:ZipDeleteFilePS(zipfile, fname), 1)})" ++ let gnu_cmd = g:zip_zipcmd . ' -d ' . s:Escape(fnamemodify(zipfile,":p")) . ' ' . s:Escape(fname) ++ let gnu_cmd = 'call system(' . string(gnu_cmd) . ')' ++ let ps_cmd = $"call system({string(s:ZipDeleteFilePS(zipfile, fname))})" + call s:TryExecGnuFallBackToPs(g:zip_zipcmd, gnu_cmd, ps_cmd) + let fname = fname->substitute('^\([.]\{1,2}/\)\+', '', 'g') + let need_rename = 1 +@@ -419,7 +411,7 @@ fun! zip#Write(fname) + if fname =~ '/' + let dirpath = substitute(fname,'/[^/]\+$','','e') + if has("win32unix") && executable("cygpath") +- let dirpath = substitute(system("cygpath ".s:Escape(dirpath,0)),'\n','','e') ++ let dirpath = substitute(system("cygpath ".s:Escape(dirpath)),'\n','','e') + endif + call mkdir(dirpath,"p") + endif +@@ -430,16 +422,17 @@ fun! zip#Write(fname) + " don't overwrite files forcefully + exe "w ".fnameescape(fname) + if has("win32unix") && executable("cygpath") +- let zipfile = substitute(system("cygpath ".s:Escape(zipfile,0)),'\n','','e') ++ let zipfile = substitute(system("cygpath ".s:Escape(zipfile)),'\n','','e') + endif + + if (has("win32") || has("win95") || has("win64") || has("win16")) && &shell !~? 'sh$' + let fname = substitute(fname, '[', '[[]', 'g') + endif + +- let gnu_cmd = g:zip_zipcmd . ' -u '. s:Escape(fnamemodify(zipfile,":p"),0) . ' ' . s:Escape(fname,0) ++ let gnu_cmd = g:zip_zipcmd . ' -u '. s:Escape(fnamemodify(zipfile,":p")) . ' ' . s:Escape(fname) + let gnu_cmd = 'call system(''' . substitute(gnu_cmd, "'", "''", 'g') . ''')' +- let ps_cmd = s:ZipUpdatePS(s:Escape(fnamemodify(zipfile, ':p'), 0), s:Escape(fname, 0)) ++ let zip = fnamemodify(zipfile, ':p') ++ let ps_cmd = s:ZipUpdatePS(zip, fname) + let ps_cmd = 'call system(''' . substitute(ps_cmd, "'", "''", 'g') . ''')' + call s:TryExecGnuFallBackToPs(g:zip_zipcmd, gnu_cmd, ps_cmd) + if &shell =~ 'pwsh' +@@ -522,8 +515,8 @@ fun! zip#Extract() + + " extract the file mentioned under the cursor + let gnu_cmd = g:zip_extractcmd . ' -o '. shellescape(b:zipfile) . ' ' . target +- let gnu_cmd = 'call system(''' . substitute(gnu_cmd, "'", "''", 'g') . ''')' +- let ps_cmd = $"call system({s:Escape(s:ZipExtractFilePS(b:zipfile, target), 1)})" ++ let gnu_cmd = 'call system(' . string(gnu_cmd) . ')' ++ let ps_cmd = 'call system(' . string(s:ZipExtractFilePS(b:zipfile, fname)) . ')' + call s:TryExecGnuFallBackToPs(g:zip_extractcmd, gnu_cmd, ps_cmd) + + if v:shell_error != 0 +@@ -537,19 +530,20 @@ endfun + + " --------------------------------------------------------------------- + " s:Escape: {{{2 +-fun! s:Escape(fname,isfilt) +- if exists("*shellescape") +- if a:isfilt +- let qnameq= shellescape(a:fname,1) +- else +- let qnameq= shellescape(a:fname) +- endif ++fun! s:Escape(fname, isfilt = 0) ++ if a:isfilt ++ let qnameq = shellescape(a:fname, 1) + else +- let qnameq= g:zip_shq.escape(a:fname,g:zip_shq).g:zip_shq ++ let qnameq = shellescape(a:fname) + endif + return qnameq + endfun + ++" s:PSEscape: Escape a string for Powershell, shellescape() does not work here {{{2 ++fun! s:PSEscape(str) ++ return "'" .. substitute(a:str, "'", "''", 'g') .. "'" ++endfun ++ + " --------------------------------------------------------------------- + " s:ChgDir: {{{2 + fun! s:ChgDir(newdir,errlvl,errmsg) +diff --git a/runtime/doc/pi_zip.txt b/runtime/doc/pi_zip.txt +index e9294b4059..b1800dfcc5 100644 +--- a/runtime/doc/pi_zip.txt ++++ b/runtime/doc/pi_zip.txt +@@ -48,16 +48,6 @@ Copyright: Copyright (C) 2005-2015 Charles E Campbell *zip-copyright* + If this variable exists and is true, the file window will not be + automatically maximized when opened. + +- *g:zip_shq* +- Different operating systems may use one or more shells to execute +- commands. Zip will try to guess the correct quoting mechanism to +- allow spaces and whatnot in filenames; however, if it is incorrectly +- guessing the quote to use for your setup, you may use > +- g:zip_shq +-< which by default is a single quote under Unix (') and a double quote +- under Windows ("). If you'd rather have no quotes, simply set +- g:zip_shq to the empty string (let g:zip_shq= "") in your <.vimrc>. +- + *g:zip_unzipcmd* + Use this option to specify the program which does the duty of "unzip". + It's used during browsing. By default: > +-- +2.43.0 + diff --git a/meta/recipes-support/vim/vim.inc b/meta/recipes-support/vim/vim.inc index b9f6ef987c..ecdf7cb5b9 100644 --- a/meta/recipes-support/vim/vim.inc +++ b/meta/recipes-support/vim/vim.inc @@ -25,6 +25,7 @@ SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https;tag=v${PV} file://CVE-2026-52860.patch \ file://CVE-2026-55693.patch \ file://CVE-2026-55895.patch \ + file://CVE-2026-57453.patch \ " PV .= ".0340" -- 2.43.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#241671): https://lists.openembedded.org/g/openembedded-core/message/241671 Mute This Topic: https://lists.openembedded.org/mt/120392654/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
