Skip to content

Commit a8a2529

Browse files
XananasX7backportbot[bot]
authored andcommitted
fix(TaskProcessing): add allowed_classes to unserialize() in Manager cache
The availableTaskTypes cache stores serialized arrays containing ShapeDescriptor objects, ShapeEnumValue objects, and EShapeType enum values. The unserialize() call did not restrict which classes could be instantiated. Restrict deserialization to the three known types: - OCP\TaskProcessing\ShapeDescriptor - OCP\TaskProcessing\ShapeEnumValue - OCP\TaskProcessing\EShapeType This prevents PHP Object Injection if an attacker gains write access to the distributed cache backend (e.g., a Redis instance without authentication or with weak ACLs), which is a known real-world attack vector in shared hosting and container environments.
1 parent 1f76a70 commit a8a2529

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/private/TaskProcessing/Manager.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,13 @@ public function getAvailableTaskTypes(bool $showDisabled = false, ?string $userI
871871
if ($this->availableTaskTypes === null) {
872872
$cachedValue = $this->distributedCache->get($cacheKey);
873873
if ($cachedValue !== null) {
874-
$this->availableTaskTypes = unserialize($cachedValue);
874+
$this->availableTaskTypes = unserialize($cachedValue, [
875+
'allowed_classes' => [
876+
ShapeDescriptor::class,
877+
ShapeEnumValue::class,
878+
EShapeType::class,
879+
],
880+
]);
875881
}
876882
}
877883
// Either we have no cache or showDisabled is turned on, which we don't want to cache, ever.

0 commit comments

Comments
 (0)