Executive brief
PostCSS, a widely used tool for transforming CSS styles, contains a vulnerability that allows an attacker to read files from the server's local filesystem. By providing a specially crafted CSS file, an attacker can trick the software into attempting to load a source map from an arbitrary location, such as system configuration files or sensitive environment variables. This can lead to the exposure of sensitive data (like the first few characters of passwords or API keys) and can be used to crash the service by forcing it to read extremely large files.
Technical details
A path traversal and arbitrary file read vulnerability exists in PostCSS's PreviousMap component. When the process() method encounters a /*# sourceMappingURL=PATH */ comment, it dereferences the PATH against the local filesystem using readFileSync without sufficient validation, scheme allowlisting, or traversal checks. If the target file is not a valid JSON source map, the resulting SyntaxError from JSON.parse embeds the first ~10 bytes of the file content, which may then be leaked through application error logs or HTTP responses. This vulnerability can also be used as a file-existence oracle or a DoS vector by targeting large files or device files like /dev/zero. The issue is present in default configurations and is fixed in version 8.5.12.
Affected products
- postcss postcss <= 8.5.11
Timeline
- 2026-07-20: advisory: GitHub Security Advisory published
- 2026-07-27: disclosed: NVD publication date
- 2026-07-27: patched: Fix released in version 8.5.12