/

CVE-2026-27606

Severity:

CRITICAL RISK

(9.8)

Path Traversal File Write in Rollup Module Bundler Core

CVE-2026-27606

Modified

Vulnerability type

Category:

Path Traversal / Arbitrary File Write

CWE:

CWE-22

Impact:

Arbitrary File Write leading to Potential Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Rollup's core engine contains a path traversal flaw in its filename handling that allows arbitrary file writes when generating bundle outputs.

If an attacker can influence output filenames—through CLI input names, manual chunk aliases, or malicious plugins—they may use traversal sequences (e.g., ../) to overwrite files anywhere the build process has write access, potentially enabling persistent remote code execution via modified configuration or code files.

Affected context

This vulnerability affects environments where Rollup is used as a JavaScript module bundler and untrusted or semi-trusted parties can influence output filenames.

Typical risk scenarios include:

  • Build pipelines that accept user-controlled entry points or file names via CLI or configuration
  • Projects that rely on external or third-party Rollup plugins which may manipulate chunk names or aliases
  • Multi-tenant or CI/CD environments where different teams or services share the same build infrastructure and filesystem

The issue is present in Rollup versions prior to 2.80.0, 3.30.0, and 4.59.0 (including affected 4.x releases) where path normalization and sanitization for output paths are incomplete.

Exploit preconditions

  • Attack surface: Rollup build configuration and inputs (CLI arguments, config files, plugin APIs).
  • Required access: Ability to:
  • Provide or modify Rollup input file names, entry points, or output configuration; or
  • Supply or control Rollup plugins that can set manual chunk aliases or output names.
  • Trigger point: Executing a Rollup build that processes attacker-controlled names and writes bundle artifacts to disk.
  • Why exploitation is possible: The core engine trusts output filename values and performs insufficient normalization and validation against traversal patterns (../) and absolute paths. As a result, resolved output paths can escape the intended output directory and target arbitrary writable locations on the host filesystem.

Why this happens

The root cause is improper restriction of path construction when generating output files.

Rollup's core engine accepts user- or plugin-controlled names (such as entry point names and manual chunk aliases) and interpolates them directly into output paths. Without strict normalization, canonicalization, and whitelisting of allowed directories, path traversal sequences like ../ and similar constructs can cause the resolved path to point outside the intended build output directory. This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where application logic fails to enforce directory boundaries and relies on incomplete or ad-hoc string sanitization instead of robust path validation.

Potential impact

  • Overwriting application source files or build artifacts that are later served to users or executed on servers
  • Modifying user- or system-level configuration files to achieve persistent code execution
  • Tampering with CI/CD pipeline scripts, hooks, or deployment manifests
  • Corrupting security-related files (e.g., environment configuration, access control lists, or startup scripts) within the permissions of the build process
  • Disrupting service availability by overwriting critical files, leading to application or system failures

General mitigation guidance

Effective mitigation focuses on enforcing strict output path boundaries and reducing trust in user-controlled names:

  • Constrain output directories: Ensure that all generated file paths are resolved against a predefined, canonical output directory, rejecting or rewriting any paths that attempt to escape this root.
  • Normalize and validate paths: Normalize paths to their canonical form and perform checks on the normalized result (not the raw string) to detect traversal (../, absolute paths, or drive prefixes) before writing.
  • Apply allowlists for file locations: Restrict outputs to known safe subpaths (e.g., specific bundles, asset directories) and avoid deriving directory structures directly from user or plugin inputs.
  • Sanitize attacker-controlled identifiers: When using CLI arguments, manual chunk aliases, or plugin-generated names, filter them to a safe character set and disallow path separators or dot-dot segments entirely.
  • Isolate build permissions: Run build processes under least-privilege accounts with minimal filesystem write access, and, where feasible, in containerized or ephemeral environments to limit damage from arbitrary file writes.
  • Review plugin behavior: Treat plugins as code with full impact on the build system; avoid loading untrusted plugins and ensure internal plugins do not pass raw user-supplied strings into output name fields.

How teams detect issues like this

Detection approaches can focus on both code and environment behavior:

  • Static analysis and code review:
  • Look for code paths in build tools or plugins that concatenate user input into file paths without canonicalization.
  • Flag uses of output name or chunk alias APIs where the value may come from external configuration, HTTP parameters, or multi-tenant inputs.
  • Review any custom Rollup plugins for direct use of user-controlled strings in fileName, chunkFileNames, entryFileNames, or similar options.
  • Policy enforcement in CI/CD:
  • Enforce policies that disallow unreviewed or third-party plugins in sensitive build pipelines.
  • Use configuration linters to detect unsafe patterns such as path separators in names passed via environment variables or CLI.
  • Runtime and filesystem monitoring:
  • Monitor build environments for writes outside expected output directories by the Rollup build user.
  • Use allowlist-based filesystem policies (e.g., sandboxing, mandatory access control) to log or block write attempts beyond designated build folders.
  • Automated tooling:
  • Integrate general-purpose SAST tools that can identify path traversal and arbitrary file-write patterns.
  • Employ configuration scanning tools that highlight potentially dangerous use of dynamic filenames or uncontrolled paths.

Sources

SourceLink
github.comgithub.com/rollup/rollup/commit/c60770d7aaf750e512c1b2774989ea4596e660b2
github.comgithub.com/rollup/rollup/commit/c8cf1f9c48c516285758c1e11f08a54f304fd44e
github.comgithub.com/rollup/rollup/commit/d6dee5e99bb82aac0bee1df4ab9efbde455452c3
github.comgithub.com/rollup/rollup/releases/tag/v2.80.0
github.comgithub.com/rollup/rollup/releases/tag/v3.30.0
github.comgithub.com/rollup/rollup/releases/tag/v4.59.0
github.comgithub.com/rollup/rollup/security/advisories/GHSA-mw96-cpmx-2vgc
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10175
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13508
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13512
access.redhat.comaccess.redhat.com/errata/RHSA-2026:13545
access.redhat.comaccess.redhat.com/errata/RHSA-2026:5132
access.redhat.comaccess.redhat.com/errata/RHSA-2026:5649
access.redhat.comaccess.redhat.com/errata/RHSA-2026:5665
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6174
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6802
access.redhat.comaccess.redhat.com/errata/RHSA-2026:8483
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-27606
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2442530
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-27606.json

Frequently asked

questions

It can be, depending on how Rollup is integrated. If a remote user can influence input names, configuration, or plugins (for example, via a web interface that triggers builds or a multi-tenant CI service), they may remotely trigger arbitrary file writes. In local-only build setups with no untrusted inputs, exposure is reduced.

An attacker needs the ability to control or significantly influence Rollup's output naming—through CLI parameters, configuration files, or custom plugins. They do not typically need shell access to the build host, but they must be able to reach the part of the system that prepares or runs the Rollup build.

The safest approach is to enforce strict directory confinement for all outputs, normalize and validate paths after resolution, and forbid path traversal or absolute paths in any user- or plugin-controlled name. Combined with least-privilege execution of build processes, this substantially limits the attack surface.

Future prevention relies on designing build tooling and plugins with clear trust boundaries: treat all external configuration as untrusted, never concatenate raw user input into filesystem paths, use canonical path checks against a known-safe root directory, and consistently subject build code to security-focused code review and automated analysis.

Find out what's already
exploitable in your codebase.