Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-45303 Overview
CVE-2024-45303 is a stored Cross-Site Scripting (XSS) vulnerability [CWE-79] in the Discourse Calendar plugin. The plugin adds dynamic calendars to the first post of a Discourse topic. Event names rendered by the plugin are not properly escaped, allowing attackers to inject arbitrary JavaScript. The vulnerability only affects sites that have modified or disabled Discourse's default Content Security Policy (CSP). Maintainers patched the issue in version 0.5 of the plugin.
Critical Impact
Authenticated users can inject malicious JavaScript through calendar event names, which executes in other users' browsers when Discourse's default CSP has been weakened or removed.
Affected Products
- Discourse Calendar plugin versions prior to 0.5
- Discourse installations with modified Content Security Policy
- Discourse installations with disabled Content Security Policy
Discovery Timeline
- 2024-09-12 - CVE-2024-45303 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-45303
Vulnerability Analysis
The Discourse Calendar plugin renders user-supplied event names directly into the DOM without HTML escaping. An attacker with permission to create or edit calendar events can embed HTML or JavaScript payloads in event names. When another user loads the topic containing the calendar, the browser executes the injected script in the context of the Discourse origin.
Discourse's default CSP mitigates script injection by blocking inline and third-party JavaScript. Sites that have relaxed or disabled this policy lose that mitigation and become exploitable. Successful exploitation can hijack sessions, perform actions as the victim, or redirect users to attacker-controlled resources.
Root Cause
The calendar initializer and FullCalendar option builder passed event name strings into HTML rendering paths without sanitization. The patch imports the escape helper from pretty-text/sanitizer and applies it to event name output in assets/javascripts/discourse/initializers/discourse-calendar.js and assets/javascripts/discourse/lib/full-calendar-default-options.js.
Attack Vector
An attacker needs network access to the Discourse site and an account allowed to post or edit calendar events. The attacker crafts an event name containing an HTML payload such as a <script> tag or an onerror handler. User interaction is required: a victim must view the topic that renders the calendar. The injected code then runs in the victim's browser session.
// Patch excerpt: assets/javascripts/discourse/initializers/discourse-calendar.js
import { isPresent } from "@ember/utils";
import $ from "jquery";
+import { escape } from "pretty-text/sanitizer";
import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import loadScript from "discourse/lib/load-script";
// Patch excerpt: assets/javascripts/discourse/lib/full-calendar-default-options.js
+import { escape } from "pretty-text/sanitizer";
import {
getCalendarButtonsText,
getCurrentBcp47Locale,
Source: GitHub commit 81e1c8e
Detection Methods for CVE-2024-45303
Indicators of Compromise
- Calendar event names containing HTML tags such as <script>, <img onerror=...>, or <svg onload=...>
- Unexpected outbound requests from browsers rendering Discourse topic pages that embed calendars
- Discourse posts with calendar events authored by low-reputation or newly created accounts
- Modified or missing Content-Security-Policy headers on Discourse responses
Detection Strategies
- Review the Discourse database for discourse-calendar event records whose name fields contain angle brackets or JavaScript event handlers.
- Audit the Discourse admin settings for CSP customizations that permit inline scripts or disable the policy entirely.
- Inspect browser-side error logs and CSP violation reports for events originating from calendar-rendered topics.
Monitoring Recommendations
- Alert on Discourse administrative changes to the content security policy site setting.
- Monitor web server access logs for anomalous POST requests to the calendar event endpoints by non-moderator accounts.
- Track plugin version drift and flag Discourse instances still running discourse-calendar below version 0.5.
How to Mitigate CVE-2024-45303
Immediate Actions Required
- Upgrade the Discourse Calendar plugin to version 0.5 or later.
- Re-enable Discourse's default Content Security Policy if it has been disabled or weakened.
- Audit existing calendar events and remove any posts containing suspicious HTML or script content.
- Rotate session cookies and API keys for administrator accounts if exploitation is suspected.
Patch Information
The fix is published in commit 81e1c8e3c4c02276fb890da7e3f684259aeb685c and included in Discourse Calendar version 0.5. See the GitHub Security Advisory GHSA-rq37-8pf3-4xc8 for full details. The patch applies the escape function from pretty-text/sanitizer to all event name rendering paths.
Workarounds
- Restore the default Discourse Content Security Policy to block execution of injected inline scripts.
- Restrict the trust level required to create calendar events to moderators or trusted users only.
- Temporarily disable the Discourse Calendar plugin until the upgrade can be applied.
# Update the discourse-calendar plugin on a standard Discourse deployment
cd /var/discourse
./launcher enter app
cd /var/www/discourse/plugins/discourse-calendar
git fetch --tags
git checkout v0.5
exit
./launcher rebuild app
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

