{"id":"CVE-2023-22794","details":"A vulnerability in ActiveRecord \u003c6.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.","aliases":["GHSA-hq7p-j377-6v63"],"modified":"2026-05-18T05:56:27.180139029Z","published":"2023-02-09T00:00:00Z","related":["openSUSE-SU-2024:12766-1","openSUSE-SU-2024:14069-1","openSUSE-SU-2025:15112-1"],"database_specific":{"cwe_ids":["CWE-89"],"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/22xxx/CVE-2023-22794.json","cna_assigner":"hackerone","unresolved_ranges":[{"source":"AFFECTED_FIELD","extracted_events":[{"last_affected":"6.0.6.1, 6.1.7.1, 7.0.4.1"}]}]},"references":[{"type":"WEB","url":"https://discuss.rubyonrails.org/t/cve-2023-22794-sql-injection-vulnerability-via-activerecord-comments/82117"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/22xxx/CVE-2023-22794.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-22794"},{"type":"ADVISORY","url":"https://security.netapp.com/advisory/ntap-20240202-0008/"},{"type":"ADVISORY","url":"https://www.debian.org/security/2023/dsa-5372"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/rails/rails","events":[{"introduced":"66cabeda2c46c582d19738e1318be8d59584cc5b"},{"fixed":"28bb76d3efc39b2ef663dfe2346f7c2621343cd6"},{"introduced":"914caca2d31bd753f47f9168f2a375921d9e91cc"},{"fixed":"c443466a99f8ed951605fb4993a01de5e41349a4"},{"introduced":"984c3ef2775781d47efa9f541ce570daa2434a80"},{"fixed":"23e0345fe900dfd7edd6e8e5a7a6bd54b2a7d2ed"}],"database_specific":{"source":"CPE_FIELD","extracted_events":[{"introduced":"6.0.0"},{"fixed":"6.0.6.1"},{"introduced":"6.1.0"},{"fixed":"6.1.7.1"},{"introduced":"7.0.0"},{"fixed":"7.0.4.1"}],"cpe":"cpe:2.3:a:activerecord_project:activerecord:*:*:*:*:*:ruby:*:*"}}],"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/osv-test-cve-osv-conversion/osv-output/CVE-2023-22794.json"}}],"schema_version":"1.7.5"}