Skip to content

Commit f2d78e7

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 f045835 commit f2d78e7

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
@@ -939,7 +939,13 @@ public function getAvailableTaskTypes(bool $showDisabled = false, ?string $userI
939939
if ($this->availableTaskTypes === null) {
940940
$cachedValue = $this->distributedCache->get($cacheKey);
941941
if ($cachedValue !== null) {
942-
$this->availableTaskTypes = unserialize($cachedValue);
942+
$this->availableTaskTypes = unserialize($cachedValue, [
943+
'allowed_classes' => [
944+
ShapeDescriptor::class,
945+
ShapeEnumValue::class,
946+
EShapeType::class,
947+
],
948+
]);
943949
}
944950
}
945951
// Either we have no cache or showDisabled is turned on, which we don't want to cache, ever.

0 commit comments

Comments
 (0)