CakePHP: Multiple methods in FunctionsBuilder vulnerable to SQL injectionGHSA-vjqc-q4mp-2rvf
Fix: cakephp/cakephp#19528GHSA-vjqc-q4mp-2rvf is a SQL Injection vulnerability in cakephp/database. A fix is available for cakephp/database — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- A successful exploit gives an attacker total control of the affected component, not partial access.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-vjqc-q4mp-2rvf.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
cakephp/database🐘cakephp/database🐘cakephp/database🐘cakephp/database🐘cakephp/database🐘cakephp/cakephp🐘cakephp/cakephp🐘cakephp/cakephp+2 moreReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
CakePHP is a rapid development framework for PHP. Prior to 4.5.12, 4.6.5, 5.1.9, 5.2.14, and 5.3.7, FunctionsBuilder::cast, FunctionsBuilder::extract, FunctionsBuilder::datePart, and FunctionsBuilder::dateAdd in src/Database/FunctionsBuilder.php accept user-controlled dataType, part, or unit values and incorporate them into generated SQL as unescaped structural fragments. An application that passes untrusted input to these parameters can permit SQL injection with confidentiality, integrity, and availability impact according to the database connection's privileges. This issue is fixed in versions 4.5.12, 4.6.5, 5.1.9, 5.2.14, and 5.3.7.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | cakephp/database | ≥ 3.0.0&&< 4.5.12 | 4.5.12composer require cakephp/database:^4.5.12 |
| 🐘Packagist | cakephp/database | ≥ 4.6.0&&< 4.6.5 | 4.6.5composer require cakephp/database:^4.6.5 |
| 🐘Packagist | cakephp/database | ≥ 5.0.0&&< 5.1.9 | 5.1.9composer require cakephp/database:^5.1.9 |
| 🐘Packagist | cakephp/database | ≥ 5.2.0&&< 5.2.14 | 5.2.14composer require cakephp/database:^5.2.14 |
| 🐘Packagist | cakephp/database | ≥ 5.3.0&&< 5.3.7 | 5.3.7composer require cakephp/database:^5.3.7 |
| 🐘Packagist | cakephp/cakephp | all versions | 4.5.12composer require cakephp/cakephp:^4.5.12 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for cakephp/database, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update cakephp/database to 4.5.12 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-vjqc-q4mp-2rvf is resolved across your whole dependency graph.
Workarounds
Until you can upgrade, make sure every query built from user input uses parameterised statements or a prepared-statement API rather than string concatenation, and reduce the database account's privileges so an injected query cannot read or alter data beyond what the feature needs.
Frequently Asked Questions
Is GHSA-vjqc-q4mp-2rvf in your dependencies?
Find it across Packagist, including transitive dependencies.