{"id":"CVE-2024-21636","published":"2024-01-04T20:09:08Z","modified":"2025-06-17T20:29:11Z","title":"view_component Cross-site Scripting vulnerability","vendor":"ViewComponent","product":"view_component","tier":"tail","description":{"text":"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`.","provenance":"source","from":"CVE.org"},"cvss":{"score":6.1,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00495,"percentile":0.43418,"provenance":"source"},"cwes":[{"id":"CWE-79","name":"Improper Neutralization of Input During Web Page Generation"}],"references":[{"url":"https://github.com/ViewComponent/view_component/security/advisories/GHSA-wf2x-8w6j-qw37","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/ViewComponent/view_component/pull/1950","tags":["x_refsource_MISC"]},{"url":"https://github.com/ViewComponent/view_component/pull/1962","tags":["x_refsource_MISC"]},{"url":"https://github.com/ViewComponent/view_component/commit/0d26944a8d2730ea40e60eae23d70684483e5017","tags":["x_refsource_MISC"]},{"url":"https://github.com/ViewComponent/view_component/commit/c43d8bafa7117cbce479669a423ab266de150697","tags":["x_refsource_MISC"]}],"priority":{"score":13.0,"factors":[{"name":"EPSS percentile","points":8.68},{"name":"CVSS severity","points":4.27}]},"vendorSlug":"viewcomponent","affectedVersions":[{"vendor":"ViewComponent","product":"view_component","versions":[">= 3.0.0, < 3.9.0","< 2.83.0"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-01-09T21:13:15.952519Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"RubyGems","package":"view_component","vulnerableRanges":[">=3.0.0, <3.9.0","<2.83.0"],"patched":["3.9.0","2.83.0"],"from":["GHSA-wf2x-8w6j-qw37"],"provenance":"source"}],"summary":{"text":"The view_component Ruby on Rails gem, a framework for building reusable view components, has a cross-site scripting flaw in versions before 3.9.0 and 2.83.0, where the unsanitized return values of a component's #call method (for components that define #call rather than a sidecar template) and of #output_postamble can carry user-defined content into rendered output. An attacker can exploit this over the network without authentication, but only if a victim user interacts with the crafted content, and only when a component is rendered directly from a controller.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:47:36Z"},"euvd":{"id":"EUVD-2024-0446","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-viewcomponent-view-component-cve-2024-21636","children":[{"from":"CVE-2024-21636","to":"CVE-2026-54497","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["lib/view_component/base.rb"],"commits":["https://github.com/ViewComponent/view_component/commit/0d26944a8d2730ea40e60eae23d70684483e5017","https://github.com/ViewComponent/view_component/commit/c43d8bafa7117cbce479669a423ab266de150697","https://github.com/ViewComponent/view_component/commit/6796b2e89d0bd7b9d7d763a86275e5334731dd61","https://github.com/ViewComponent/view_component/commit/7b05073be28037f7d5ff141e9dd42f3cf47956a4"],"basis":"shared function","functions":["render_in"]}]},{"from":"CVE-2024-21636","to":"CVE-2026-54498","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["lib/view_component/base.rb"],"commits":["https://github.com/ViewComponent/view_component/commit/0d26944a8d2730ea40e60eae23d70684483e5017","https://github.com/ViewComponent/view_component/commit/c43d8bafa7117cbce479669a423ab266de150697","https://github.com/ViewComponent/view_component/commit/6796b2e89d0bd7b9d7d763a86275e5334731dd61","https://github.com/ViewComponent/view_component/commit/48e5fd2d602344c7d33019fbc5c8b087e315bb78"],"basis":"shared function","functions":["render_in"]}]}],"packageHistory":[{"cve":"CVE-2022-24722","published":"2022-03-02","fixed":"2.49.1","kev":false,"link":{"from":"CVE-2022-24722","to":"CVE-2024-21636","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"RubyGems:view_component","fromFixed":"2.49.1","toFixed":"2.83.0","daysApart":673}]}},{"cve":"CVE-2024-21636","published":"2024-01-04","fixed":"3.9.0","kev":false},{"cve":"CVE-2026-44836","published":"2026-05-26","fixed":"4.9.0","kev":false},{"cve":"CVE-2026-44837","published":"2026-05-26","fixed":"4.9.0","kev":false},{"cve":"CVE-2026-54497","published":"2026-07-17","fixed":"4.12.0","kev":false}],"package":"RubyGems:view_component"}}