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.
Source excerpt · OSVAffected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
| Affected range | Recorded fix |
|---|---|
| From 4.2.0 before 4.2.12Ecosystem versions | 4.2.12 |
| From 4.3.0 before 4.3.11Ecosystem versions | 4.3.11 |
| From 4.4.0 before 4.4.10Ecosystem versions | 4.4.10 |
Version evidence: OSV · GHSA-6g8q-qfpv-57wp
View original version evidence (33 explicit versions)
| Affected range | Recorded fix |
|---|---|
| From 4.2.0 before 4.2.12Ecosystem versions | 4.2.12 |
| From 4.3.0 before 4.3.11Ecosystem versions | 4.3.11 |
| From 4.4.0 before 4.4.10Ecosystem versions | 4.4.10 |
Version evidence: OSV · GHSA-6g8q-qfpv-57wp
View original version evidence (33 explicit versions)
Original source description
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/cakephp_4211_4311_4410_released.html
References
- Security advisory github.com/cakephp/cakephp/security/advisories/GHSA-6g8q-qfpv-57wp
- Security advisory nvd.nist.gov/vuln/detail/CVE-2023-22727
- Patch github.com/cakephp/cakephp/commit/3f463e7084b5a15e67205ced3a622577cca7a239
- Source reference bakery.cakephp.org/2023/01/06/cakephp_4211_4311_4410_released.html
- Source reference github.com/cakephp/cakephp