Repository navigation
Update dependency tar to v8 [SECURITY] - #1419
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/npm-tar-vulnerability
branch
from
December 2, 2026 17:46
65b073c to
418dbf7
Compare
This file contains hidden or 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
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:
^7.5.22→^8.0.0Test plan: CI should pass with updated dependencies. No review required: this is an automated dependency update PR.
node-tar UnpackSync never completes sync-stream extraction after any failing entry (PEND/UNPEND imbalance)
CVE-2026-140252 / GHSA-25mm-r35j-6hgm
More information
Details
Summary
When node-tar's synchronous stream extraction (
tar.x({ sync: true })without thefileoption, or a directly-constructedUnpackSyncstream) processes any archive entry that fails, the stream never emitsend,finish, orclose. A single failing entry, for example a hardlink whose target does not exist (one 512-byte entry), emits aTAR_ENTRY_ERRORwarning and then hangs the stream. Consumers that await stream completion hang indefinitely on hostile or merely damaged input, with no error to catch because the warning is non-fatal by design.Details
Unpack(async) brackets each entry's filesystem work with[PEND]()/[UNPEND]()to hold the stream open until every entry settles;[MAYBECLOSE]emits completion only whenPENDING === 0:UnpackSync[CHECKFS](src/unpack.ts:901) performs the same work but never calls[PEND](), yetUnpackSyncdoes not override[ONERROR], so it inherits the async handler that unconditionally calls[UNPEND]()on any non-CwdErrorentry failure. A single failing entry therefore drivesPENDINGto-1. Because[MAYBECLOSE]requires exactly0, the negative counter permanently suppressesend/finish/close. (A separate fall-through in the same method, a missingreturnafter thermdirbranch at src/unpack.ts:953-954, double-invokesMAKEFSon a directory-replacement entry, producing two warnings andPENDING = -2.)PoC
Validated on source main @ 2a22bfc and against the published npm package
tar@7.5.22, Node v24.19.0.Observed:
Controls in the same harness: the identical archive through the async file API (
x({ cwd, file })) resolves with a singleTAR_ENTRY_ERROR; an all-success archive through the sync-stream API ends normally and extracts its file. Disk state is fail-closed (the failing entry is simply not created).Impact
Availability denial of service (permanent stream hang after a warning). No confidentiality or integrity effect and no incorrect data is written. The affected surface is narrow: only consumers that pipe into
new UnpackSync()or the stream returned byx({ sync: true })(withoutfile) and awaitend/finish/close. The default asynchronous API and the common file-based synchronous API (x({ sync: true, file }), which returns void) are unaffected. A single 512-byte crafted or damaged entry is enough to wedge an affected consumer.Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
node-tar async extraction deadlocks permanently when an entry's linkpath is a hierarchical relative of its own path
CVE-2026-140251 / GHSA-98v3-7xjr-fg83
More information
Details
Summary
An unauthenticated remote-input denial of service allows a crafted tar archive of about 1.5 KB to permanently and silently hang node-tar's default asynchronous extraction. When a
LinkorSymbolicLinkentry has alinkpaththat is an ancestor (or descendant) directory of the entry's ownpath, the internal path-reservation queue enters an unsatisfiable state. The promise returned bytar.x()/tar.extract()never resolves or rejects, the stream never emitsend/finish/close, and no warning is raised. Every entry after the poison entry is silently skipped.Details
Async
Unpackserialises filesystem work throughPathReservations(src/path-reservations.ts).reserve([entry.path, entry.linkpath], fn)registers each reserved path as a plain function at that path's queue key, and every ancestor directory of each path as aSet<Handler>at that directory's queue key.check(fn)(src/path-reservations.ts:114-120) only schedulesfnwhen it is the head function of every path queue AND the head of every directory queue is aSetthat containsfn:When one of the two reserved strings is an ancestor directory of the other, the same queue key is written twice: once as a function head (the path reservation, src/path-reservations.ts:65-72) and once as a directory
Set(the dir reservation, src/path-reservations.ts:73-85). For a hardlinka/bwhose linkpath isa, keyafirst receives[fn](function head), then the dir loop appends aSetbehind it, giving[fn, Set([fn])].check()then requiresq[0] instanceof Setat keya, butq[0]is the functionfn, socheck()is permanently false.#run(fn)never fires,[CHECKFS2]never executes, the[PENDING]counter never drains, and[MAYBECLOSE]never completes the stream.The collision can be introduced by three independent, attacker-controlled routes, all validated:
Link/SymbolicLinkheader whoselinkpathis a hierarchical relative of itspath.linkpathrecord attached to a plainFileentry (the "linkpath forbidden" check runs on the raw header before PAX fields are applied, so a File can carry a linkpath). See advisory 03.K/NextFileHasLongLinkpath) entry assigning a hierarchical linkpath to the following link entry.Synchronous extraction bypasses reservations and is unaffected. Windows is unaffected because reservations are globally serialised there under a single key (
'win32 parallelization disabled', src/path-reservations.ts:53-55).PoC
Validated on
president-xd/node-tarmain @ 2a22bfc (version 7.5.22) and against the published npm packagetar@7.5.22, on Linux, Node v24.19.0.Observed output:
Control archive with
linkpath: 'c'(a sibling, not a hierarchical relative) resolves in the same harness with a singleTAR_ENTRY_ERRORwarning. The PAX-linkpath route (14 linkpath=a\nbefore aFileata/b) and the GNUKroute both hang identically; their sibling controls both resolve.Impact
Availability-only denial of service (no confidentiality or integrity effect, no extraction outside the target directory). Any pipeline that uses node-tar's default asynchronous extraction on POSIX and awaits completion can be wedged forever by a small crafted archive: npm and CI package installation, artifact processing, bundlers, and any service that extracts third-party tarballs. Impact is a permanent silent hang, with all subsequent entries in the archive never extracted. Unauthenticated, remote, no user interaction.
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
node-tar: Nested symlink target can escape node-tar extraction root
CVE-2026-140248 / GHSA-6wwr-g865-f46r
More information
Details
Summary
With default
preservePaths: false,tar7.5.22 can extract a symbolic link whose effective target is outside the extraction directory. A crafted archive first creates one in-root symlink and then a second symlink whose target contains that symlink followed by... The containment check simplifies the target lexically before checking filesystem symlinks, but the stored target is resolved by the OS through the first symlink. A later consumer following the extracted link can access a file outside the intended root.This was reproduced locally on commit
2a22bfc5d3a432a606d9da0e2d87ba634aa3b1cb(package version 7.5.22). Earlier versions were not assessed. The PoC only reads a marker that it creates in its own temporary directory. No preexisting file is touched.Root cause
STRIPABSOLUTEPATHaccepts a symlinklinkpathcontaining..ifpath.posix.normalize(path.posix.join(entryDir, linkpath))appears to stay inside the extraction root (src/unpack.ts:263-302). Later,SYMLINKderivespartsusingpath.resolve(dirname(entry.absolute), entry.linkpath)(src/unpack.ts:640-659), which also removesb/..beforeENSURE_NO_SYMLINKinspects each component (src/unpack.ts:679-698).LINKthen writes the original unsimplifiedentry.linkpathwithfs.symlink(src/unpack.ts:866-880).For
a/b -> ../xanda/c -> b/../.., the lexical check reduces the second target to the extraction root and never checksa/b. Actual filesystem traversal followsa/btoxfirst and then processes two parent components, ending in the extraction root's parent.Safe local PoC
Run from a built checkout of 7.5.22:
The marker is outside
out; the access passes through a symlink extracted underout. This demonstrates the target containment bypass. It does not claim that node-tar itself writes outsideoutwhile extracting a subsequent member; its existing path checks may stop such an entry.Impact and suggested fix
An attacker needs to supply a tar archive to an application that extracts links and later follows or serves files from the extracted tree. The resulting link crosses the documented default target confinement. The downstream read/write impact depends on that consumer.
Validate link targets using filesystem semantics before accepting them, or conservatively reject a target that traverses
..after a symlink component. In particular, inspect the unsimplified components beforepath.resolve()removes them. Add a regression case with a symlink component followed by.., and assert that the second link is rejected under default options.Credit goes to GitHub user
@mikkel32as finder/reporter in the published advisory.Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
node-tar crashes the process with an uncaught exception on a 4-byte zstd magic header when the Node runtime lacks native zstd
CVE-2026-140241 / GHSA-72fp-85cc-g945
More information
Details
Summary
An unauthenticated remote-input denial of service allows a four-byte file to crash any process that lists or extracts it with node-tar's asynchronous file API, on any Node runtime without native zlib zstd support (Node 18.x, 20.x, 21.x, 22.0-22.14, 23.0-23.7, all of which satisfy the package's declared
engines: node >= 18). node-tar's default-enabled compression sniffing detects the zstd magic (28 b5 2f fd) and constructsnew ZstdDecompress({})with no error handling. On a runtime without the zstd binding, minizlib's constructor throws aTypeErrorsynchronously inside the file-read stream's data callback, so the asynctar.t()/tar.x()promise never settles and the exception is uncaught, killing the process.Details
Parser.write()sniffs the first bytes of every input and, on the zstd magic, constructs the decompressor unguarded:minizlib'sZlibBaseconstructor throwsTypeError: Compression method not supported: ZstdDecompresswhennode:zliblacks the binding. Because this construction runs inside the file-read stream'sdatahandler (ReadStream.emit->Unpack.write->new ZstdDecompress), the throw is not routed through the stream'serrorevent orParser.abort(). For the async file form (tar.x({file})/tar.t({file})), the throw escapes as an uncaught exception: the process dies, and a consumer'stry/catchor.catch()cannot reach it because the returned promise never settles.zlib.ZstdDecompresswas added in Node v23.8.0 and backported to v22.15.0; on those and later runtimes the class exists and the same 4-byte input is handled through the normal catchable error path instead.PoC
Validated on the published npm package
tar@7.5.22(and source main @ 2a22bfc). Vulnerable runtime: Node v20.20.2 (node -e "console.log(typeof require('zlib').ZstdDecompress)"printsundefined). Non-vulnerable control: Node v24.19.0.Observed on Node v20.20.2 (zstd undefined):
Without the
uncaughtExceptionhandler the process dies with the raw stack (frame:at new ZstdDecompress ... at Unpack.write ... at FSReqCallback.wrapper [as oncomplete] (node:fs)). On Node v24.19.0 the same file produces a clean catchable rejection (TAR_ABORT/zlib: Dictionary mismatch) and no crash. Synchronous mode and direct stream writes throw catchably from the caller's stack on all runtimes; only the async file API turns the throw into process death.Impact
Availability-only denial of service via process crash. Four attacker-controlled bytes, with no tar structure, kill any pipeline on an affected Node runtime that lists or extracts an attacker-supplied archive through node-tar's async file API, including npm-style package installation and CI artifact processing. The impact is conditional on the Node version: it is present on Node 18.x, 20.x, 21.x, 22.0-22.14, and 23.0-23.7 (Node 20 is an Active LTS line in wide production use) and inert on Node 22.15+ / 23.8+ / 24+. Unauthenticated, remote, no user interaction.
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
isaacs/node-tar (tar)
v8.0.0Compare Source
A new API. See "Migration from version 7" in the README.
Breaking changes
create()with nofilereturns a webReadableStream.list()andextract()read theinputoption, or afile.syncoption. UsecreateSync,extractSync,listSync,replaceSync, andupdateSync.onReadEntrytoonEntry, which is awaited.onReadEntryandonentryare aliases of it.C,f,z,P,U,k,m,p,L,h,strip-components,keep-newer,keep-existing,no-mtime, their camelCase forms, andnoChmod) work in the commands only.entries(),Pack,Unpack, andParsertake only the names of the options.noResume,ondone,dirCache,linkCache,readdirCache, andstatCache.ReadEntryandWriteEntryare not streams. AReadEntryhas the shape of aResponse:body,bytes(),arrayBuffer(),text(), andblob(). AWriteEntryis metadata and abody.Parser,Pack, andUnpackare not streams.Parseris a state machine withpush()andnext().Packis an async iterator of chunks.Unpackhas anextract(input)method.WriteEntrySyncandWriteEntryTar.Uint8Array, notBuffer.Header#blockand the result ofPax#encode()are aUint8Array.transformreturns aTransformStream, or an object with areadableand awritableweb stream. InextractSync(), it returns a function that changes a chunk. For a Node.jsTransformstream, returncodecStream(stream).update()adds a file only if it is newer than the entry of the same path. It does not add a file that has the same time as the entry, or a time that differs only by a part of a second.jobsormaxReadSizeoption that is not 0, a positive integer, orInfinityis aTypeError. 0 gives the default.uidorgidoption ofextract()that is not an unsigned 32-bit integer is aTypeError. Before, it was ignored, and the owner in the archive was used.create()gives aTAR_ENTRY_UNSUPPORTEDwarning for a path that is not a file, a directory, or a symbolic link, such as a socket, a FIFO, or a device. Before, it skipped the path with no warning. Withstrict, it is an error.extract()withstripskips an entry that has no part of its path left, as GNU tar and bsdtar do. Before, a directory entry such aspackage/withstrip: 1set its mode, owner, and times on the extraction directory.create(),replace(), andupdate(), a path that does not exist is aTAR_ENTRY_ERRORwarning, as it is for bsdtar. The other paths are added. Before, it was an error that stopped the command. Setstrictto get the error.extract()andlist()give aTAR_ENTRY_ERRORwarning for each path infilesthat no entry of the archive matches. Withstrict, it is an error after the archive is read.brotliandzstdoptions are only forcreate().tar/create,tar/extract,tar/parse, and the others). The exports aretar,tar/core,tar/raw, andtar/core/raw.minipass,minizlib,@isaacs/fs-minipass,chownr, andyallist.New features
delete()anddeleteSync()remove entries from an archive file: the paths in a list, the entries that afilteraccepts, or both. The archive keeps its compression.tar/coreentry point, the runtime-neutral core. It runs in a browser, a worker, or another runtime with web streams. It uses nonode:module, and it needs thefsandcwdoptions for work on files. It has no sync commands.taris the entry point for server-side runtimes: Node.js, and each other runtime that has thenode:modules. It has all of the core, the sync commands, and the defaults (node:fs,node:zlib, the working directory, the platform, and the user of the process).tar/rawandtar/core/raware the same two entry points as separate modules that are not minified.fsoption. All file system work goes through it, so a caller can give another file system.inputoption, andentries()andentriesSync(), which read aUint8Array, anArrayBuffer, aBlob, aReadableStream, or an iterable of chunks.create(),replace(), andupdate()takesWriteEntryobjects,ReadEntryobjects, and iterables of entries.Codectype and thecodecsoption, to add a compression format.tarhas gzip, brotli, and zstd fromnode:zlib.tar/corehas gzip.create()writes the names of a directory in sorted order, so the archive is the same on each runtime and file system.list()andextract()with afiledo not read the body of an entry that nothing reads. A listing of an archive of large files reads only the headers.compressoption ofcreate(). It takes aCodec, or[codec, options], and writes the archive with that codec.platform,processUid,processGid,processUname, andprocessUmaskgive the facts of the process totar/core.tar/core, thecwdofcreate()and ofextract()must be an absolute path. A path that is not absolute is aTypeError. Thetarentry point makes a relativecwdabsolute first.create()reads files, only on demand.jobsoption).replace()andupdate()read PAX and GNU long name headers when they find the place to append, and refuse an archive in any known compressed format.CwdErrorandSymlinkError.create()reads thedevandinoof a file with more than one link asbigintvalues when the numbers are not safe integers. On Windows, two files can have the sameinonumber. Before, the second file was then written as a hard link to the first, and its content was lost. Withfollow, a directory gets the same exact values for the check that it is not in itself.create()for a file that has fewer or more bytes than itslstatsize names the path and the size in its message.extract()works with acwdthat is a root of the file system, such as/orc:\.Security fixes
..after a named part, an entry path that ends in/., and a backslash in a directory name. (GHSA-3wwj-8j6r-q339, GHSA-mhqm-9wj8-w7r4, GHSA-6wwr-g865-f46r, GHSA-276f-qhr9-5cp8, GHSA-4pf9-5fpx-xmr6, GHSA-gvrf-jx37-rjv5, GHSA-7p36-m9mf-cxv7, GHSA-jmj2-9c5q-vw73, GHSA-wq85-w9p7-pgrm, GHSA-hqgx-p3r3-2cfg)chmod: true. (GHSA-3482-qrvx-gvgq, GHSA-m6rr-3gqh-4f88)maxDepthapplies to link targets, a path or link target of more than 32768 characters is refused, a link whose target is a parent or child of its path does not block the extraction, and data after the end of the archive is dropped. (GHSA-343g-5v7x-x325, GHSA-5qxq-cgm8-6j7r, GHSA-xm6h-2993-3ch9, GHSA-7c32-79xj-j3jp, GHSA-98v3-7xjr-fg83, GHSA-25mm-r35j-6hgm, GHSA-72fp-85cc-g945, GHSA-9239-v992-p74f)lutimesandlchown, and options and the data of a warning cannot come from a changedObject.prototype, in the commands and in each class. (GHSA-m6rr-3gqh-4f88, GHSA-5x73-x9rx-m7x2, GHSA-qf42-f7hw-qxrq)create()skips a file or directory that changes betweenlstatandopenorreaddir, and does not read it through a symbolic link. (GHSA-xj5v-fr6h-vw74)create()andreplace()report each error to the caller and close the archive file. (GHSA-8h4g-6p7x-m3c9)replace()andupdate()skip an entry by its PAX size and ignore a PAX or GNU header that has no entry after it. (GHSA-p7rf-cx2m-qgrr, GHSA-9239-v992-p74f, GHSA-9hmx-4f52-v64x, GHSA-8h4g-6p7x-m3c9)Bug fixes
extract()withpreservePathssets the owner of each directory that it makes, not only of the last one.update()checks the paths in a directory also when the time of the directory did not change. A directory is always added again.filesoflist()andextract()matches an entry at each depth in that directory, not only 100 levels.create()does not write a file that has more than one link as a hard link to itself when its path is added two times.extract()keeps an existing directory for aGNUDumpDirentry, as it does for aDirectoryentry.v7.5.24Compare Source
v7.5.23Compare Source
Configuration
📅 Schedule: (in timezone America/Los_Angeles)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.