Description
view_component is a framework for building reusable, testable, and encapsulated view components in Ruby on Rails. From 4.0.0 until 4.12.0, ViewComponent::Base#around_render can return HTML-unsafe strings that bypass the escaping behavior applied to normal #call return values. This creates an XSS risk when downstream applications use around_render to wrap, replace, instrument, or conditionally return content that includes user-controlled data, and ViewComponent::Collection#render_in can amplify the issue by joining per-item results and marking the entire output html_safe, converting raw unsafe output into an ActiveSupport::SafeBuffer. This issue is fixed in version 4.12.0.
Published: 2026-07-17
Score: 8.7 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

ViewComponent::Base#around_render, used in Ruby on Rails view components, can return strings that bypass the framework's normal escaping mechanism. From version 4.0.0 through 4.12.0, an attacker can supply user‑controlled data to around_render, causing the component to output raw, unsanitized HTML or JavaScript. This vulnerability is an instance of client‑side script injection (CWE‑79) and leads to cross‑site scripting (XSS) where malicious code can be executed in the context of trusted users' browsers, potentially exposing session data, credentials, or enabling further attacks.

Affected Systems

The flaw affects the ViewComponent framework, specifically the view_component gem on Ruby on Rails. Vulnerable releases include versions from 4.0.0 until 4.12.0; the issue is resolved in v4.12.0. The gem's changelog indicates that around_render is now correctly marked safe only when explicitly required. Applications built with earlier gem versions, especially those that use around_render to wrap or replace content that incorporates user data or that employ ViewComponent::Collection#render_in for batch rendering, are at risk. Upgrading to the fixed version or applying the published patch is the recommended approach.

Risk and Exploitability

The CVSS score of 8.7 classifies the problem as high severity, yet the EPSS score is reported as < 1%, suggesting a low probability of current exploitation. The vulnerability is not listed in CISA's KEV catalog, and no active exploit code targeting this flaw has been documented. Nevertheless, the attack requires only that a user interacts with an affected Rails application, making it remotely exploitable via standard web requests. Security teams should treat this as a significant risk for any application that employs the vulnerable component patterns, particularly when handling sensitive user input.

Generated by OpenCVE AI on July 30, 2026 at 23:25 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the view_component gem to version 4.12.0 or later to apply the vendor fix.
  • Audit any use of :around_render in your view components, ensuring you do not wrap untrusted user content without proper sanitization or escaping.
  • When rendering collections with ViewComponent::Collection#render_in, verify that the combined output is explicitly escaped and not automatically marked as html_safe.

Generated by OpenCVE AI on July 30, 2026 at 23:25 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-97jw-64cj-jc58 ViewComponent: around_render HTML-Safety Bypass
History

Mon, 20 Jul 2026 18:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Fri, 17 Jul 2026 23:00:00 +0000

Type Values Removed Values Added
First Time appeared Viewcomponent
Viewcomponent view Component
Vendors & Products Viewcomponent
Viewcomponent view Component

Fri, 17 Jul 2026 21:00:00 +0000

Type Values Removed Values Added
Description view_component is a framework for building reusable, testable, and encapsulated view components in Ruby on Rails. From 4.0.0 until 4.12.0, ViewComponent::Base#around_render can return HTML-unsafe strings that bypass the escaping behavior applied to normal #call return values. This creates an XSS risk when downstream applications use around_render to wrap, replace, instrument, or conditionally return content that includes user-controlled data, and ViewComponent::Collection#render_in can amplify the issue by joining per-item results and marking the entire output html_safe, converting raw unsafe output into an ActiveSupport::SafeBuffer. This issue is fixed in version 4.12.0.
Title view_component: around_render HTML-Safety Bypass
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 8.7, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N'}


Subscriptions

Viewcomponent View Component
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-20T17:38:56.324Z

Reserved: 2026-06-15T18:01:15.511Z

Link: CVE-2026-54498

cve-icon Vulnrichment

Updated: 2026-07-20T17:38:40.348Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-30T23:30:08Z

Weaknesses
  • CWE-79

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