Summary
CVE-2026-79752 is a critical SQL injection vulnerability in CakePHP, a PHP web application framework. The flaw resides in the FunctionsBuilder class of CakePHP’s database layer, where several query-building methods incorporate user-controlled values directly into generated SQL as unescaped structural fragments rather than as properly parameterized data. The issue carries a CVSS score of 9.2 (Critical) and can be exploited remotely without authentication if an application passes untrusted input to the affected methods.
Technical details
- Root cause:
FunctionsBuilder::cast(),FunctionsBuilder::extract(),FunctionsBuilder::datePart(), andFunctionsBuilder::dateAdd()insrc/Database/FunctionsBuilder.phpacceptdataType,part, orunitparameters and embed them directly into the generated SQL as structural (non-escaped) fragments instead of safely bound values. - Trigger conditions: An application must pass user-controlled or externally influenced input into one of these method parameters (for example, via a query builder call that forwards request data into
cast,extract,datePart, ordateAdd). - Attack vector: Network — no authentication or special privileges are required to exploit the flaw in an application that exposes the vulnerable code path.
- Impact: Successful exploitation allows an attacker to inject arbitrary SQL, potentially enabling unauthorized reading, modification, or deletion of data in the underlying database, and full compromise of confidentiality, integrity, and availability of the affected data store.
Affected software
- CakePHP (
cakephp/cakephp) andcakephp/database:- Versions prior to 4.5.12
- 4.6.0 through 4.6.4
- 5.0.0 through 5.1.8
- 5.2.0 through 5.2.13
- 5.3.0 through 5.3.6
Severity
- CVSS v4.0 Base Score: 9.2 (Critical)
- Vector:
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Mitigation and recommended actions
- Immediate: Upgrade CakePHP to one of the fixed releases: 4.5.12, 4.6.5, 5.1.9, 5.2.14, or 5.3.7 (or later), depending on the branch in use.
- If a patch cannot be applied immediately:
- Audit application code for any use of
FunctionsBuilder::cast(),extract(),datePart(), ordateAdd()and ensuredataType,part, andunitvalues are never derived from user-controlled or externally influenced input. - Restrict or remove use of these methods where untrusted input reaches them until the framework can be upgraded.
- Apply strict input validation/allow-listing on any values that flow into these parameters as a temporary compensating control.
- Audit application code for any use of

