Описание
Pimcore Hotspotimage getDataFromResource() unrestricted Serialize::unserialize over object-store column (PHP Object Injection, CWE-502)
Summary
Pimcore\Model\DataObject\ClassDefinition\Data\Hotspotimage::getDataFromResource() deserializes the *__hotspots object-store column through the Pimcore\Tool\Serialize::unserialize() wrapper without a class allowlist (the wrapper's $allowedClasses parameter defaults to true, i.e. fully unrestricted). Because the persistence layer always stores this column as PHP-serialize()d bytes, every load of a DataObject that has a Hotspotimage (advanced image) field runs an unrestricted unserialize() over the stored column value. An attacker who can write the *__hotspots store column with crafted serialized bytes achieves PHP Object Injection (CWE-502): arbitrary classes are instantiated and their magic methods (__wakeup/__destruct) execute, which is exploitable for remote code execution via gadget chains present in Pimcore's own bundled dependencies (e.g. guzzlehttp/guzzle).
The same field-data family also affects the sibling marshallers ImageGallery, Block, and Video, which use the identical json_decode(...) ?: Serialize::unserialize(...) fallback over their respective store columns. The root cause is shared: Serialize::unserialize() defaults to an unrestricted class list, and these callers pass no second argument.
Severity
High. Successful exploitation yields PHP Object Injection leading to remote code execution (proven below as arbitrary file write using a gadget from Pimcore's bundled guzzlehttp/guzzle 7.11.0). This is the deserialization leg of an attack: it requires the ability to write the *__hotspots object-store column with attacker-chosen serialized bytes. No class-allowlist defense is present, so any such write is directly weaponizable on the next object load. CVSS-wise this is comparable to other deserialization sinks over attacker-influenceable storage in this codebase.
Affected component
- File:
models/DataObject/ClassDefinition/Data/Hotspotimage.php, methodgetDataFromResource(). - Vulnerable lines (v2026.1.4 / v12.3.8):
$metaData = $data[$this->getName() . '__hotspots']; // check if the data is JSON (backward compatibility) $md = json_decode($metaData, true); if (!$md) { $md = Serialize::unserialize($metaData); // unrestricted: allowed_classes defaults to true } elseif (is_array($md)) { $md['hotspots'] = $md; }
- Root enabler:
lib/Tool/Serialize.phppublic static function unserialize(?string $data = null, array|bool $allowedClasses = true): mixed { if ($data === null || $data === '') { return $data; } return unserialize($data, ['allowed_classes' => $allowedClasses]); // default true = unrestricted } - Sibling marshallers with the identical fallback shape:
ImageGallery,Block,Video(DataObject\ClassDefinition\Data). - Package:
pimcore/pimcore(Composer). - Affected versions: all currently maintained releases, including the latest
v2026.1.4andv12.3.8(verified against deployedv2026.1.4).
Data flow
- On save,
Hotspotimage::getDataForResource()stores the hotspot/marker/crop metadata asSerialize::serialize($metaData)into the<field>__hotspotsobject-store column — i.e. PHP serialized bytes, not JSON. - On load,
Hotspotimage::getDataFromResource()reads that column, callsjson_decode()(which fails for the serialized format), and therefore falls through toSerialize::unserialize($metaData)with the default unrestricted class list. Serialize::unserialize()invokesunserialize($data, ['allowed_classes' => true]), instantiating any class named in the bytes and triggering its magic methods.- The load path is exercised on essentially every object retrieval (admin grid/detail, frontend rendering, Studio/API reads, inheritance walks) for objects whose class declares a Hotspotimage field, with a non-null
<field>__image.
The attacker primitive is the ability to place crafted serialized bytes into the <field>__hotspots store column (for example through an SQL-write/store-write primitive). The defect is that the deserialization is performed with no class allowlist, so any such write is directly executable.
Proof of Concept
Verified end-to-end against a real, locally deployed Pimcore v2026.1.4 (Composer skeleton + MariaDB + pimcore:install), not a ported stub. The gadget is phpggc Guzzle/FW1 built against Pimcore's own bundled guzzlehttp/guzzle 7.11.0; its GuzzleHttp\Cookie\FileCookieJar::__destruct writes an attacker-controlled file to disk (a file-write primitive; the same surface reaches RCE via other vendored gadget chains).
Gadget generation (476→474 raw bytes, non-JSON so the unserialize fallback is taken):
Reproduction harness (a Symfony console command living in the deployed app; it creates a real DataObject class with a Hotspotimage field, a real image asset, a real saved object, performs the attacker store-write into object_store_<id>.img__hotspots, then reloads the object through the real Pimcore model layer):
Captured output — RUN A (positive, gadget):
Captured output — RUN B (negative control, benign JSON in the column):
Captured output — RUN C (negative control, the fix: allowed_classes=false over the same gadget bytes):
RUN A shows the attacker bytes drive unserialize() to instantiate the GuzzleHttp\Cookie\FileCookieJar gadget, whose destructor writes an attacker-controlled file. RUN B shows benign JSON takes the safe json_decode branch (no deserialization, no file). RUN C shows that performing the same deserialization with an allowed_classes allowlist returns an inert __PHP_Incomplete_Class and the gadget never runs — i.e. the proposed fix neutralizes the attack.
Impact
PHP Object Injection (CWE-502) on object load. With gadget chains available in Pimcore's bundled dependencies this is exploitable for remote code execution; the PoC demonstrates an attacker-controlled arbitrary file write via the bundled guzzlehttp/guzzle 7.11.0 FileCookieJar chain. Because the *__hotspots column is read on virtually every load of an affected object (admin UI, frontend output, API, inheritance resolution), any write of crafted bytes into that column is reliably executed.
Remediation
Make Serialize::unserialize() safe by default and/or pass an explicit class allowlist at the Hotspotimage/ImageGallery/Block/Video callers.
Preferred minimal fix at the wrapper (closes the whole Serialize::unserialize()-without-allowlist family in one place):
(i.e. flip the default to false, requiring callers that legitimately need to revive objects to opt in with an explicit allowlist). Alternatively, change each affected marshaller to pass ['allowed_classes' => false] (or a tight allowlist such as [MarkerHotspotItem::class]) explicitly. RUN C above confirms allowed_classes deserialization renders the gadget inert. Fix PR (private temporary advisory fork): https://github.com/pimcore/pimcore-ghsa-w23p-wrp7-ch38/pull/1
Ссылки
- https://github.com/pimcore/pimcore/security/advisories/GHSA-w23p-wrp7-ch38
- https://github.com/pimcore/pimcore/pull/19181
- https://github.com/pimcore/pimcore/commit/b184c01bf11e213e601d965b4e96c8bb7248e980
- https://github.com/pimcore/pimcore/releases/tag/v12.3.10
- https://github.com/pimcore/pimcore/releases/tag/v2026.1.6
Пакеты
pimcore/pimcore
>= 2026.1.0, <= 2026.1.5
2026.1.6
pimcore/pimcore
<= 12.3.9
12.3.10
Связанные уязвимости
Pimcore is an Open Source Data & Experience Management Platform. Prior to 11.5.19, 12.3.10, and 2026.1.6, Pimcore\Model\DataObject\ClassDefinition\Data\Hotspotimage::getDataFromResource() in models/DataObject/ClassDefinition/Data/Hotspotimage.php passes the field __hotspots object-store column to Pimcore\Tool\Serialize::unserialize() without an allowed-classes restriction after JSON decoding fails. An attacker with a separate capability to write crafted PHP serialized bytes into that column can instantiate available classes and trigger magic methods when an affected DataObject is loaded, which can produce arbitrary file writes or code execution through bundled gadget chains. The related ImageGallery, Block, and Video callers use the same fallback pattern, but the identified June fix changes the Hotspotimage caller only. This issue is fixed for Hotspotimage in versions 11.5.19, 12.3.10, and 2026.1.6.
Уязвимость функции getDataFromResource() программной платформы PHP pimcore, позволяющая нарушителю выполнить произвольный код