/

CVE-2026-45623

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in PostCSS Source Map Parser

CVE-2026-45623

Analyzed

Vulnerability type

Category:

Path Traversal / Local File Read

CWE:

CWE-22, CWE-200

Impact:

Local File Disclosure and Targeted DoS

Severity:

HIGH RISK

(7.5)

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

PostCSS versions up to 8.5.11 contain a path traversal flaw in the PreviousMap source map parser that allows CSS input to drive filesystem reads via crafted sourceMappingURL comments.

When untrusted CSS is processed, an attacker can cause the host to read arbitrary local files and leak a portion of their contents through JSON parse error messages, providing both a file-existence oracle and a limited data exfiltration channel.

PostCSS versions up to 8.5.11 contain a path traversal flaw in the PreviousMap source map parser that allows CSS input to drive filesystem reads via crafted sourceMappingURL comments.

When untrusted CSS is processed, an attacker can cause the host to read arbitrary local files and leak a portion of their contents through JSON parse error messages, providing both a file-existence oracle and a limited data exfiltration channel.

Affected context

This vulnerability appears when applications run untrusted or partially trusted CSS through PostCSS with default options:

  • Using process() without specifying from or map
  • Accepting CSS from users, third-party packages, themes, extensions, or comments
  • Running on a host where PostCSS's Node.js process can read sensitive files

In these contexts, the /*# sourceMappingURL=PATH */ comment embedded in the CSS is interpreted as a filesystem path and dereferenced locally, creating a read primitive even though no plugins or special configuration are present.

This vulnerability appears when applications run untrusted or partially trusted CSS through PostCSS with default options:

  • Using process() without specifying from or map
  • Accepting CSS from users, third-party packages, themes, extensions, or comments
  • Running on a host where PostCSS's Node.js process can read sensitive files

In these contexts, the /*# sourceMappingURL=PATH */ comment embedded in the CSS is interpreted as a filesystem path and dereferenced locally, creating a read primitive even though no plugins or special configuration are present.

Exploit preconditions

  • Attack surface: Any PostCSS pipeline that accepts attacker-controlled CSS strings (e.g., CMS theme upload, user styles, package build steps, browser extension styles).
  • Required access: Ability to submit or influence CSS processed by PostCSS (no direct filesystem access required).
  • Trigger point: Invocation of postcss.process(cssInput) where cssInput contains a crafted /*# sourceMappingURL=PATH */ comment.
  • Why exploitation is possible: The PreviousMap implementation treats the sourceMappingURL comment as a trusted local path, dereferencing it without validating scheme, enforcing an allowlist, or preventing directory traversal, then surfaces partial file contents via JSON.parse error messages.
  • Attack surface: Any PostCSS pipeline that accepts attacker-controlled CSS strings (e.g., CMS theme upload, user styles, package build steps, browser extension styles).
  • Required access: Ability to submit or influence CSS processed by PostCSS (no direct filesystem access required).
  • Trigger point: Invocation of postcss.process(cssInput) where cssInput contains a crafted /*# sourceMappingURL=PATH */ comment.
  • Why exploitation is possible: The PreviousMap implementation treats the sourceMappingURL comment as a trusted local path, dereferencing it without validating scheme, enforcing an allowlist, or preventing directory traversal, then surfaces partial file contents via JSON.parse error messages.

Why this happens

At its core, this bug is an instance of CWE-22: Path Traversal combined with CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.

The PreviousMap parser blindly interprets sourceMappingURL comments in CSS as local filesystem paths, performing reads relative to the runtime environment without sanitization or policy checks.

Because the content of the referenced file is fed into a JSON parser, malformed or non-map files cause parse errors that incorporate a prefix of the file data into the error message.

This design effectively trusts unvalidated, user-controlled metadata to drive filesystem access and error content, exposing both an oracle for file existence and a limited disclosure of arbitrary file bytes.

At its core, this bug is an instance of CWE-22: Path Traversal combined with CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.

The PreviousMap parser blindly interprets sourceMappingURL comments in CSS as local filesystem paths, performing reads relative to the runtime environment without sanitization or policy checks.

Because the content of the referenced file is fed into a JSON parser, malformed or non-map files cause parse errors that incorporate a prefix of the file data into the error message.

This design effectively trusts unvalidated, user-controlled metadata to drive filesystem access and error content, exposing both an oracle for file existence and a limited disclosure of arbitrary file bytes.

Potential impact

  • An attacker may read the first bytes of files that are readable by the Node.js process (e.g., configuration files, tokens, keys, environment-like data).
  • Attackers can gain a high-fidelity file-existence oracle to map the filesystem and discover sensitive targets.
  • Large-file reads can be abused to cause performance degradation or denial of service in the host process.
  • Error message leakage may aid further exploitation by revealing paths, formats, or partial secrets used elsewhere in the application.
  • An attacker may read the first bytes of files that are readable by the Node.js process (e.g., configuration files, tokens, keys, environment-like data).
  • Attackers can gain a high-fidelity file-existence oracle to map the filesystem and discover sensitive targets.
  • Large-file reads can be abused to cause performance degradation or denial of service in the host process.
  • Error message leakage may aid further exploitation by revealing paths, formats, or partial secrets used elsewhere in the application.

General mitigation guidance

Effective mitigation focuses on constraining how source mapping metadata is interpreted and reducing trust in CSS-originated comments.

Common defensive patterns include:

  • Treating sourceMappingURL as untrusted input and validating it against a strict policy (e.g., only relative paths within a known safe directory, or disallowing filesystem-based URLs entirely).
  • Decoupling CSS input from direct filesystem access by using in-memory or pre-resolved source maps rather than resolving arbitrary paths at processing time.
  • Normalizing and canonicalizing paths before use, then enforcing allowlists to prevent traversal beyond intended directories.
  • Limiting the amount of file content that can reach error messages and logging systems, and avoiding including raw data from unexpected files in user-visible errors.
  • Running PostCSS in a sandboxed environment with least-privilege filesystem access so that even if paths are misused, accessible files are not sensitive.

Effective mitigation focuses on constraining how source mapping metadata is interpreted and reducing trust in CSS-originated comments.

Common defensive patterns include:

  • Treating sourceMappingURL as untrusted input and validating it against a strict policy (e.g., only relative paths within a known safe directory, or disallowing filesystem-based URLs entirely).
  • Decoupling CSS input from direct filesystem access by using in-memory or pre-resolved source maps rather than resolving arbitrary paths at processing time.
  • Normalizing and canonicalizing paths before use, then enforcing allowlists to prevent traversal beyond intended directories.
  • Limiting the amount of file content that can reach error messages and logging systems, and avoiding including raw data from unexpected files in user-visible errors.
  • Running PostCSS in a sandboxed environment with least-privilege filesystem access so that even if paths are misused, accessible files are not sensitive.

How teams detect issues like this

Organizations can detect this class of issue using a combination of static and operational techniques:

  • Static analysis rules or code review checklists that flag any code resolving unvalidated paths derived from user-controlled strings, especially in parsing or mapping utilities.
  • Inspection of build and processing pipelines to identify cases where CSS or other user-supplied assets are passed into PostCSS (or similar tools) without separating trusted and untrusted sources.
  • Monitoring for unusual file access patterns originating from asset processing workflows, such as attempts to read configuration files or protected directories when handling CSS.
  • Policy enforcement in CI/CD that restricts or warns on dynamic resolution of source maps from user content, and requires explicit approval for any component that performs local file reads based on input metadata.

Organizations can detect this class of issue using a combination of static and operational techniques:

  • Static analysis rules or code review checklists that flag any code resolving unvalidated paths derived from user-controlled strings, especially in parsing or mapping utilities.
  • Inspection of build and processing pipelines to identify cases where CSS or other user-supplied assets are passed into PostCSS (or similar tools) without separating trusted and untrusted sources.
  • Monitoring for unusual file access patterns originating from asset processing workflows, such as attempts to read configuration files or protected directories when handling CSS.
  • Policy enforcement in CI/CD that restricts or warns on dynamic resolution of source maps from user content, and requires explicit approval for any component that performs local file reads based on input metadata.

Sources

SourceLink
github.comgithub.com/postcss/postcss/security/advisories/GHSA-6g55-p6wh-862q

Frequently asked

questions

Exploitability depends on where PostCSS is used. Any environment that processes attacker-controlled CSS with default PostCSS options—such as CMS themes, user-uploaded styles, or third-party package builds—may be exposed. If CSS input is strictly trusted and controlled, the risk is lower.

An attacker needs the ability to supply or influence CSS that is fed into PostCSS. They do not need direct filesystem access or special privileges; the vulnerable behavior is triggered solely via crafted sourceMappingURL comments in the CSS.

The most robust pattern is to avoid resolving sourceMappingURL comments from untrusted CSS against the local filesystem. Instead, treat the comment as untrusted metadata, validate paths against strict policies or ignore them entirely for user content, and ensure any file access is confined to known safe directories with non-sensitive data.

Design asset pipelines under the assumption that file content and embedded comments can be attacker-controlled. Avoid letting input-driven metadata (paths, URLs, map references) directly control filesystem access, normalize and validate any paths before use, limit error-message data leakage, and run tooling with least-privilege permissions in isolated environments.

Exploitability depends on where PostCSS is used. Any environment that processes attacker-controlled CSS with default PostCSS options—such as CMS themes, user-uploaded styles, or third-party package builds—may be exposed. If CSS input is strictly trusted and controlled, the risk is lower.

An attacker needs the ability to supply or influence CSS that is fed into PostCSS. They do not need direct filesystem access or special privileges; the vulnerable behavior is triggered solely via crafted sourceMappingURL comments in the CSS.

The most robust pattern is to avoid resolving sourceMappingURL comments from untrusted CSS against the local filesystem. Instead, treat the comment as untrusted metadata, validate paths against strict policies or ignore them entirely for user content, and ensure any file access is confined to known safe directories with non-sensitive data.

Design asset pipelines under the assumption that file content and embedded comments can be attacker-controlled. Avoid letting input-driven metadata (paths, URLs, map references) directly control filesystem access, normalize and validate any paths before use, limit error-message data leakage, and run tooling with least-privilege permissions in isolated environments.

Find out what's already
exploitable in your codebase.