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·3 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

•16 minutes ago•GHSA-268H-HP4C-CRQ3
5.4

GHSA-268h-hp4c-crq3: CRLF Injection via List-* Header Comments in Nodemailer

GHSA-268h-hp4c-crq3 is a Carriage Return Line Feed (CRLF) injection vulnerability in the Nodemailer npm package affecting versions up to and including 8.0.8. The library allows arbitrary email header injection when parsing user-controlled comments within list headers (such as List-Unsubscribe or List-ID). This occurs because list headers bypass standard validation by utilizing an internal 'prepared' flag, causing unsanitized newlines to be emitted directly into the outgoing RFC822 mail stream. This exploit allows remote attackers to inject custom, unauthorized mail headers, disrupting signature checks, bypassing filters, or spoofing parameters.

Alon Barad
Alon Barad
0 views•8 min read
•about 1 hour ago•CVE-2026-48524
3.7

CVE-2026-48524: Remote Cache Eviction and Authentication Denial of Service in PyJWT

A logic flaw in PyJWT's PyJWKClient class allows remote unauthenticated attackers to trigger a complete authentication outage. By transmitting a volume of JWTs containing randomized, non-existent Key ID (kid) values, attackers force synchronous outbound JWKS resolution queries. When these queries fail or time out, a defect in the error cleanup code overwrites the local cache of valid signing keys with None, causing a denial of service.

Alon Barad
Alon Barad
1 views•8 min read
•about 3 hours ago•CVE-2026-47347
5.3

CVE-2026-47347: Open Redirect Vulnerability in TYPO3 CMS GeneralUtility::sanitizeLocalUrl

CVE-2026-47347 is an open redirect vulnerability affecting multiple TYPO3 CMS versions. The issue resides in GeneralUtility::sanitizeLocalUrl, where an insufficient blocklist validation implementation fails to prevent browsers from normalizing malformed relative paths into external protocol-relative redirections. Attackers can exploit this to conduct phishing, session hijacking, or credential harvesting campaigns.

Alon Barad
Alon Barad
2 views•7 min read
•about 4 hours ago•CVE-2026-47349
5.3

CVE-2026-47349: Missing Authorization in TYPO3 CMS DataHandler Record Restoration

An authenticated backend user with access to the Recycler module in TYPO3 CMS can bypass write restrictions and restore soft-deleted records on pages or database tables they are not authorized to modify. This vulnerability resides in the core DataHandler class due to missing permission checks during 'undelete' operations.

Alon Barad
Alon Barad
2 views•7 min read
•about 4 hours ago•CVE-2026-11607
7.6

CVE-2026-11607: Broken Access Control in TYPO3 CMS Form Framework

CVE-2026-11607 is a critical broken access control vulnerability in TYPO3 CMS's Form Framework (ext:form). Authenticated backend users with access to the Form Framework can load unauthorized YAML configurations, bypassing file extension restrictions. This allows the execution of arbitrary SQL commands via the SaveToDatabase finisher, leading to privilege escalation to administrator level.

Amit Schendel
Amit Schendel
4 views•7 min read
•about 5 hours ago•GHSA-G7R4-M6W7-QQQR
7.5

GHSA-G7R4-M6W7-QQQR: Path Traversal and Arbitrary File Read in esbuild Development Server on Windows

Improper validation of backslash character separators in esbuild's local development server allows path traversal on Windows systems.

Alon Barad
Alon Barad
3 views•7 min read