zip#Write(): the regex from commit 6836599 does not match a single
leading slash (/path). On Windows this resolves to the current
drive root (e.g. C:\path), bypassing the check.
Fix: simplify the regex to '^\%(\a:[\\/]\|[\\/]\)' so any leading
slash or backslash is matched.
zip#Extract(): has no absolute path check at all. Add the same
checks used in zip#Write() for both Unix and Windows.
https://github.com/vim/vim/pull/19976
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra commented on this pull request.
> @@ -505,6 +505,18 @@ fun! zip#Extract()
call s:Mess('Error', "***error*** (zip#Browse) Path Traversal Attack detected, not extracting!")
return
endif
+ " block absolute paths
+ if has("unix")
+ if fname =~ '^/'
+ call s:Mess('Error', "***error*** (zip#Extract) Path Traversal Attack detected, not extracting!")
+ return
+ endif
+ else
+ if fname =~ '^\%(\a:[\\/]\|[\\/]\)'
I guess we could simplify the whole Unix/Linux detection and just use this pattern for all systems.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()