CVE-2023-43657
📋 TL;DR
This vulnerability in the discourse-encrypt plugin allows cross-site scripting (XSS) attacks when encrypted topic titles are improperly escaped. It affects Discourse sites using the discourse-encrypt plugin with Content Security Policy (CSP) headers disabled. Attackers could inject malicious scripts that execute in users' browsers.
💻 Affected Systems
- discourse-encrypt plugin for Discourse
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Attackers could steal session cookies, perform actions as authenticated users, deface content, or redirect users to malicious sites, potentially compromising user accounts and sensitive encrypted communications.
Likely Case
Limited XSS attacks targeting users viewing specific encrypted topics, potentially stealing session tokens or performing unauthorized actions within the user's privilege level.
If Mitigated
No impact when CSP is properly enabled, as CSP headers would block the execution of injected scripts even if they reach the browser.
🎯 Exploit Status
Requires ability to create or modify encrypted topics and CSP disabled. Exploitation depends on user interaction with malicious content.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Version containing commit 9c75810af9
Vendor Advisory: https://github.com/discourse/discourse-encrypt/security/advisories/GHSA-5fh6-wp7p-xx7v
Restart Required: Yes
Instructions:
1. Update discourse-encrypt plugin to latest version. 2. Restart Discourse application. 3. Verify CSP headers are enabled in Discourse settings.
🔧 Temporary Workarounds
Enable CSP Headers
allEnable and properly configure Content Security Policy headers in Discourse settings to block XSS execution.
🧯 If You Can't Patch
- Ensure CSP headers are enabled and properly configured in Discourse settings
- Monitor admin dashboard for CSP warnings and address them immediately
🔍 How to Verify
Check if Vulnerable:
Check if discourse-encrypt plugin version is older than commit 9c75810af9 AND CSP headers are disabled in Discourse settings.
Check Version:
Check Discourse admin panel or plugin directory for discourse-encrypt version information
Verify Fix Applied:
Verify plugin version includes commit 9c75810af9 and CSP headers are enabled with no warnings in admin dashboard.
📡 Detection & Monitoring
Log Indicators:
- Unusual topic creation/modification patterns
- Admin dashboard CSP warnings
Network Indicators:
- Requests attempting to inject script tags in topic titles
- Missing CSP headers in HTTP responses
SIEM Query:
Search for: 'CSP violation' OR 'XSS attempt' in web application logs
🔗 References
- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
- https://github.com/discourse/discourse-encrypt/commit/9c75810af9a474d7edaec67dea66f852c0ba1f4e
- https://github.com/discourse/discourse-encrypt/security/advisories/GHSA-5fh6-wp7p-xx7v
- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
- https://github.com/discourse/discourse-encrypt/commit/9c75810af9a474d7edaec67dea66f852c0ba1f4e
- https://github.com/discourse/discourse-encrypt/security/advisories/GHSA-5fh6-wp7p-xx7v