What’s Vulnerable › Vulnerabilities
CVE-2021-39161: Cross-site scripting via category name in Discourse
- Severity: medium (CVSS 5.4 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 0.4% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2021-08-26 · updated 2026-06-17
- Weakness: CWE-79
Description
Discourse is an open source platform for community discussion. In affected versions category names can be used for Cross-site scripting(XSS) attacks. This is mitigated by Discourse's default Content Security Policy and this vulnerability only affects sites which have modified or disabled or changed Discourse's default Content Security Policy have allowed for moderators to modify categories. This issue is patched in the latest stable, beta and tests-passed versions of Discourse. Users are advised to ensure that the Content Security Policy is enabled, and has not been modified in a way which would make it more vulnerable to XSS attacks.
Affected products
- discourse: before 2.7.8; 2.8.0-beta1, 2.8.0-beta2, 2.8.0-beta3, 2.8.0-beta4 — fixed in 2.7.8
How to fix
Upgrade to a fixed version: discourse 2.7.8. Check the vendor advisory for mitigations.
References
- https://github.com/discourse/discourse/security/advisories/GHSA-xhmc-9jwm-wqph
- https://github.com/discourse/discourse/security/advisories/GHSA-xhmc-9jwm-wqph
Get alerted when CVE-2021-39161 or the next vulnerability affects your stack