patch 9.1.1551: [security]: path traversal issue in zip.vim

Problem:  [security]: path traversal issue in zip.vim (@ax)
Solution: drop leading ../ on write of zipfiles, don't forcefully
          overwrite existing files

A zip plugin which contains filenames with leading '../'  may cause
confusion as to where the content will be extracted.  Let's drop such
things and make sure we use a relative filename instead and don't
forcefully overwrite temporary files. Also, warn the user of such
things.

related: #17733

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2025-07-15 21:43:01 +02:00
parent 3f9d2378bd
commit 586294a041
7 changed files with 185 additions and 144 deletions

View File

@ -1,4 +1,4 @@
*pi_zip.txt* For Vim version 9.1. Last change: 2025 Apr 02
*pi_zip.txt* For Vim version 9.1. Last change: 2025 Jul 15
+====================+
| Zip File Interface |
@ -111,6 +111,18 @@ Copyright: Copyright (C) 2005-2015 Charles E Campbell *zip-copyright*
==============================================================================
4. History *zip-history* {{{1
unreleased:
Jul 12, 2025 * drop ../ on write to prevent path traversal attacks
Mar 11, 2025 * handle filenames with leading '-' correctly
Aug 21, 2024 * simplify condition to detect MS-Windows
Aug 18, 2024 * correctly handle special globbing chars
Aug 05, 2024 * clean-up and make it work with shellslash on Windows
Aug 05, 2024 * workaround for the FreeBSD's unzip
Aug 04, 2024 * escape '[' in name of file to be extracted
Jul 30, 2024 * fix opening remote zipfile
Jul 24, 2024 * use delete() function
Jul 23, 2024 * fix 'x' command
Jun 16, 2024 * handle whitespace on Windows properly (#14998)
v33 Dec 07, 2021 * *.xlam mentioned twice in zipPlugin
v32 Oct 22, 2021 * to avoid an issue with a vim 8.2 patch, zipfile: has
been changed to zipfile:// . This often shows up