/

CVE-2026-119419

Severity:

HIGH RISK

(8.1)

SQL Injection (CWE-89) in CakePHP Collation Handling

CVE-2026-119419

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database Query Manipulation

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

CakePHP contains a SQL injection vulnerability in collation handling when unvalidated collation values are incorporated into SQL expressions. An attacker who can control a collation name passed to StringExpression or IdentifierExpression may append SQL after the COLLATE clause and influence database operations within the connection's privileges.

CakePHP contains a SQL injection vulnerability in collation handling when unvalidated collation values are incorporated into SQL expressions. An attacker who can control a collation name passed to StringExpression or IdentifierExpression may append SQL after the COLLATE clause and influence database operations within the connection's privileges.

Affected context

The issue affects CakePHP applications that construct StringExpression or IdentifierExpression objects with collation values influenced by untrusted input. It becomes risky when those values are passed to a constructor or setCollation() without allowlisting or context-aware validation before the resulting expression is compiled into a database query.

The issue affects CakePHP applications that construct StringExpression or IdentifierExpression objects with collation values influenced by untrusted input. It becomes risky when those values are passed to a constructor or setCollation() without allowlisting or context-aware validation before the resulting expression is compiled into a database query.

Exploit preconditions

  • Attack surface: Application code that builds database expressions from request-controlled or otherwise untrusted collation values
  • Required access: The ability to influence a collation name reaching the relevant expression API
  • Trigger point: SQL generation and execution involving the affected expression
  • Why exploitation is possible: The collation value may be inserted into the query after an unquoted COLLATE clause, allowing SQL syntax to be interpreted as part of the statement
  • Required authority: Database impact is limited by the privileges of the application's database connection
  • Attack surface: Application code that builds database expressions from request-controlled or otherwise untrusted collation values
  • Required access: The ability to influence a collation name reaching the relevant expression API
  • Trigger point: SQL generation and execution involving the affected expression
  • Why exploitation is possible: The collation value may be inserted into the query after an unquoted COLLATE clause, allowing SQL syntax to be interpreted as part of the statement
  • Required authority: Database impact is limited by the privileges of the application's database connection

Why this happens

The underlying bug is failure to treat collation names as constrained SQL identifiers or predefined values. When an expression API accepts a collation string and incorporates it into generated SQL without strict validation, attacker-controlled content can escape the intended semantic role and alter query structure. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.

The underlying bug is failure to treat collation names as constrained SQL identifiers or predefined values. When an expression API accepts a collation string and incorporates it into generated SQL without strict validation, attacker-controlled content can escape the intended semantic role and alter query structure. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.

Potential impact

  • An attacker may alter the logic of affected database queries
  • Sensitive records may be disclosed through manipulated query behavior
  • Data may be modified or deleted if the database account permits those operations
  • Application authentication or authorization checks could be weakened in affected query paths
  • Database availability could be degraded
  • An attacker may alter the logic of affected database queries
  • Sensitive records may be disclosed through manipulated query behavior
  • Data may be modified or deleted if the database account permits those operations
  • Application authentication or authorization checks could be weakened in affected query paths
  • Database availability could be degraded

General mitigation guidance

Mitigation generally focuses on reducing trust in collation inputs and ensuring that generated SQL cannot be extended through identifier-like values.

Common defensive patterns include:

  • Restricting collations to a small, explicit allowlist appropriate for each supported database
  • Rejecting unexpected characters, formats, or values before expression construction
  • Separating user-selectable presentation options from SQL expression construction
  • Using framework APIs that represent validated identifiers or structured query components
  • Applying parameterization for data values while recognizing that parameters generally do not substitute for SQL identifiers
  • Limiting database accounts to the minimum permissions required by the application
  • Preserving centralized validation and authorization controls for every query path

Mitigation generally focuses on reducing trust in collation inputs and ensuring that generated SQL cannot be extended through identifier-like values.

Common defensive patterns include:

  • Restricting collations to a small, explicit allowlist appropriate for each supported database
  • Rejecting unexpected characters, formats, or values before expression construction
  • Separating user-selectable presentation options from SQL expression construction
  • Using framework APIs that represent validated identifiers or structured query components
  • Applying parameterization for data values while recognizing that parameters generally do not substitute for SQL identifiers
  • Limiting database accounts to the minimum permissions required by the application
  • Preserving centralized validation and authorization controls for every query path

How teams detect issues like this

Detection approaches may include:

  • Static analysis rules that flag user-controlled data passed to collation setters or expression constructors
  • Code review checks for dynamic SQL identifier, ordering, grouping, and collation values
  • Searches for setCollation() and related expression APIs where arguments originate from requests, headers, stored records, or job inputs
  • Runtime monitoring for unexpected COLLATE fragments, query-shape changes, database errors, or unusual query volume
  • Policy enforcement requiring allowlisted SQL identifiers and security tests for query-generation boundaries
  • Automated application-security scanning and code-review tools configured to identify SQL injection data flows

Detection approaches may include:

  • Static analysis rules that flag user-controlled data passed to collation setters or expression constructors
  • Code review checks for dynamic SQL identifier, ordering, grouping, and collation values
  • Searches for setCollation() and related expression APIs where arguments originate from requests, headers, stored records, or job inputs
  • Runtime monitoring for unexpected COLLATE fragments, query-shape changes, database errors, or unusual query volume
  • Policy enforcement requiring allowlisted SQL identifiers and security tests for query-generation boundaries
  • Automated application-security scanning and code-review tools configured to identify SQL injection data flows

Frequently asked

questions

It may be remotely exploitable when a public or authenticated application endpoint allows an attacker to influence a collation value that reaches the affected CakePHP expression APIs. Exploitability depends on application data flow and access controls.

The attacker needs a way to control or modify a collation name used in query construction. Database-level consequences are constrained by the privileges of the application's connection.

Treat collations as controlled SQL identifiers: use a strict allowlist, reject unrecognized values before expression construction, and avoid incorporating arbitrary user input into generated SQL syntax.

Review all dynamic query components, distinguish SQL identifiers from parameterized data values, enforce least-privilege database accounts, and add static, integration, and runtime tests for untrusted input reaching query builders.

It may be remotely exploitable when a public or authenticated application endpoint allows an attacker to influence a collation value that reaches the affected CakePHP expression APIs. Exploitability depends on application data flow and access controls.

The attacker needs a way to control or modify a collation name used in query construction. Database-level consequences are constrained by the privileges of the application's connection.

Treat collations as controlled SQL identifiers: use a strict allowlist, reject unrecognized values before expression construction, and avoid incorporating arbitrary user input into generated SQL syntax.

Review all dynamic query components, distinguish SQL identifiers from parameterized data values, enforce least-privilege database accounts, and add static, integration, and runtime tests for untrusted input reaching query builders.

Find out what's already
exploitable in your codebase.