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

> Type confusion in tmp library allows path traversal via non-string inputs, enabling attackers to create files outside the temporary directory.

- **Severity:** High 8.2 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Jun 2026
- **Updated:** 11 Jun 2026
- **Also known as:** CLSA-2026-1793207046, ECHO-74e5-bcf8-2c2a, GHSA-7c78-jf6q-g5cm, MINI-3cp6-phcw-7mgg, MINI-pqp9-vfxx-795h, MINI-vhg5-44q3-7ww6, MINI-vrcx-jvcc-6w87, MINI-xf7q-xxgc-9p82, ROOT-APP-NPM-CVE-2026-49982, UBUNTU-CVE-2026-49982

## What is CVE-2026-49982?

CVE-2026-49982 is a high-severity path traversal vulnerability in raszi node-tmp, published on 11 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

tmp is a temporary file and directory creator for node.js. In version 0.2.6, the _assertPath guard added to tmp 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. This vulnerability is fixed in 0.2.7.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2026-49982?

2 open source packages ship an affected version, including tmp. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `tmp` | npm | From 0.2.6 | 0.2.7 |
| `tmp` | npm | From 0.2.6 | 0.2.7 |

Products: Raszi Tmp.

## How do I fix CVE-2026-49982?

Upgrade tmp to 0.2.7 or later.

## Is CVE-2026-49982 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-49982 exists.

## Other vulnerabilities in raszi node-tmp

- [CVE-2026-44705](https://insights.sbomify.com/CVE-2026-44705/): tmp: Path Traversal via unsanitized prefix/postfix enables directory escape (high 7.7)
- [CVE-2025-54798](https://insights.sbomify.com/CVE-2025-54798/): tmp does not restrict arbitrary temporary file / directory write via symbolic link `dir` parameter (low 2.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-49982 and fix it if it is affected.

What it is: CVE-2026-49982 is a high-severity path traversal vulnerability in raszi node-tmp, published on 11 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-49982 exists.

Affected packages and fixed versions:
- tmp (npm): affected from 0.2.6; fixed in 0.2.7
- tmp (npm): affected from 0.2.6; fixed in 0.2.7

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-49982/ (Markdown: https://insights.sbomify.com/CVE-2026-49982/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-49982
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-49982
- OSV: https://osv.dev/vulnerability/CVE-2026-49982

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-49982/
Summaries are generated and may contain mistakes; the official description above is the record.
