Vulnerabilities in pkg:gem/update_by_case

PACKAGE
Advisory Identifier: GHSA-33wh-w4m7-c6r8
Advisory Summary

CVE-2022-35956 is a MODERATE (CVSS 5.8) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Update by case libraries in the RubyGems ecosystem. The issue involves update_by_case before 0.1.3 can be vulnerable to sql injection. Remediation is available by upgrading affected packages to version 0.1.3.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/update_by_case

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/update_by_case. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-33wh-w4m7-c6r8 CVE-2022-35956 MODERATE update_by_case before 0.1.3 can be vulnerable to sql injection

CVE-2022-35956 at a Glance

CVE Identifier CVE-2022-35956
GHSA Identifier GHSA-33wh-w4m7-c6r8
Severity MODERATE
CVSS v3.1 Base Score 5.8
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Update by case
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 5.8

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

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

How to Fix CVE-2022-35956

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

update_by_case fixed: 0.1.3
Upgrade update_by_case to 0.1.3
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 update_by_case

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-35956, inspect your project dependencies for Update by case:

inspect dependencies for update_by_case

Analyze the terminal output to locate any version of Update by case in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.1.3), 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-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Update by case, 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

Before version 0.1.3 `update_by_case` gem used custom sql strings, and it was not sanitized, making it vulnerable to sql injection. Upgrade to version >= 0.1.3 that uses `Arel` instead to construct the resulting sql statement, with sanitized sql.

CVE-2022-35956 Affected Update by case Versions

1 component(s)
Fixed Versions:
0.1.3
Product / Package Ecosystem Affected Versions Fixed Version
update_by_case
RubyGems
< 0.1.3
0.1.3

References

Frequently Asked Questions

What is CVE-2022-35956?
CVE-2022-35956 is a security vulnerability in Update by case involving update_by_case before 0.1.3 can be vulnerable to sql injection under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Update by case versions are affected?
Affected versions include releases prior to 0.1.3 across affected packages: update_by_case.
What version fixes CVE-2022-35956?
Upgrading to 0.1.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is update_by_case affected?
Yes, update_by_case is affected in releases prior to 0.1.3. Upgrade your dependency to 0.1.3 or later.
What is the CVSS score of CVE-2022-35956?
CVE-2022-35956 has a CVSS v3.1 base score of 5.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L.
What CWE is associated with CVE-2022-35956?
CVE-2022-35956 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check RubyGems dependencies for CVE-2022-35956?
Run the dependency tree command: 'inspect dependencies for update_by_case'. 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-33wh-w4m7-c6r8",
  "modified" : "2022-08-15T20:00:28Z",
  "published" : "2022-08-11T21:18:31Z",
  "aliases" : [ "CVE-2022-35956" ],
  "summary" : "update_by_case before 0.1.3 can be vulnerable to sql injection",
  "details" : "Before version 0.1.3 `update_by_case` gem used custom sql strings, and it was not sanitized, making it vulnerable to sql injection. Upgrade to version >= 0.1.3 that uses `Arel` instead to construct the resulting sql statement, with sanitized sql.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "update_by_case"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/camilova/activerecord-update-by-case/security/advisories/GHSA-33wh-w4m7-c6r8"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-35956"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/camilova/activerecord-update-by-case"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/camilova/activerecord-update-by-case/releases/tag/v0.1.3-stable"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/update_by_case/CVE-2022-35956.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-08-11T21:18:31Z",
    "nvd_published_at" : "2022-08-12T21:15:00Z"
  }
}