-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(deps): update dependency tar [security] #1875
Open
renovate
wants to merge
1
commit into
master
Choose a base branch
from
renovate/npm-tar-vulnerability
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
July 19, 2022 19:59
caecd33
to
cb4f047
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
July 19, 2022 22:12
cb4f047
to
ce9c574
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
July 21, 2022 02:21
ce9c574
to
6d38dee
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
July 21, 2022 07:24
6d38dee
to
ee0d6f5
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
July 21, 2022 14:56
ee0d6f5
to
8f724ab
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 2, 2022 08:09
8f724ab
to
8a3047d
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 3, 2022 01:09
8a3047d
to
86d03a7
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 3, 2022 05:23
86d03a7
to
f8d513c
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 4, 2022 03:09
f8d513c
to
fc08a55
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 4, 2022 11:04
fc08a55
to
6e4862e
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 9, 2022 02:50
6e4862e
to
f5ee161
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 10, 2022 00:19
f5ee161
to
13609c0
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 10, 2022 14:28
13609c0
to
9ea8b71
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
August 10, 2022 23:08
9ea8b71
to
8712c5a
Compare
Links:
|
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 14, 2022 23:09
6ffd36e
to
1c3b74a
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 15, 2022 23:10
1c3b74a
to
54ed4f3
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 17, 2022 23:05
54ed4f3
to
bc7bced
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 18, 2022 07:50
bc7bced
to
1299d72
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 19, 2022 06:14
1299d72
to
9df6de2
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 21, 2022 08:30
9df6de2
to
2d9b566
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 24, 2022 20:56
2d9b566
to
83695c3
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 26, 2022 01:25
83695c3
to
3b7c57b
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 27, 2022 15:51
3b7c57b
to
bd1a426
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
October 30, 2022 03:06
bd1a426
to
bceabb9
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
November 1, 2022 07:06
bceabb9
to
1224a12
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
November 4, 2022 06:42
1224a12
to
d7b9c36
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
November 7, 2022 07:35
d7b9c36
to
f161df6
Compare
Links:
|
renovate
bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
November 20, 2022 11:16
f161df6
to
e6ae065
Compare
Links:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
2.2.2
->4.4.18
4.4.13
->4.4.15
GitHub Vulnerability Alerts
CVE-2021-37701
Impact
Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution
node-tar
aims to guarantee that any file whose location would be modified by a symbolic link is not extracted. This is, in part, achieved by ensuring that extracted directories are not symlinks. Additionally, in order to prevent unnecessary stat calls to determine whether a given path is a directory, paths are cached when directories are created.This logic was insufficient when extracting tar files that contained both a directory and a symlink with the same name as the directory, where the symlink and directory names in the archive entry used backslashes as a path separator on posix systems. The cache checking logic used both
\
and/
characters as path separators, however\
is a valid filename character on posix systems.By first creating a directory, and then replacing that directory with a symlink, it was thus possible to bypass node-tar symlink checks on directories, essentially allowing an untrusted tar file to symlink into an arbitrary location and subsequently extracting arbitrary files into that location, thus allowing arbitrary file creation and overwrite.
Additionally, a similar confusion could arise on case-insensitive filesystems. If a tar archive contained a directory at
FOO
, followed by a symbolic link namedfoo
, then on case-insensitive file systems, the creation of the symbolic link would remove the directory from the filesystem, but not from the internal directory cache, as it would not be treated as a cache hit. A subsequent file entry within theFOO
directory would then be placed in the target of the symbolic link, thinking that the directory had already been created.These issues were addressed in releases 4.4.16, 5.0.8 and 6.1.7.
The v3 branch of
node-tar
has been deprecated and did not receive patches for these issues. If you are still using a v3 release we recommend you update to a more recent version ofnode-tar
. If this is not possible, a workaround is available below.Patches
4.4.16 || 5.0.8 || 6.1.7
Workarounds
Users may work around this vulnerability without upgrading by creating a custom filter method which prevents the extraction of symbolic links.
Users are encouraged to upgrade to the latest patched versions, rather than attempt to sanitize tar input themselves.
Fix
The problem is addressed in the following ways:
/
as a path separator, replacing\
with/
on Windows systems, and leaving\
intact in the path on posix systems. This is performed in depth, at every level of the program where paths are consumed.Caveat
Note that this means that the
entry
objects exposed in various parts of tar's API will now always use/
as a path separator, even on Windows systems. This is not expected to cause problems, as/
is a valid path separator on Windows systems, but may result in issues ifentry.path
is compared against a path string coming from some other API such asfs.realpath()
orpath.resolve()
.Users are encouraged to always normalize paths using a well-tested method such as
path.resolve()
before comparing paths to one another.CVE-2021-37712
Impact
Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution
node-tar aims to guarantee that any file whose location would be modified by a symbolic link is not extracted. This is, in part, achieved by ensuring that extracted directories are not symlinks. Additionally, in order to prevent unnecessary stat calls to determine whether a given path is a directory, paths are cached when directories are created.
This logic was insufficient when extracting tar files that contained two directories and a symlink with names containing unicode values that normalized to the same value. Additionally, on Windows systems, long path portions would resolve to the same file system entities as their 8.3 "short path" counterparts. A specially crafted tar archive could thus include directories with two forms of the path that resolve to the same file system entity, followed by a symbolic link with a name in the first form, lastly followed by a file using the second form. It led to bypassing node-tar symlink checks on directories, essentially allowing an untrusted tar file to symlink into an arbitrary location and subsequently extracting arbitrary files into that location, thus allowing arbitrary file creation and overwrite.
The v3 branch of
node-tar
has been deprecated and did not receive patches for these issues. If you are still using a v3 release we recommend you update to a more recent version ofnode-tar
. If this is not possible, a workaround is available below.Patches
6.1.9 || 5.0.10 || 4.4.18
Workarounds
Users may work around this vulnerability without upgrading by creating a custom filter method which prevents the extraction of symbolic links.
Users are encouraged to upgrade to the latest patched versions, rather than attempt to sanitize tar input themselves.
Fix
The problem is addressed in the following ways, when comparing paths in the directory cache and path reservation systems:
String.normalize('NFKD')
method is used to first normalize all unicode to its maximally compatible and multi-code-point form./
on Windows systems (on posix systems,\
is a valid filename character, and thus left intact).CVE-2021-37713
Impact
Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution
node-tar aims to guarantee that any file whose location would be outside of the extraction target directory is not extracted. This is, in part, accomplished by sanitizing absolute paths of entries within the archive, skipping archive entries that contain
..
path portions, and resolving the sanitized paths against the extraction target directory.This logic was insufficient on Windows systems when extracting tar files that contained a path that was not an absolute path, but specified a drive letter different from the extraction target, such as
C:some\path
. If the drive letter does not match the extraction target, for exampleD:\extraction\dir
, then the result ofpath.resolve(extractionDirectory, entryPath)
would resolve against the current working directory on theC:
drive, rather than the extraction target directory.Additionally, a
..
portion of the path could occur immediately after the drive letter, such asC:../foo
, and was not properly sanitized by the logic that checked for..
within the normalized and split portions of the path.This only affects users of
node-tar
on Windows systems.Patches
4.4.18 || 5.0.10 || 6.1.9
Workarounds
There is no reasonable way to work around this issue without performing the same path normalization procedures that node-tar now does.
Users are encouraged to upgrade to the latest patched versions of node-tar, rather than attempt to sanitize paths themselves.
Fix
The fixed versions strip path roots from all paths prior to being resolved against the extraction target folder, even if such paths are not "absolute".
Additionally, a path starting with a drive letter and then two dots, like
c:../
, would bypass the check for..
path portions. This is checked properly in the patched versions.Finally, a defense in depth check is added, such that if the
entry.absolute
is outside of the extraction taret, and we are not in preservePaths:true mode, a warning is raised on that entry, and it is skipped. Currently, it is believed that this check is redundant, but it did catch some oversights in development.CVE-2021-32803
Impact
Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution
node-tar
aims to guarantee that any file whose location would be modified by a symbolic link is not extracted. This is, in part, achieved by ensuring that extracted directories are not symlinks. Additionally, in order to prevent unnecessarystat
calls to determine whether a given path is a directory, paths are cached when directories are created.This logic was insufficient when extracting tar files that contained both a directory and a symlink with the same name as the directory. This order of operations resulted in the directory being created and added to the
node-tar
directory cache. When a directory is present in the directory cache, subsequent calls to mkdir for that directory are skipped. However, this is also wherenode-tar
checks for symlinks occur.By first creating a directory, and then replacing that directory with a symlink, it was thus possible to bypass
node-tar
symlink checks on directories, essentially allowing an untrusted tar file to symlink into an arbitrary location and subsequently extracting arbitrary files into that location, thus allowing arbitrary file creation and overwrite.This issue was addressed in releases 3.2.3, 4.4.15, 5.0.7 and 6.1.2.
Patches
3.2.3 || 4.4.15 || 5.0.7 || 6.1.2
Workarounds
Users may work around this vulnerability without upgrading by creating a custom
filter
method which prevents the extraction of symbolic links.Users are encouraged to upgrade to the latest patch versions, rather than attempt to sanitize tar input themselves.
CVE-2021-32804
Impact
Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution
node-tar
aims to prevent extraction of absolute file paths by turning absolute paths into relative paths when thepreservePaths
flag is not set totrue
. This is achieved by stripping the absolute path root from any absolute file paths contained in a tar file. For example/home/user/.bashrc
would turn intohome/user/.bashrc
.This logic was insufficient when file paths contained repeated path roots such as
////home/user/.bashrc
.node-tar
would only strip a single path root from such paths. When given an absolute file path with repeating path roots, the resulting path (e.g.///home/user/.bashrc
) would still resolve to an absolute path, thus allowing arbitrary file creation and overwrite.Patches
3.2.2 || 4.4.14 || 5.0.6 || 6.1.1
NOTE: an adjacent issue CVE-2021-32803 affects this release level. Please ensure you update to the latest patch levels that address CVE-2021-32803 as well if this adjacent issue affects your
node-tar
use case.Workarounds
Users may work around this vulnerability without upgrading by creating a custom
onentry
method which sanitizes theentry.path
or afilter
method which removes entries with absolute paths.Users are encouraged to upgrade to the latest patch versions, rather than attempt to sanitize tar input themselves.
Configuration
📅 Schedule: Branch creation - "" in timezone America/Vancouver, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR has been generated by Mend Renovate. View repository job log here.