CVE-2023-22727: CakePHP Database\\Query::offset() and limit() methods are vulnerable to SQL injection
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
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/cakephp/databaseto a version that resolves this vulnerability.Fixed in 4.4.10 - Upgrade
Upgrade
composer/cakephp/databaseto a version that resolves this vulnerability.Fixed in 4.3.11 - Upgrade
Upgrade
composer/cakephp/databaseto a version that resolves this vulnerability.Fixed in 4.2.12 - Upgrade
Upgrade
composer/cakephp/cakephpto a version that resolves this vulnerability.Fixed in 4.4.10 - Upgrade
Upgrade
composer/cakephp/cakephpto a version that resolves this vulnerability.Fixed in 4.3.11 - Upgrade
Upgrade
composer/cakephp/cakephpto a version that resolves this vulnerability.Fixed in 4.2.12 - Upgrade
Upgrade
CakePHPto a version that resolves this vulnerability.Fixed in 4.2.12 - Upgrade
Upgrade
CakePHPto a version that resolves this vulnerability.Fixed in 4.3.11 - Upgrade
Upgrade
CakePHPto a version that resolves this vulnerability.Fixed in 4.4.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
Frequently Asked Questions
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.
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.
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.
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.
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.