Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. tmp
  4. ›
  5. CVE-2026-49982

CVE-2026-49982: tmp: Type-confusion bypass of _assertPath allows path traversal via non-string prefix/postfix/template

June 15, 2026

The _assertPath guard added to tmp@0.2.6 rejects only string values that contain the substring ... It is bypassed when prefix, postfix, or template is supplied as a non-string value (Array, Buffer, or any object) whose includes('..') returns falsy but whose stringification still contains ../. The value flows through Array.prototype.join/String coercion inside _generateTmpName and path.join(tmpDir, opts.dir, name), producing a final path that escapes tmpdir and creates a file or directory at an attacker-controlled location with the host process’s privileges.

This affects any application that forwards untrusted request data (a common pattern is JSON body fields or qs-parsed bracket-array query strings such as ?prefix[]=...) into tmp.file, tmp.fileSync, tmp.dir, tmp.dirSync, tmp.tmpName, or tmp.tmpNameSync without explicit type coercion.

References

  • github.com/advisories/GHSA-7c78-jf6q-g5cm
  • github.com/raszi/node-tmp/security/advisories/GHSA-7c78-jf6q-g5cm
  • nvd.nist.gov/vuln/detail/CVE-2026-49982

Code Behaviors & Features

Detect and mitigate CVE-2026-49982 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 0.2.6 before 0.2.7

Fixed versions

  • 0.2.7

Solution

Upgrade to version 0.2.7 or above.

Impact 8.2 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L

Learn more about CVSS

Weakness

  • CWE-20: Improper Input Validation
  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Source file

npm/tmp/CVE-2026-49982.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 23 Jun 2026 12:23:25 +0000.