Loading...
Skip to main content

CVE-2024-21636 — Vulnerability in view_component — CVE Details

MEDIUM

view_component Cross-site Scripting vulnerability

Published January 4, 2024Updated September 10, 2026Source: osv

Summary

### Impact _What kind of vulnerability is it? Who is impacted?_ This is an XSS vulnerability that has the potential to impact anyone rendering a component directly from a controller with the view_component gem. Note that only components that define a [`#call` method](https://viewcomponent.org/guide/templates.html#call) (i.e. instead of using a sidecar template) are affected. The return value of the `#call` method is not sanitized and can include user-defined content. In addition, the return value of the [`#output_postamble` method](https://viewcomponent.org/api.html#output_postamble--string) is not sanitized, which can also lead to XSS issues. ### Patches _Has the problem been patched? What versions should users upgrade to?_ Versions 3.9.0 has been released and fully mitigates both the `#call` and the `#output_postamble` vulnerabilities. ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ Sanitize the return value of `#call`, eg: ```ruby class MyComponent < ApplicationComponent def call html_escape("<div>#{user_input}</div>") end end ``` ### References _Are there any links users can visit to find out more?_ https://github.com/ViewComponent/view_component/pull/1950 ### For more information If you have any questions or comments about this advisory: Open an issue in the [github/view_component](https://github.com/github/view_component) project.

Advisory Timeline

  • First published January 4, 2024 (1012 days ago).
  • Last revised September 10, 2026 — 979 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Bundler
Update view_component to 3.9.0 or later
gem install view_component -v 3.9.0
Bundler
Update view_component to 2.83.0 or later
gem install view_component -v 2.83.0

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (2)

Affects 1 ecosystem: rubygems (1).

PackageEcosystemAffectedFixed In
view_component
rubygems
3.0.0, 3.1.0, 3.2.0, 3.3.0 (+5 more)3.9.0
view_component
rubygems
1.16.0, 1.17.0, 2.0.0, 2.1.0 (+105 more)2.83.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-79
    Cross-site Scripting (XSS)MITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.1 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Frequently Asked Questions

What is CVE-2024-21636?
view_component Cross-site Scripting vulnerability This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.1/10).
How do I check if my project is affected by CVE-2024-21636?
CVE-2024-21636 affects view_component. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-21636 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
6.1

Exploitation requires specific conditions or has limited impact. Remediate within weeks.

Also Known As

GHSA-wf2x-8w6j-qw37

Related CVEs

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies