CVE-2024-54142
📋 TL;DR
This vulnerability allows cross-site scripting (XSS) attacks in Discourse AI plugin when HTML entities from shared bot conversations leak into Discourse posts. Attackers can inject malicious scripts that execute in victims' browsers when viewing affected posts. All Discourse installations using the vulnerable Discourse AI plugin are affected.
💻 Affected Systems
- Discourse AI plugin
⚠️ Manual Verification Required
This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.
Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).
🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.
- Review the CVE details at NVD
- Check vendor security advisories for your specific version
- Test if the vulnerability is exploitable in your environment
- Consider updating to the latest version as a precaution
⚠️ Risk & Real-World Impact
Worst Case
Attackers could steal session cookies, perform actions as authenticated users, deface forums, or redirect users to malicious sites through persistent XSS payloads.
Likely Case
Attackers inject malicious JavaScript that steals user session tokens or performs unauthorized actions when users view compromised posts.
If Mitigated
With proper input sanitization and Content Security Policy, impact is limited to specific post contexts with reduced privilege escalation potential.
🎯 Exploit Status
Exploitation requires ability to create/shared AI bot conversations and knowledge of HTML entity encoding bypass techniques.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Commit 92f122c54d9d7ead9223a056270bff5b4c42c73f
Vendor Advisory: https://github.com/discourse/discourse-ai/security/advisories/GHSA-94c2-qr2h-88jv
Restart Required: Yes
Instructions:
1. Update Discourse AI plugin to version containing commit 92f122c
2. Restart Discourse application
3. Verify fix by testing conversation sharing functionality
🔧 Temporary Workarounds
Disable AI bot public sharing
allRemove all groups from 'ai bot public sharing allowed groups' site setting to prevent exploitation vector
Navigate to Discourse admin panel > Settings > ai_bot_public_sharing_allowed_groups > Remove all groups
🧯 If You Can't Patch
- Disable the Discourse AI plugin entirely until patching is possible
- Implement strict Content Security Policy headers to mitigate XSS impact
🔍 How to Verify
Check if Vulnerable:
Check if Discourse AI plugin version predates commit 92f122c and if 'ai bot public sharing allowed groups' contains any groups
Check Version:
Check Discourse admin panel or plugin directory for Discourse AI plugin version/commit hash
Verify Fix Applied:
Verify plugin includes commit 92f122c and test sharing AI bot conversations with HTML entities to ensure proper sanitization
📡 Detection & Monitoring
Log Indicators:
- Unusual HTML entities in post content
- Multiple failed conversation sharing attempts
- JavaScript execution errors in browser logs
Network Indicators:
- Unexpected script loads from post content
- Cross-origin requests from forum pages
SIEM Query:
search 'discourse' AND ('html entity' OR 'script' OR 'xss') in application logs