REDHAT-BUG-2517456: High severity npm/postcss vulnerability
PostCSS takes a CSS file and provides an API to analyze and modify its rules by transforming the rules into an Abstract Syntax Tree. Prior to 8.5.18, lib/previous-map.js loadMap() passes attacker-controlled sourceMappingURL values to join(dirname(opts.from), annotation), and loadFile() permits traversed or absolute .map paths, allowing untrusted CSS processed without map: false to disclose sourcesContent from arbitrary reachable .map files through result.map. This issue is fixed in version 8.5.18.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 8.5.18
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications using npm/postcss before 8.5.18 are exposed when they process untrusted CSS and do not disable source map handling with map: false. The disclosure is limited to reachable .map files whose contents can be returned through result.map.
What does an attacker need to exploit it?
An attacker needs control of a CSS file processed by PostCSS, including its sourceMappingURL annotation. They can use traversal or an absolute path to cause PostCSS to load a reachable .map file.
Are default source map settings affected?
The issue affects processing of untrusted CSS unless map: false is set. Disabling maps prevents the vulnerable sourceMappingURL handling described here.
What can be done before upgrading?
Upgrade PostCSS to 8.5.18. If upgrading is not immediately possible, do not process untrusted CSS, or process it with map: false.