Prosemirror_to_html Gem, Cross-Site Scripting (XSS), CVE-2024-XXXX (Critical)

Listen to this Post

How the mentioned CVE works

The prosemirror_to_html gem converts ProseMirror document data structures into HTML. This conversion process correctly escapes the text content within HTML tags to prevent injection. However, it fails to escape or sanitize the values assigned to HTML attributes. An attacker can craft a ProseMirror document containing a malicious node, such as a link with an `href` attribute. When this node is processed, the gem outputs the raw, unescaped attribute value into the final HTML. For example, it would render <a href="javascript:alert('XSS')">Click</a>. When a victim’s browser loads this page, it interprets the `javascript:` protocol or other event handlers like `onerror` within the attribute, executing the attacker’s arbitrary code in the context of the user’s session.
Platform: RubyGem
Version: <0.2.1
Vulnerability : XSS
Severity: Critical
date: 2024-10-01

Prediction: Patch 2024-10-15

What Undercode Say:

gem list prosemirror_to_html
Vulnerable conversion
html = ProsemirrorToHtml::Renderer.new(document).render
Patch uses CGI.escapeHTML
CGI.escapeHTML('javascript:alert("XSS")')
bundle update prosemirror_to_html

How Exploit:

Craft a ProseMirror node with a malicious `href` or `onerror` attribute. Submit this document to a vulnerable application. The gem converts it to unsafe HTML. The victim’s browser executes the script upon page load or interaction.

Protection from this CVE

Upgrade to gem version 0.2.1+. Sanitize all HTML output using libraries like `sanitize` or loofah. Implement a strict Content Security Policy (CSP) header to block inline scripts.

Impact:

Arbitrary JavaScript execution. Session hijacking. Account takeover. Defacement.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top