HTML injection via bidirectional characters in Discourse code blocks
Key facts
- Attack vector
- Network
- Privileges required
- Low
- User interaction
- Passive
- Attack complexity
- Low
- Attack requirements
- Present
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- None · Low · None
- Fix status
- Fixed
Attack profile from CVSS 4.0 · GHSA-vq5x-84qg-f883. Fix status from GitHub. Impact type from CWE-79.
Summary
Discourse highlights hidden Unicode bidirectional characters in code blocks by parsing post HTML again (CWE-79). A user with low privileges can craft a post whose attribute value turns into HTML after parsing, bypassing the sanitizer to inject arbitrary HTML. The flaw is exploitable only with Nokogiri 1.19.4 and earlier, and the default Content Security Policy blocks script execution from the injected markup.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
### Impact Discourse highlights hidden Unicode bidirectional characters in code blocks so readers can see them. The highlighting step parsed the post's HTML again, so a user could craft a post where an attribute value containing these characters turned back into HTML, bypassing the sanitizer. This could be used to inject arbitrary HTML into posts. The default Content Security Policy blocks script execution from the injected markup. This is only exploitable with Nokogiri 1.19.4 and earlier, which do not escape `<` and `>` in attribute values. Supported releases bundle Nokogiri 1.19.7 and are not known to be exploitable; on them, the issue only corrupts such attribute values. ### Patches The highlighting now rewrites text nodes only and builds the warning markup as nodes, so no HTML is parsed again. Fixed in `2026.11.0-latest`. Fixed release versions will be added after the fix and backports are released. ### Workarounds No known workarounds for the HTML injection. Keep the default Content Security Policy enabled to prevent script execution. ### References - https://nvd.nist.gov/vuln/detail/CVE-2021-42574 Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-7X9UVRAT.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | Discourse | — | 2026.11.0-latest.1 | Patch available | GHSA-vq5x-84qg-f883 |
| — | Discourse | >= 2026.10.0-latest | 2026.10.1 | Patch available | GHSA-vq5x-84qg-f883 |
| — | Discourse | >= 2026.9.0-latest | 2026.9.2 | Patch available | GHSA-vq5x-84qg-f883 |
| — | Discourse | >= 2026.7.0-latest | 2026.7.5 | Patch available | GHSA-vq5x-84qg-f883 |
- Discourse Vendor— Affected — Fixed in 2026.11.0-latest.1 Patch available GHSA-vq5x-84qg-f883
- Discourse Vendor— Affected >= 2026.10.0-latest Fixed in 2026.10.1 Patch available GHSA-vq5x-84qg-f883
- Discourse Vendor— Affected >= 2026.9.0-latest Fixed in 2026.9.2 Patch available GHSA-vq5x-84qg-f883
- Discourse Vendor— Affected >= 2026.7.0-latest Fixed in 2026.7.5 Patch available GHSA-vq5x-84qg-f883
Remediation
Fixed in Discourse 2026.11.0-latest.1, 2026.10.1, 2026.9.2 and 2026.7.5, one for each release branch. Keep the default Content Security Policy enabled, which the sources give as the only mitigation.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-vq5x-84qg-f883 Discourse Fixed in 2026.11.0-latest.1 Advisory →
- Fix · GHSA-vq5x-84qg-f883 Discourse Fixed in 2026.10.1 Advisory →
- Fix · GHSA-vq5x-84qg-f883 Discourse Fixed in 2026.9.2 Advisory →
- Fix · GHSA-vq5x-84qg-f883 Discourse Fixed in 2026.7.5 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-vq5x-84qg-f883
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences