CVE-2023-22794 json
SQL Injection Vulnerability via ActiveRecord comments
published 2023-01-18 3 y ago modified 2026-10-23 16 d ago also GHSA-hq7p-j377-6v63 , EUVD-2023-0490
- cvss
- 8.8
- version 3.1, NVD
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 2.2%
- EPSS 2.2% chance of exploitation in 30 days, percentile 82%
- public exploits
- 0
- none known
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.
Patch / fix
- rubygems activerecord 6.0.6.1, 6.1.7.1, 7.0.4.1
- activerecord_project activerecord 6.0.6.1, 6.1.7.1, 7.0.4.1
- rails Debian 14, Debian 13, Debian 12 2:6.1.7.3+dfsg-1
debian advisories DEBIAN-CVE-2023-22794
- foreman satellite utils 6.14, satellite capsule 6.14, satellite 6.14 3.7.0.9-1.el8sat
- foreman-cli satellite utils 6.14, satellite 6.14 3.7.0.9-1.el8sat
- foreman-ec2 satellite 6.14 3.7.0.9-1.el8sat
- rubygem-git satellite 6.14 1.18.0-1.el8sat
- puppet-agent satellite capsule 6.14, satellite 6.14 7.26.0-3.el8sat
- puppetserver satellite capsule 6.14, satellite 6.14 7.11.0-1.el8sat
- rubygem-rack satellite capsule 6.14, satellite 6.14 2.2.7-1.el8sat
- foreman-ovirt satellite 6.14 3.7.0.9-1.el8sat
red hat advisories RHSA-2023:6818
- rubygem-activerecord-7.0 openSUSE Tumbleweed 7.0.8.6-1.3
- rubygem-activerecord-7.0 openSUSE Tumbleweed 7.0.8.4-1.1
- rubygem-activerecord-7.0 openSUSE Tumbleweed 7.0.4.1-1.1
opensuse advisories openSUSE-SU-2025:15112-1openSUSE-SU-2024:14069-1openSUSE-SU-2024:12766-1
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2023-22794 updated cvss 7.4
rubygem-activerecord: SQL Injection
-
Red Hat Satellite 6.14 for RHEL 8 rubygem-activerecord 6.1.7.3-1.el8satfixed: vendor fix RHSA-2023:6818
-
Red Hat Satellite 6.14 for RHEL 8 cjson 1.7.14-5.el8sat, katello 4.9.0-1.el8sat, libsolv 0.7.22-4.el8pc, libcomps 0.1.18-4.el8pc, python-idna 3.3-2.el8pc, candlepin 4.3.1-1.el8sat, +668 morenot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
Exploit prediction
2.15% chance of exploitation in the next 30 days, higher than 82% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- discuss.rubyonrails.org https://discuss.rubyonrails.org/t/cve-2023-22794-sql-injection-vulnerability-via-activerecord-comments/82117 referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| NVD | 3.1 | 8.8 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 3.1 | 8.8 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| rubygems | activerecord | >=6.0.0, <6.0.6.1 >=6.1.0, <6.1.7.1 >=7.0.0, <7.0.4.1 |
6.0.6.1 6.1.7.1 7.0.4.1 |
Affected products
- n/a https://github.com/rails/rails
Classification
- Weakness
-
- CWE-89 Improper Neutralization of Special Elements used in an SQL Command
- Technology feeds
References
-
discuss.rubyonrails.org
/t/cve-2023-22794-sql-injection-vulnerability-via-activerecord-comments/82117
web, exploit, patch, vendor-advisory
-
github.com
/rails/rails/commit/d7aba06953f9fa789c411676b941d20df8ef73de
web
-
debian.org
/security/2023/dsa-5372
vendor-advisory, web
- security.netapp.com /advisory/ntap-20240202-0008/
-
nvd.nist.gov
/vuln/detail/CVE-2023-22794
advisory
-
github.com
/rails/rails
package
-
github.com
/rails/rails/releases/tag/v7.0.4.1
web
-
github.com
/rubysec/ruby-advisory-db/blob/master/gems/activerecord/CVE-2023-22794.yml
web
-
security.netapp.com
/advisory/ntap-20240202-0008
web
Sources
- CVE List CVE-2023-22794
- GitHub Advisory GHSA-hq7p-j377-6v63
- NVD CVE-2023-22794
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.