Skip to content

Commit bc7f4b5

Browse files
elicpeterkesselb
authored andcommitted
fix(repair): restrict unserialize() in RemoveBrokenProperties
RemoveBrokenProperties::run() calls unserialize() on the property value column without restricting allowed_classes. The result is only compared against false to identify broken rows, so no class instantiation is needed. As written though, magic methods (__wakeup/__destruct) on any class referenced by the serialized payload still execute. The runtime decoder for the same column already restricts deserialization. See apps/dav/lib/DAV/CustomPropertiesBackend.php:675-678, which passes ['allowed_classes' => self::ALLOWED_SERIALIZED_CLASSES]. This change applies the same hardening to the repair step. It uses ['allowed_classes' => false] since the unserialized value is never used, only its truthiness is checked. No behavior change for valid or broken rows. Signed-off-by: Eli Peter <54954007+elicpeter@users.noreply.github.com>
1 parent eeecb3e commit bc7f4b5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/private/Repair/RemoveBrokenProperties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function run(IOutput $output): void {
3737
$brokenIds = [];
3838
while ($entry = $result->fetch()) {
3939
if (!empty($entry['propertyvalue'])) {
40-
$object = @unserialize(str_replace('\x00', chr(0), $entry['propertyvalue']));
40+
$object = @unserialize(str_replace('\x00', chr(0), $entry['propertyvalue']), ['allowed_classes' => false]);
4141
if ($object === false) {
4242
$brokenIds[] = $entry['id'];
4343
}

0 commit comments

Comments
 (0)