tar#Extract() has no check for ../ or absolute paths. zip#Extract()
was patched for this recently, tar#Extract() was not.
Add the same checks: ../ relative traversal, leading slash on Unix,
drive letter and leading slash/backslash on Windows.
https://github.com/vim/vim/pull/19981
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I checked this a few times already and was not able to reproduce:
0 41597 chrisbra@debian-arm64 /tmp/tar_poc/a % tar -pxf 'archive'.tar '../../tmp/vim_tar_poc.txt'
tar: Removing leading `../../' from member names
tar: ../../tmp/vim_tar_poc.txt: Member name contains '..'
tar: Exiting with failure status due to previous errors
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Right, GNU tar 1.35+ blocks .. in member names. But older tar versions and bsdtar (macOS default) do not. Also, symlink entries are not blocked — a tar with a symlink pointing outside cwd followed by a file through it can write to arbitrary paths even on GNU tar 1.35.
Either way, zip#Extract() already has these checks after the recent patches. This just brings tar#Extract() to the same level.
—
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.![]()
Thanks. I added some tests to make sure this does not regress
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()