CVE-2023-22727: CakePHP Database\\Query::offset() and limit() methods are vulnerable to SQL injection

Published Jan 17, 2023
·
Updated

Impact

The Cake\Database\Query::limit() and Cake\Database\Query::offset() methods are vulnerable to SQL injection if passed un-sanitized user request data.

Patches This issue has been fixed in 4.2.12, 4.3.11, 4.4.10

Workarounds

Using CakePHP's Pagination library will mitigate this issue, as will validating or casting parameters to these methods.

References

https://bakery.cakephp.org/2023/01/06/cakephp421143114410released.html

Other sources

CakePHP Database\\Query::offset() and limit() methods are vulnerable to SQL injection

— Packagist

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.

Affected Software

18 affected componentsFixes available
CakePHP CakePHP>=4.2.0<4.2.12
CakePHP CakePHP>=4.3.0<4.3.11
CakePHP CakePHP>=4.4.0<4.4.10
composer/cakephp/database>=4.4.0, <4.4.10
4.4.10
composer/cakephp/database>=4.3.0, <4.3.11
4.3.11
composer/cakephp/database>=4.2.0, <4.2.12
4.2.12
composer/cakephp/cakephp>=4.4.0, <4.4.10
4.4.10
composer/cakephp/cakephp>=4.3.0, <4.3.11
4.3.11
composer/cakephp/cakephp>=4.2.0, <4.2.12
4.2.12
composer/cakephp/database>=4.4.0<4.4.10
4.4.10
composer/cakephp/database>=4.3.0<4.3.11
4.3.11
composer/cakephp/database>=4.2.0<4.2.12
4.2.12
composer/cakephp/cakephp>=4.4.0<4.4.10
4.4.10
composer/cakephp/cakephp>=4.3.0<4.3.11
4.3.11
composer/cakephp/cakephp>=4.2.0<4.2.12
4.2.12
ubuntu/cakephp*
ubuntu/cakephp*
ubuntu/cakephp*

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/cakephp/database to a version that resolves this vulnerability.

    Fixed in 4.4.10
  2. Upgrade

    Upgrade composer/cakephp/database to a version that resolves this vulnerability.

    Fixed in 4.3.11
  3. Upgrade

    Upgrade composer/cakephp/database to a version that resolves this vulnerability.

    Fixed in 4.2.12
  4. Upgrade

    Upgrade composer/cakephp/cakephp to a version that resolves this vulnerability.

    Fixed in 4.4.10
  5. Upgrade

    Upgrade composer/cakephp/cakephp to a version that resolves this vulnerability.

    Fixed in 4.3.11
  6. Upgrade

    Upgrade composer/cakephp/cakephp to a version that resolves this vulnerability.

    Fixed in 4.2.12
  7. Upgrade

    Upgrade CakePHP to a version that resolves this vulnerability.

    Fixed in 4.2.12
  8. Upgrade

    Upgrade CakePHP to a version that resolves this vulnerability.

    Fixed in 4.3.11
  9. Upgrade

    Upgrade CakePHP to a version that resolves this vulnerability.

    Fixed in 4.4.10
  10. Compensating control

    If unable to upgrade, use CakePHP's Pagination library, or validate or cast all user-supplied parameters before passing them to Cake\Database\Query::limit() and Cake\Database\Query::offset().

Event History

Jan 17, 2023
CVE Published
via MITRE·08:41 PM
Data Sourced
via MITRE·08:41 PM
DescriptionSeverityWeakness
Data Sourced
via OSV·09:15 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·09:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jan 20, 2023
Advisory Published
via GitHub·05:30 PM
Data Sourced
via GitHub·05:30 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·05:30 PM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2023-22727?

CVE-2023-22727 has a severity level classified as high due to its potential for SQL injection attacks.

2

How do I fix CVE-2023-22727?

To fix CVE-2023-22727, update CakePHP to version 4.2.12, 4.3.11, or 4.4.10 or later.

3

Which versions of CakePHP are affected by CVE-2023-22727?

Affected versions of CakePHP are those prior to 4.2.12, 4.3.11, and 4.4.10.

4

What is the primary vulnerability of CVE-2023-22727?

The primary vulnerability of CVE-2023-22727 is an SQL injection flaw in the limit() and offset() methods.

5

Who is impacted by CVE-2023-22727?

Any application using the affected versions of CakePHP that processes unsanitized user input may be impacted by CVE-2023-22727.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203