Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
cakephp-collate-sqli — CakePHP 5.4.2 - High - Remote - SQLi - COLLATE collation is a raw SQL fragment | Kitploit
Tools/GitHubGitHub/abraxas/cakephp-collate-sqli
Vulnerability ScannersVulnerability AnalysisExploitationWeb Application ExploitationWeb SecurityPenetration TestingDatabase Security
GitHubabraxas/cakephp-collate-sqli

cakephp-collate-sqli

CakePHP 5.4.2 - High - Remote - SQLi - COLLATE collation is a raw SQL fragment

View Repository
3 days agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Abraxas Labs - cakephp-collate-sqli

abraxaslabs.tech  ·  github.com/abraxas  ·  @abraxas_null  ·  [email protected]  ·  cakephp-collate-sqli

cakephp-collate-sqli

Class: SQLi Reach: Remote

CakePHP 5.4.2 (887b641) - Cake Software Foundation

StringExpression::sql binds the string value and concatenates collation. IdentifierExpression does the same. There is no ensureSimpleString. Postgres quoteIdentifier is '"' . trim($collation, '"') . '"', so an embedded quote closes CAST early.

An app that forwards request/locale collation into new StringExpression($term, $collation) puts that string into COLLATE. The value stays bound. The collation does not.

IDno CVE yet
ClassSQLi
ReachRemote (app that forwards collation/locale into StringExpression / IdentifierExpression)
CWECWE-89
CVSSHigh: 8.1 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
ProductCakePHP (cakephp/database)
Affected5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
Authapplication that forwards collation/locale into those constructors
LicenseGNU Affero GPL v3.0
Lab127.0.0.1 only

What an attacker can do

Needs an application that passes user/locale collation into those constructors. Stock cakephp/app does not expose collation on a public form by itself.

PrivilegeMethod / sinkKindLab-proven or inferred
Splice SQL after COLLATEStringExpression::sql concatenates $this->collationIntegrity of compiled SQLLab-proven. Raw SQL contains the payload unbound
Same splice on identifiersIdentifierExpression note COLLATE <payload>Integrity of compiled SQLLab-proven. id_raw_sql contains the payload
Break out of Postgres "..." wrapquoteIdentifier = '"' . trim($collation, '"') . '"'Integrity of compiled SQLLab-proven. Compiled SQL is COLLATE "C" AS text)) || (SELECT ...
Execute the breakout and read another tableCAST(... ) || (SELECT note FROM lab_secret ...)Recon of DBLab-proven. Result xCAKEPHP-COLLATE-SQLI-WITNESS, no exec error
Modify rows / more SQL with the connection roleSame injectionIntegrity of DBInferred. Lab is a SELECT oracle
Negative controlcollation CClosedLab-proven. Result x, no witness, compiled COLLATE "C"

Closed on this leftover: bound string value (:c0 stays the literal x); a collation that would pass ensureSimpleString (^[a-zA-Z0-9]+$) is not this payload. Not unauthenticated RCE on a skeleton app. Not a shell.

Same pin leftovers: window SQLi, attachment CRLF, cache unserialize.

How I found it

I pinned 5.4.2 after the FunctionsBuilder / filename= notes. Ten hunts. The remaining-SQLi pass is this one. StringExpression::sql:

$placeholder = $binder->placeholder('c');
$binder->bind($placeholder, $this->string, 'string');
return $placeholder . ' COLLATE ' . $this->collation;

Postgres quoteIdentifier wraps with ASCII quotes and trim($collation, '"'). An embedded " closes the identifier. -- eats the leftover closer Cake still appends.

Wrong turns already recorded: SQLite as the only driver (concat is real, the wrap-breakout is Postgres); treating the bound value as the injection; claiming ensureSimpleString already ran here (it did not); a reverse shell. Theatre.

Lab

python3 cakephp-collate-sqli-Abraxas-Labs.py

or

cd lab
./run.sh

Target only http://127.0.0.1:19450. cakephp/database 5.4.2 plus Postgres 16. Tiny app forwards ?collation= into StringExpression / IdentifierExpression and executes CAST(... AS text). Secret table holds the witness.

SUCCESS cakephp-collate-sqli pin=5.4.2 raw=concat pg-wrap=breakout exec=yes CAKEPHP-COLLATE-SQLI-WITNESS

The fix

ensureSimpleString() (or a collation allowlist) on the collation argument. Postgres must quote identifiers properly, not trim plus wrap.

References

  • github.com/cakephp/cakephp tag 5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
  • StringExpression.php · IdentifierExpression.php · Postgres.php
  • Nearby patched: CVE-2026-79752 ensureSimpleString()
  • Same pin: cakephp-window-sqli · cakephp-attachment-crlf · cakephp-cache-unserialize
  • CWE-89

License

GNU Affero GPL v3.0. See LICENSE. Loopback lab only. No warranty.

Download Tool