# CVE-2022-24722: Cross-site Scripting in view_component

- Severity: High 8.1 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.09%, higher than 66% of CVEs (2026-12-02)
- Published: 2022-03-02T22:24:05.000Z
- Modified: 2026-06-17T04:32:22.350Z
- Also known as: GHSA-cm9w-c4rj-r2cf
- Weaknesses: CWE-79
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact total
- Assigned by: GitHub_M

## Description

VIewComponent is a framework for building view components in Ruby on Rails. Versions prior to 2.31.2 and 2.49.1 contain a cross-site scripting vulnerability that has the potential to impact anyone using translations with the view_component gem. Data received via user input and passed as an interpolation argument to the `translate` method is not properly sanitized before display. Versions 2.31.2 and 2.49.1 have been released and fully mitigate the vulnerability. As a workaround, avoid passing user input to the `translate` function, or sanitize the inputs before passing them.

(As written by CVE List.)

## Affected

- github view_component: >= 2.31.0, < 2.31.2; >= 2.32.0, < 2.49.1
- view_component (RubyGems): from 2.31.0 before 2.31.2; from 2.32.0 before 2.49.1
- github viewcomponent: from 2.31.0 before 2.31.2; from 2.32.0 before 2.49.1

## Every score

- GitHub_M: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N`
- GitHub: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N`
- NVD: CVSS:3.1 6.1 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`
- NVD: CVSS:2.0 4.3 Medium `AV:N/AC:M/Au:N/C:N/I:P/A:N`

## References

- <https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf> (third-party-advisory, web)
- <https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9> (patch, third-party-advisory, web)
- <https://github.com/github/view_component/releases/tag/v2.31.2> (third-party-advisory, web)
- <https://github.com/github/view_component/releases/tag/v2.49.1> (third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-24722> (advisory)
- <https://github.com/github/view_component> (web)
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/view_component/CVE-2022-24722.yml> (web)

## Sources

- CVE List: [CVE-2022-24722](https://www.cve.org/CVERecord?id=CVE-2022-24722), CVE Terms of Use, modified 2025-04-23
- GitHub Advisory Database: [GHSA-cm9w-c4rj-r2cf](https://github.com/advisories/GHSA-cm9w-c4rj-r2cf), CC-BY-4.0, modified 2024-02-16
- NVD: [CVE-2022-24722](https://nvd.nist.gov/vuln/detail/CVE-2022-24722), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-24722 · Whole record: https://cve.day/CVE-2022-24722.json · Rebuilt by cve.day 2026-11-25T22:58:09.890Z
