CVE-2022-24722: View component Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-cm9w-c4rj-r2cf
CVSS 8.1
CWE-79
Published
Advisory Summary

CVE-2022-24722 is a HIGH (CVSS 8.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting View component libraries in the RubyGems ecosystem. The issue involves improper neutralization of input during web page generation ('cross-site scripting') in view_component. Remediation is available by upgrading affected packages to version 2.31.2, 2.49.1.

CVE-2022-24722 at a Glance

CVE Identifier CVE-2022-24722
GHSA Identifier GHSA-cm9w-c4rj-r2cf
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product View component
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2022-24722

To remediate this vulnerability, upgrade all affected View component dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

view_component fixed: 2.31.2
Upgrade view_component to 2.31.2
view_component fixed: 2.49.1
Upgrade view_component to 2.49.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for view_component

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-24722, inspect your project dependencies for View component:

inspect dependencies for view_component

Analyze the terminal output to locate any version of View component in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.31.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In View component, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

This is an XSS 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.29.1 and 2.49.1 have been released and fully mitigate the vulnerability. Avoid passing user input to the `translate` function, or sanitize the inputs before passing them. ### For more information If you have any questions or comments about this advisory: * Open an issue in the [github/view_component](http://github.com/github/view_component) project

CVE-2022-24722 Affected View component Versions

2 component(s)
Fixed Versions:
2.31.22.49.1
Product / Package Ecosystem Affected Versions Fixed Version
view_component
RubyGems
≥ 2.31.0
< 2.31.2
2.31.2
view_component
RubyGems
≥ 2.32.0
< 2.49.1
2.49.1

References

Frequently Asked Questions

What is CVE-2022-24722?
CVE-2022-24722 is a security vulnerability in View component involving Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in view_component under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which View component versions are affected?
Affected versions include releases prior to 2.31.2, 2.49.1 across affected packages: view_component.
What version fixes CVE-2022-24722?
Upgrading to 2.31.2, 2.49.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is view_component affected?
Yes, view_component is affected in releases prior to 2.31.2, 2.49.1. Upgrade your dependency to 2.31.2, 2.49.1 or later.
What is the CVSS score of CVE-2022-24722?
CVE-2022-24722 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2022-24722?
CVE-2022-24722 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check RubyGems dependencies for CVE-2022-24722?
Run the dependency tree command: 'inspect dependencies for view_component'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-cm9w-c4rj-r2cf",
  "modified" : "2022-03-11T20:08:41Z",
  "published" : "2022-03-02T22:24:05Z",
  "aliases" : [ "CVE-2022-24722" ],
  "summary" : "Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in view_component",
  "details" : "This is an XSS 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.\n\nVersions 2.29.1 and 2.49.1 have been released and fully mitigate the vulnerability.\n\nAvoid passing user input to the `translate` function, or sanitize the inputs before passing them.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in the [github/view_component](http://github.com/github/view_component) project\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "view_component"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.31.0"
      }, {
        "fixed" : "2.31.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "view_component"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.32.0"
      }, {
        "fixed" : "2.49.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/github/view_component/security/advisories/GHSA-cm9w-c4rj-r2cf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24722"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/view_component/commit/3f82a6e62578ff6f361aba24a1feb2caccf83ff9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/view_component"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/view_component/releases/tag/v2.31.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/view_component/releases/tag/v2.49.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/view_component/CVE-2022-24722.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-02T22:24:05Z",
    "nvd_published_at" : "2022-03-02T23:15:00Z"
  }
}