Skip to content

Cross-Site Scripting (XSS) vulnerability through unescaped HTML attribute values

High
Spone published GHSA-52c5-vh7f-26fx Nov 6, 2025

Package

bundler prosemirror_to_html (RubyGems)

Affected versions

< 0.2.1

Patched versions

0.2.1

Description

Impact

The prosemirror_to_html gem is vulnerable to Cross-Site Scripting (XSS) attacks through malicious HTML attribute values. While tag content is properly escaped, attribute values are not, allowing attackers to inject arbitrary JavaScript code.

Who is impacted:

  • Any application using prosemirror_to_html to convert ProseMirror documents to HTML
  • Applications that process user-generated ProseMirror content are at highest risk
  • End users viewing the rendered HTML output could have malicious JavaScript executed in their browsers

Attack vectors include:

  • href attributes with javascript: protocol: <a href="javascript:alert(document.cookie)">
  • Event handlers: <div onclick="maliciousCode()">
  • onerror attributes on images: <img src=x onerror="alert('XSS')">
  • Other HTML attributes that can execute JavaScript

Patches

A fix is currently in development. Users should upgrade to version 0.2.1 or later once released.

The patch escapes all HTML attribute values using CGI.escapeHTML to prevent injection attacks.

Workarounds

Until a patched version is available, users can implement one or more of these mitigations:

  1. Sanitize output: Pass the HTML output through a sanitization library like Sanitize or Loofah:
   html = ProsemirrorToHtml.render(document)
   safe_html = Sanitize.fragment(html, Sanitize::Config::RELAXED)
  1. Implement Content Security Policy (CSP): Add strict CSP headers to prevent inline JavaScript execution:
   Content-Security-Policy: default-src 'self'; script-src 'self'
  1. Input validation: If possible, validate and sanitize ProseMirror documents before conversion to prevent malicious content from entering the system.

References

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N

CVE ID

No known CVE

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

Credits