Skip to content

fix(command): restrict allowed_classes in ClosureJob unserialize() to prevent RCE#41583

Open
DeepDiver1975 wants to merge 3 commits into
masterfrom
security/fix-closurejob-unserialize
Open

fix(command): restrict allowed_classes in ClosureJob unserialize() to prevent RCE#41583
DeepDiver1975 wants to merge 3 commits into
masterfrom
security/fix-closurejob-unserialize

Conversation

@DeepDiver1975
Copy link
Copy Markdown
Member

Summary

  • ClosureJob::run() called bare unserialize() on DB-sourced data; same gadget-chain RCE risk as CommandJob
  • The post-deserialization method_exists check doesn't help — __wakeup()/__destruct() already fired
  • Fix adds allowed_classes restricted to the 6 laravel/serializable-closure classes that legitimately appear in serialized closure payloads

Security Impact

High (defense-in-depth) — requires prior DB write access to exploit

Test plan

  • Legitimate closure still executes correctly after fix
  • Malicious gadget payload's __wakeup() is NOT triggered (test would fail without fix)
  • Run make test TEST_PHP_SUITE=lib/Command

🤖 Generated with Claude Code

… prevent RCE

ClosureJob::run() called unserialize() without allowed_classes restriction
on data from the oc_jobs.argument database column. An attacker with DB
write access could inject a gadget chain payload. The post-deserialization
method_exists check provides no protection since __wakeup()/__destruct()
fire during unserialize() before any check is reached.

Add an explicit allowed_classes list covering the six Laravel
SerializableClosure classes that legitimately appear in a serialized
closure payload. All other classes are rejected before instantiation.

Signed-off-by: Thomas Müller <thomas.mueller@owncloud.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@update-docs
Copy link
Copy Markdown

update-docs Bot commented Jun 5, 2026

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
…on of test class

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant