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

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (0.66%). Schedule for your next planned update.

Does your project use an affected view_component version?

Paste your Gemfile.lock to check it for CVE-2024-21636 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my Gemfile.lock

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 (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 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:

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 project.

Advisory Timeline

  • First published January 4, 2024 (1057 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, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (2)

Affects 1 ecosystem: RubyGems (1).

PackageFixed In
view_component RubyGems · Affected: 3.0.0, 3.1.0, 3.2.0, 3.3.0 (+5 more)3.9.0
view_component RubyGems · Affected: 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. It has a 0.7% probability of exploitation within 30 days (EPSS score). 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 the impact is limited.

EPSS Score (30-day exploit probability)
0.66%
EPSS percentile: 46.3

This is a below-median EPSS score — only 46.3% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.

Also Known As

GHSA-wf2x-8w6j-qw37

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my Gemfile.lock