PostCSS Patches Critical XSS Vulnerability CVE-2026-41305 — Unescaped </style> Enables Client-Side Injection
PostCSS, one of the most widely deployed CSS processing tools in the JavaScript ecosystem, has issued a security patch addressing a cross-site scripting vulnerability that could expose web applications to client-side code injection. The flaw, tracked as CVE-2026-41305 and documented in GitHub Advisory GHSA-qx2v-qp2m-jg93, affects PostCSS versions through v8.5.5. The vulnerability stems from improper escaping of `</style>` sequences within CSS stringify output, allowing maliciously crafted style blocks to break out of HTML contexts and execute arbitrary JavaScript in a victim's browser.
The issue was identified in the CSS serialization logic, where PostCSS failed to sanitize or escape the literal string `</style>` when processing user-supplied or dynamically generated CSS input. Applications that pass untrusted content through PostCSS without additional sanitization become vulnerable to XSS attacks, particularly in scenarios involving inline styles, dynamic theme generation, or any pipeline where CSS is constructed from external sources. The vulnerability has been patched in v8.5.10, which updates the package from v8.4.31.
Developers using PostCSS in production environments should verify their dependency trees immediately. Any application that renders CSS processed by PostCSS on the client side, serves dynamically generated stylesheets, or integrates PostCSS into build pipelines handling third-party input faces potential exposure. Security teams are advised to audit configurations, apply the update, and review input handling practices around CSS generation as a precautionary measure.