{"answers":{"affected":"4 open source packages ship an affected version, including view_component. It affects 1 product.","exploited":"There is no known exploitation of CVE-2024-21636 in the wild and no public exploit code.","fix":"Upgrade view_component to a fixed version for your release line: 2.83.0 or 3.9.0.","what":"CVE-2024-21636 is a medium-severity cross-site scripting vulnerability in ViewComponent view_component, published on 4 Jan 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2024-21636 and fix it if it is affected.\n\nWhat it is: CVE-2024-21636 is a medium-severity cross-site scripting vulnerability in ViewComponent view_component, published on 4 Jan 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2024-21636 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- view_component (RubyGems): affected all versions; fixed in 2.83.0\n- view_component (RubyGems): affected all versions; fixed in 2.83.0\n- view_component (RubyGems): affected from 3.0.0; fixed in 3.9.0\n- view_component (RubyGems): affected from 3.0.0; fixed in 3.9.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2024-21636/ (Markdown: https://insights.sbomify.com/CVE-2024-21636/index.md)","id":"CVE-2024-21636","markdown":"https://insights.sbomify.com/CVE-2024-21636/index.md","name":"CVE-2024-21636","record":{"aliases":["GHSA-wf2x-8w6j-qw37"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"Ruby on Rails library","requires_auth":"none","summary":"Attackers can inject malicious scripts via unsanitized component output in view_component, affecting applications rendering components directly from controllers.","user_interaction":"required","vuln_class":"xss"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"view_component","vendor":"viewcomponent"}],"cvss":{"score":6.1,"severity":"medium","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","version":"3.1"},"cwes":[{"id":"CWE-79","name":"Improper Neutralization of Input During Web Page Generation"}],"description":"view_component is a framework for building reusable, testable, and encapsulated view components in Ruby on Rails. Versions prior to 3.9.0 and 2.83.0 have a cross-site scripting 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` methodis not sanitized, which can also lead to cross-site scripting issues. Versions 3.9.0 and 2.83.0 have been released and fully mitigate both the `#call` and the `#output_postamble` vulnerabilities. As a workaround, sanitize the return value of `#call`.","ecosystems":["RubyGems"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"view_component Cross-site Scripting vulnerability","id":"CVE-2024-21636","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"RubyGems","product":null,"products":[],"type":"xss","year":"2024"},"n_packages":4,"n_references":5,"next":{"headline":"XSS in Authentik via JavaScript-URI as Redirect URI and form_post Response Mode","id":"CVE-2024-21637"},"packages":[{"ecosystem":"RubyGems","fixed":["2.83.0"],"introduced":["0"],"last_affected":[],"package":"view_component","purl":null,"source":"GHSA-wf2x-8w6j-qw37"},{"ecosystem":"RubyGems","fixed":["2.83.0"],"introduced":["0"],"last_affected":[],"package":"view_component","purl":"pkg:gem/view_component","source":"GHSA-wf2x-8w6j-qw37"},{"ecosystem":"RubyGems","fixed":["3.9.0"],"introduced":["3.0.0"],"last_affected":[],"package":"view_component","purl":null,"source":"GHSA-wf2x-8w6j-qw37"},{"ecosystem":"RubyGems","fixed":["3.9.0"],"introduced":["3.0.0"],"last_affected":[],"package":"view_component","purl":"pkg:gem/view_component","source":"GHSA-wf2x-8w6j-qw37"}],"prev":{"headline":"Memos Access Tokens Stay Valid after User Password Change","id":"CVE-2024-21635"},"products":["view_component"],"published":"2024-01-04","related":[{"cvss_score":8.7,"headline":"view_component: around_render HTML-Safety Bypass","id":"CVE-2026-54498","kev_date_added":null,"published":"2026-07-17"},{"cvss_score":6.8,"headline":"view_component: Reused Component Instances Retain Stale Render Context","id":"CVE-2026-54497","kev_date_added":null,"published":"2026-07-17"},{"cvss_score":5.9,"headline":"view_component: System Test Entry Point Path Check Allows Sibling Directory Escape","id":"CVE-2026-44837","kev_date_added":null,"published":"2026-05-26"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2025-06-17","vendors":["ViewComponent"]},"summary":"Attackers can inject malicious scripts via unsanitized component output in view_component, affecting applications rendering components directly from controllers.","url":"https://insights.sbomify.com/CVE-2024-21636/"}