Review 13.4 Merged

94428[SECURITY] Mitigate deserialization flaws

Oliver Hader CR +2 V +2 Hard +867 −50 updated 06/09/26, 09:02

Commit message

Introduce serializer infrastructure to block PHP object injection
gadgets during deserialization:

* DenyListDeserializer: runtime guard that rejects any payload
  referencing a gadget class before deserialization proceeds.
  The per-class deny/allow decision is resolved lazily via
  ReflectionClass at first encounter, then cached in cache:core
  signed with HMAC so that reflection is never repeated for the
  same class within a cache lifetime. A gadget class is one with a
  user-defined __destruct() or an exploitable __wakeup() (i.e. one
  not provided solely by BlockSerializationTrait).

* AuthenticatedMessageDeserializer: signs payloads with HMAC
  on write and validates the HMAC on read, preventing
  adversarially crafted deserialization payloads.

Two complementary strategies are applied:

VariableFrontend (cache frontend) uses
AuthenticatedMessageDeserializer: caches are temporary and written
exclusively by the server, so HMAC authentication provides a strong
integrity guarantee. All classes are allowed after a successful HMAC
check. Legacy cache entries without an HMAC that contain no class
tokens are still deserialized safely with allowed_classes=false;
those with class tokens are discarded and treated as a transparent
cache miss.

Registry (sys_registry) uses DenyListDeserializer: long-lived
persisted data requires a denylist strategy (block known-bad, allow
unknown) to avoid breaking changes to existing stored values.

Where only scalar values are serialized (Scheduler task executions,
last-failure data, non-cacheable cObj data in RequestHandler),
unserialize() is hardened directly with allowed_classes=false.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
  • Verified V +2 Done
    • Oliver Hader +2

Issues 1

Files 27

Show 7 more files

Review log 3

  1. Oliver Hader uploaded patch set 1 06/09/26, 09:02

  2. Oliver Hader commented on patch set 1 CR +2 V +2 06/09/26, 09:02

    Auto-approved
  3. Oliver Hader merged patch set 2 06/09/26, 09:02