Skip to content
Heist/ feed
Back to feed
Unrated

Security advisory

Type: advisorySources: OSVCVE: CVE-2023-22794

A vulnerability in ActiveRecord <6.0.6.1, v6.1.7.1 and v7.0.4.1 related to the sanitization of comments. If malicious user input is passed to either the `annotate` query method, the `optimizer_hints` query method, or through the QueryLogs interface which automatically adds annotations, it may be sent to the database withinsufficient sanitization and be able to inject SQL outside of the comment.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2023-22794
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 15:03 UTC · Revision 1

Source evidence

CVE-2023-22794

core-osv · Original source

Published 9 Feb 2023, 00:00 UTC

A vulnerability in ActiveRecord <6.0.6.1, v6.1.7.1 and v7.0.4.1 related to the sanitization of comments. If malicious user input is passed to either the `annotate` query method, the `optimizer_hints` query method, or through the QueryLogs interface which automatically adds annotations, it may be sent to the database withinsufficient sanitization and be able to inject SQL outside of the comment.

osv:CVE-2023-22794
Complete source record
{
  "id": "10c1541deeb2509e393bfcb83a876e57323df9b3471d04c3d7c1f89a1c469711",
  "url": "https://osv.dev/vulnerability/CVE-2023-22794",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2023-22794",
    "summary": "A vulnerability in ActiveRecord <6.0.6.1, v6.1.7.1 and v7.0.4.1 related to the sanitization of comments. If malicious user input is passed to either the `annotate` query method, the `optimizer_hints` query method, or through the QueryLogs interface which automatically adds annotations, it may be sent to the database withinsufficient sanitization and be able to inject SQL outside of the comment.",
    "evidence": "osv:CVE-2023-22794",
    "products": [],
    "severity": "unknown",
    "structured": {
      "id": "CVE-2023-22794",
      "aliases": [
        "CVE-2023-22794",
        "GHSA-hq7p-j377-6v63"
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/rails/rails",
              "type": "GIT",
              "events": [
                {
                  "introduced": "66cabeda2c46c582d19738e1318be8d59584cc5b"
                },
                {
                  "fixed": "28bb76d3efc39b2ef663dfe2346f7c2621343cd6"
                },
                {
                  "introduced": "914caca2d31bd753f47f9168f2a375921d9e91cc"
                },
                {
                  "fixed": "c443466a99f8ed951605fb4993a01de5e41349a4"
                },
                {
                  "introduced": "984c3ef2775781d47efa9f541ce570daa2434a80"
                },
                {
                  "fixed": "23e0345fe900dfd7edd6e8e5a7a6bd54b2a7d2ed"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:activerecord_project:activerecord:*:*:*:*:*:ruby:*:*",
                    "range": [
                      {
                        "introduced": "6.0.0"
                      },
                      {
                        "fixed": "6.0.6.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:activerecord_project:activerecord:*:*:*:*:*:ruby:*:*",
                    "range": [
                      {
                        "introduced": "6.1.0"
                      },
                      {
                        "fixed": "6.1.7.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:activerecord_project:activerecord:*:*:*:*:*:ruby:*:*",
                    "range": [
                      {
                        "introduced": "7.0.0"
                      },
                      {
                        "fixed": "7.0.4.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v6.0.6",
            "v6.1.7",
            "v7.0.4",
            "v7.0.3",
            "v6.0.5",
            "v6.1.5",
            "v7.0.2",
            "v7.0.1",
            "v7.0.0",
            "v6.0.4",
            "v6.1.4",
            "v6.1.3",
            "v6.1.2",
            "v6.1.1",
            "v6.1.0",
            "v6.0.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-22794.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:36.589571407Z",
      "provider": "osv",
      "references": [
        "https://discuss.rubyonrails.org/t/cve-2023-22794-sql-injection-vulnerability-via-activerecord-comments/82117",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/22xxx/CVE-2023-22794.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2023-22794",
        "https://security.netapp.com/advisory/ntap-20240202-0008/",
        "https://www.debian.org/security/2023/dsa-5372"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-89"
        ],
        "cna_assigner": "hackerone",
        "unresolved_ranges": [
          {
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "6.0.6.1, 6.1.7.1, 7.0.4.1"
                  },
                  {
                    "last_affected": "6.0.6.1, 6.1.7.1, 7.0.4.1"
                  }
                ],
                "source": "AFFECTED_FIELD",
                "strategy": "StandaloneSingleVersion"
              }
            ]
          }
        ],
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/22xxx/CVE-2023-22794.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2023-22794",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 503942,
  "published_at": "2023-02-09T00:00:00+00:00"
}