Skip to content
Heist/ feed
Back to feed
Medium

update_by_case before 0.1.3 vulnerable to sql injection

Type: advisorySources: OSV

This Rails gem adds two methods to the ActiveRecord::Base class that allow you to update many records on a single database hit, using a case sql statement for it. 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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2022-35956
Confirmed fixed CVEs
Not specified
Updated in this feed
5 Nov 2026, 05:47 UTC · Revision 1

Source evidence

update_by_case before 0.1.3 vulnerable to sql injection

core-osv · Original source

Published 12 Aug 2022, 20:50 UTC

This Rails gem adds two methods to the ActiveRecord::Base class that allow you to update many records on a single database hit, using a case sql statement for it. 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.

osv:CVE-2022-35956
Complete source record
{
  "id": "e7d1ba29bc634a1e53ef0e65d3433a64ce56a16d573764eb51996e70f3d5eb9d",
  "url": "https://osv.dev/vulnerability/CVE-2022-35956",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "update_by_case before 0.1.3 vulnerable to sql injection",
    "summary": "This Rails gem adds two methods to the ActiveRecord::Base class that allow you to update many records on a single database hit, using a case sql statement for it. 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.",
    "evidence": "osv:CVE-2022-35956",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2022-35956",
      "aliases": [
        "CVE-2022-35956",
        "GHSA-33wh-w4m7-c6r8"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/camilova/activerecord-update-by-case",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "31c44b7837537121cc43cb2f896954fe115d1d06"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.1.3"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "range": [
                      {
                        "fixed": "31c44b7837537121cc43cb2f896954fe115d1d06"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "v0.1.3-stable"
                  },
                  {
                    "cpe": "cpe:2.3:a:update_by_case_project:update_by_case:*:*:*:*:*:ruby:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.1.3"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v0.1.2-stable"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-35956.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:42.991957366Z",
      "provider": "osv",
      "references": [
        "https://github.com/camilova/activerecord-update-by-case/releases/tag/v0.1.3-stable",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/35xxx/CVE-2022-35956.json",
        "https://github.com/camilova/activerecord-update-by-case/security/advisories/GHSA-33wh-w4m7-c6r8",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-35956"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-89"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/35xxx/CVE-2022-35956.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-35956",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 510824,
  "published_at": "2022-08-12T20:50:08+00:00"
}