Skip to content
Heist/ feed
Back to feed
High

node-tar — security advisory

Type: advisorySources: OSVAdvisory ID: UBUNTU-CVE-2021-32804

The npm package "tar" (aka node-tar) before versions 6.1.1, 5.0.6, 4.4.14, and 3.3.2 has a arbitrary File Creation/Overwrite vulnerability due to insufficient absolute path sanitization. node-tar aims to prevent extraction of absolute file paths by turning absolute paths into relative paths when the `preservePaths` flag is not set to `true`. 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 into `home/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. This issue was addressed in releases 3.2.2, 4.4.14, 5.0.6 and 6.1.1. Users may work around this vulnerability without upgrading by creating a custom `onentry` method which sanitizes the `entry.path` or a `filter` method which removes entries with absolute paths. See referenced GitHub Advisory for details. Be aware of CVE-2021-32803 which fixes a similar bug in later versions of tar.

Products
node-tar
Affected versions
0.1.18-1, 0.1.18-1ubuntu0.1~esm1, 1.0.3-2, 1.0.3-2ubuntu0.1~esm1, 2.2.1-1, 4.4.10+ds1-2, 4.4.10+ds1-2ubuntu1, 4.4.10+ds1-2ubuntu1+esm1, 6.1.11+ds1+~cs6.0.6-1, 6.1.11+~cs11.3.10-1, 6.1.13+~cs7.0.5-1, 6.1.13+~cs7.0.5-3, 6.1.7+~cs11.3.10-1, 6.2.1+ds1+~cs6.1.13-10, 6.2.1+ds1+~cs6.1.13-6, 6.2.1+ds1+~cs6.1.13-7, 6.2.1+~cs7.0.8-1, 7.5.22+~4.0.1-1
Fixed versions
Not specified
CVEs
CVE-2021-32804
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 00:34 UTC · Revision 1

Source evidence

UBUNTU-CVE-2021-32804

core-osv · Original source

Published 3 Aug 2021, 19:15 UTC

The npm package "tar" (aka node-tar) before versions 6.1.1, 5.0.6, 4.4.14, and 3.3.2 has a arbitrary File Creation/Overwrite vulnerability due to insufficient absolute path sanitization. node-tar aims to prevent extraction of absolute file paths by turning absolute paths into relative paths when the `preservePaths` flag is not set to `true`. 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 into `home/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. This issue was addressed in releases 3.2.2, 4.4.14, 5.0.6 and 6.1.1. Users may work around this vulnerability without upgrading by creating a custom `onentry` method which sanitizes the `entry.path` or a `filter` method which removes entries with absolute paths. See referenced GitHub Advisory for details. Be aware of CVE-2021-32803 which fixes a similar bug in later versions of tar.

osv:UBUNTU-CVE-2021-32804

node-tar

Fixed versions: Not specified

node-tar

Fixed versions: Not specified

node-tar

Fixed versions: Not specified

node-tar

Fixed versions: Not specified

node-tar

Fixed versions: Not specified

node-tar

Fixed versions: Not specified

node-tar

Fixed versions: Not specified

node-tar

Fixed versions: Not specified

node-tar

Fixed versions: Not specified

Complete source record
{
  "id": "a7b8b4fa659f57185b207ce8abfb90526388d0e952b8e26e825b849b2887be29",
  "url": "https://osv.dev/vulnerability/UBUNTU-CVE-2021-32804",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "UBUNTU-CVE-2021-32804",
    "summary": "The npm package \"tar\" (aka node-tar) before versions 6.1.1, 5.0.6, 4.4.14, and 3.3.2 has a arbitrary File Creation/Overwrite vulnerability due to insufficient absolute path sanitization. node-tar aims to prevent extraction of absolute file paths by turning absolute paths into relative paths when the `preservePaths` flag is not set to `true`. 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 into `home/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. This issue was addressed in releases 3.2.2, 4.4.14, 5.0.6 and 6.1.1. Users may work around this vulnerability without upgrading by creating a custom `onentry` method which sanitizes the `entry.path` or a `filter` method which removes entries with absolute paths. See referenced GitHub Advisory for details. Be aware of CVE-2021-32803 which fixes a similar bug in later versions of tar.",
    "evidence": "osv:UBUNTU-CVE-2021-32804",
    "products": [
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "0.1.18-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "0.1.18-1ubuntu0.1~esm1",
            "evidence": "/affected/0/versions"
          }
        ]
      },
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "1.0.3-2",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.0.3-2ubuntu0.1~esm1",
            "evidence": "/affected/1/versions"
          }
        ]
      },
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/2/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "2.2.1-1",
            "evidence": "/affected/2/versions"
          }
        ]
      },
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/3/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "4.4.10+ds1-2",
            "evidence": "/affected/3/versions"
          },
          {
            "value": "4.4.10+ds1-2ubuntu1",
            "evidence": "/affected/3/versions"
          },
          {
            "value": "4.4.10+ds1-2ubuntu1+esm1",
            "evidence": "/affected/3/versions"
          }
        ]
      },
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/4/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "6.1.7+~cs11.3.10-1",
            "evidence": "/affected/4/versions"
          },
          {
            "value": "6.1.11+~cs11.3.10-1",
            "evidence": "/affected/4/versions"
          },
          {
            "value": "6.1.11+ds1+~cs6.0.6-1",
            "evidence": "/affected/4/versions"
          }
        ]
      },
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/5/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "6.1.13+~cs7.0.5-1",
            "evidence": "/affected/5/versions"
          },
          {
            "value": "6.1.13+~cs7.0.5-3",
            "evidence": "/affected/5/versions"
          }
        ]
      },
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/6/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "6.2.1+~cs7.0.8-1",
            "evidence": "/affected/6/versions"
          }
        ]
      },
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/7/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "6.2.1+ds1+~cs6.1.13-10",
            "evidence": "/affected/7/versions"
          },
          {
            "value": "7.5.22+~4.0.1-1",
            "evidence": "/affected/7/versions"
          }
        ]
      },
      {
        "name": {
          "value": "node-tar",
          "evidence": "/affected/8/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "6.2.1+~cs7.0.8-1",
            "evidence": "/affected/8/versions"
          },
          {
            "value": "6.2.1+ds1+~cs6.1.13-6",
            "evidence": "/affected/8/versions"
          },
          {
            "value": "6.2.1+ds1+~cs6.1.13-7",
            "evidence": "/affected/8/versions"
          },
          {
            "value": "6.2.1+ds1+~cs6.1.13-10",
            "evidence": "/affected/8/versions"
          }
        ]
      }
    ],
    "severity": "high",
    "structured": {
      "id": "UBUNTU-CVE-2021-32804",
      "aliases": [
        "UBUNTU-CVE-2021-32804"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N"
        },
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H"
        },
        {
          "type": "Ubuntu",
          "score": "medium"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=esm-infra-legacy%2Ftrusty",
            "ecosystem": "Ubuntu:Pro:14.04:LTS"
          },
          "versions": [
            "0.1.18-1",
            "0.1.18-1ubuntu0.1~esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "0.1.18-1ubuntu0.1~esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=esm-apps%2Fxenial",
            "ecosystem": "Ubuntu:Pro:16.04:LTS"
          },
          "versions": [
            "1.0.3-2",
            "1.0.3-2ubuntu0.1~esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "1.0.3-2ubuntu0.1~esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=bionic",
            "ecosystem": "Ubuntu:18.04:LTS"
          },
          "versions": [
            "2.2.1-1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "2.2.1-1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=esm-apps%2Ffocal",
            "ecosystem": "Ubuntu:Pro:20.04:LTS"
          },
          "versions": [
            "4.4.10+ds1-2",
            "4.4.10+ds1-2ubuntu1",
            "4.4.10+ds1-2ubuntu1+esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "4.4.10+ds1-2ubuntu1+esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=jammy",
            "ecosystem": "Ubuntu:22.04:LTS"
          },
          "versions": [
            "6.1.7+~cs11.3.10-1",
            "6.1.11+~cs11.3.10-1",
            "6.1.11+ds1+~cs6.0.6-1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "6.1.11+ds1+~cs6.0.6-1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=noble",
            "ecosystem": "Ubuntu:24.04:LTS"
          },
          "versions": [
            "6.1.13+~cs7.0.5-1",
            "6.1.13+~cs7.0.5-3"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "6.1.13+~cs7.0.5-3"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=questing",
            "ecosystem": "Ubuntu:25.10"
          },
          "versions": [
            "6.2.1+~cs7.0.8-1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "6.2.1+~cs7.0.8-1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=stonking",
            "ecosystem": "Ubuntu:26.10"
          },
          "versions": [
            "6.2.1+ds1+~cs6.1.13-10",
            "7.5.22+~4.0.1-1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "7.5.22+~4.0.1-1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "node-tar",
            "purl": "pkg:deb/ubuntu/node-tar?arch=source&distro=resolute",
            "ecosystem": "Ubuntu:26.04:LTS"
          },
          "versions": [
            "6.2.1+~cs7.0.8-1",
            "6.2.1+ds1+~cs6.1.13-6",
            "6.2.1+ds1+~cs6.1.13-7",
            "6.2.1+ds1+~cs6.1.13-10"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-32804.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "node-tar",
                "binary_version": "6.2.1+ds1+~cs6.1.13-10"
              }
            ]
          }
        }
      ],
      "modified": "2026-10-17T12:55:46.614473150Z",
      "provider": "osv",
      "upstream": [
        "CVE-2021-32804"
      ],
      "references": [
        "https://ubuntu.com/security/CVE-2021-32804",
        "https://www.npmjs.com/advisories/1770",
        "https://github.com/npm/node-tar/commit/1f036ca23f64a547bdd6c79c1a44bc62e8115da4",
        "https://github.com/npm/node-tar/security/advisories/GHSA-3jfq-g458-7qm9",
        "https://www.npmjs.com/package/tar",
        "https://www.cve.org/CVERecord?id=CVE-2021-32804"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2021-32804",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 354050,
  "published_at": "2021-08-03T19:15:00+00:00"
}