PatchClock

PHP security digest · 17 Sep 2026

CakePHP: Multiple methods in FunctionsBuilder vulnerable to SQL injection

Critical CVE-2026-79752

Packages
cakephp/database, cakephp/cakephp
Fixed in
4.5.12, 4.6.5, 5.1.9, 5.2.14, 5.3.7
Published
Thu 17 Sep 2026, 21:28 LisbonUpdated Sun 25 Oct 2026, 22:25 Lisbon
Installs on Packagist
29M

In plain words

An attacker can inject SQL if your application passes user-controlled data to certain parameters of CakePHP's FunctionsBuilder methods. The affected parameters are $dataType in cast(), $part in extract() and datePart(), and $unit in dateAdd().

Affected versions

PackageAffectedFixed in
cakephp/database>= 4.6.0, < 4.6.54.6.5
cakephp/database>= 5.0.0, < 5.1.95.1.9
cakephp/database>= 5.2.0, < 5.2.145.2.14
cakephp/database>= 5.3.0, < 5.3.75.3.7
cakephp/cakephp< 4.5.124.5.12
cakephp/cakephp>= 4.6.0, < 4.6.54.6.5
cakephp/cakephp>= 5.0.0, < 5.1.95.1.9
cakephp/cakephp>= 5.2.0, < 5.2.145.2.14
cakephp/cakephp>= 5.3.0, < 5.3.75.3.7
cakephp/database>= 3.0.0, < 4.5.124.5.12

Am I affected?

Check composer.lock for cakephp/database or cakephp/cakephp. Both are affected at >= 4.6.0, < 4.6.5, >= 5.0.0, < 5.1.9, >= 5.2.0, < 5.2.14 and >= 5.3.0, < 5.3.7. Earlier affected versions are >= 3.0.0, < 4.5.12 for cakephp/database and < 4.5.12 for cakephp/cakephp. If your version is affected, review calls to FunctionsBuilder::cast(), extract(), datePart() and dateAdd() to see whether user-controlled data can reach $dataType, $part or $unit, respectively.

What to do

Check which version you have, then update to a fixed release for your branch (4.5.12, 4.6.5, 5.1.9, 5.2.14, 5.3.7):

composer show cakephp/database | grep versions
composer update cakephp/database

If your version constraint in composer.json keeps you below a fixed release, raise it first. Whether your configuration is affected, and the exact version ranges, are in the advisory itself.

If you cannot update yet

Do not pass user-controlled data to $dataType in cast(), $part in extract() or datePart(), or $unit in dateAdd().

The advisory's description

Impact

The FunctionsBuilder::cast($field, $dataType), extract($part, $expr), datePart($part, $expr), dateAdd($expr, $value, $unit) methods are vulnerable to SQL injection if user controlled data is supplied to the ($dataType / $part / $unit) parameters.

Patches

5.3.7, 5.2.14, 5.1.9, 4.6.5, 4.5.12 contain fixes

Workarounds

Don't provide user controlled data to these functions/parameters.

Weakness: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'). Reported by unknownhad, mfn.

The advisory

From OSV.dev, which gathers the GitHub Advisory Database, FriendsOfPHP and Drupal security advisories; the summary is theirs. The description, affected versions, weakness and credits are from the GitHub Advisory Database (CC BY 4.0). "In plain words", "Am I affected?" and "If you cannot update yet" are based on that advisory, and checked to name no version it does not.