CVE-2024-21636 — Vulnerability in view_component — CVE Details
view_component Cross-site Scripting vulnerability
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.
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.
gem install view_component -v 3.9.0
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).
| Package | Fixed 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-79Cross-site Scripting (XSS)MITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.1 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
References
- https://github.com/ViewComponent/view_component/security/advisories/GHSA-wf2x-8w6j-qw37WEB
- https://nvd.nist.gov/vuln/detail/CVE-2024-21636ADVISORY
- https://github.com/ViewComponent/view_component/pull/1950WEB
- https://github.com/ViewComponent/view_component/pull/1962WEB
- https://github.com/ViewComponent/view_component/commit/0d26944a8d2730ea40e60eae23d70684483e5017WEB
- https://github.com/ViewComponent/view_component/commit/c43d8bafa7117cbce479669a423ab266de150697WEB
- https://github.com/ViewComponent/view_componentPACKAGE
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/view_component/CVE-2024-21636.ymlWEB
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
Exploitation requires specific conditions, or the impact is limited.
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
Related CVEs
- CVE-2026-54498HIGH
ViewComponent: around_render HTML-Safety Bypass
- CVE-2022-24722HIGH
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in view_component
- CVE-2026-128084MEDIUM
sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
- CVE-2026-44836MEDIUM
view_component: Preview Route Can Dispatch Inherited Helper Methods
- CVE-2026-54497MEDIUM
ViewComponent: Reused Component Instances Retain Stale Render Context
- CVE-2026-115472MEDIUM
Doorkeeper: When using public clients, any client can revoke any access token
- CVE-2026-44837MEDIUM
view_component: System Test Entry Point Path Check Allows Sibling Directory Escape