Skip to content

Commit d878ec6

Browse files
XananasX7AndyScherzinger
authored andcommitted
fix(TaskProcessing): restrict allowed_classes in Manager cache deserialization
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. Signed-off-by: El Mehdi Abenhazou <mehdiananas007@gmail.com>
1 parent 52d371c commit d878ec6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/private/TaskProcessing/Manager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -940,12 +940,12 @@ public function getAvailableTaskTypes(bool $showDisabled = false, ?string $userI
940940
$cachedValue = $this->distributedCache->get($cacheKey);
941941
if ($cachedValue !== null) {
942942
$this->availableTaskTypes = unserialize($cachedValue, [
943-
'allowed_classes' => [
944-
ShapeDescriptor::class,
945-
ShapeEnumValue::class,
946-
EShapeType::class,
947-
],
948-
]);
943+
'allowed_classes' => [
944+
ShapeDescriptor::class,
945+
ShapeEnumValue::class,
946+
EShapeType::class,
947+
],
948+
]);
949949
}
950950
}
951951
// Either we have no cache or showDisabled is turned on, which we don't want to cache, ever.

0 commit comments

Comments
 (0)