CVE-2023-22794
HIGH 8.8CVSS 3.1SQL Injection Vulnerability via ActiveRecord comments
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.
- Published
- 9 Feb 2023
- Last modified
- 23 Oct 2026
- Assigned by
- support@hackerone.com
- NVD status
- Modified
- Weakness
- CWE-89
- Also known as
- GHSA-hq7p-j377-6v63
- Sources
- NVDJSONOSV GHSA-hq7p-j377-6v63JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | HIGH 8.8 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| OSV | GitHub | CVSS 3.1 | HIGH 8.8 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | activerecord_project | activerecordcpe:2.3:a:activerecord_project:activerecord:*:*:*:*:*:ruby:*:* |
>= 6.0.0, < 6.0.6.1 | 6.0.6.1 |
| NVD | activerecord_project | activerecordcpe:2.3:a:activerecord_project:activerecord:*:*:*:*:*:ruby:*:* |
>= 6.1.0, < 6.1.7.1 | 6.1.7.1 |
| NVD | activerecord_project | activerecordcpe:2.3:a:activerecord_project:activerecord:*:*:*:*:*:ruby:*:* |
>= 7.0.0, < 7.0.4.1 | 7.0.4.1 |
| OSV | RubyGems | activerecord | >= 6.0.0, < 6.0.6.1 | 6.0.6.1 |
| OSV | RubyGems | activerecord | >= 6.1.0, < 6.1.7.1 | 6.1.7.1 |
| OSV | RubyGems | activerecord | >= 7.0.0, < 7.0.4.1 | 7.0.4.1 |
References
- https://discuss.rubyonrails.org/t/cve-2023-22794-sql-injection-vulnerability-via-activerecord-comments/82117 · Exploit, Patch, Vendor Advisory, WEB
- https://security.netapp.com/advisory/ntap-20240202-0008/ · WEB
- https://www.debian.org/security/2023/dsa-5372 · WEB
- https://nvd.nist.gov/vuln/detail/CVE-2023-22794 · ADVISORY
- https://github.com/rails/rails/commit/d7aba06953f9fa789c411676b941d20df8ef73de · WEB
- https://github.com/rails/rails · PACKAGE
- https://github.com/rails/rails/releases/tag/v7.0.4.1 · WEB
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activerecord/CVE-2023-22794.yml · WEB
History
- 25 Nov 2026 20:35 UTC · NVD: first stored (published 9 Feb 2023)
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 18 Jan 2023)