Skip to content

fix(occ): prevent params command key from overriding validated allowlist command#41577

Open
DeepDiver1975 wants to merge 2 commits into
masterfrom
security/fix-occ-allowlist-bypass
Open

fix(occ): prevent params command key from overriding validated allowlist command#41577
DeepDiver1975 wants to merge 2 commits into
masterfrom
security/fix-occ-allowlist-bypass

Conversation

@DeepDiver1975
Copy link
Copy Markdown
Member

Summary

  • OccController::execute() validated the URL-path $command against the allowlist, then merged it with user-supplied $params via array_merge(['command' => $command], $params)
  • PHP's array_merge with string keys causes later duplicates to overwrite earlier ones — a command key in the POST body bypassed the allowlist entirely
  • Fix: unset($params['command']) before the merge; one-line change, complete protection

Security Impact

Critical — authenticated updater callers with updater.secret + localhost access can execute any occ command (user:resetpassword, config:system:set, encryption:decrypt-all, etc.) regardless of the allowlist

Test plan

  • testParamsCommandKeyCannotOverrideValidatedCommand sends user:resetpassword in params while URL says status; asserts console receives status — fails without fix
  • Run make test TEST_PHP_SUITE=core/Controller

🤖 Generated with Claude Code

…ist command

OccController::execute() validated the URL-path $command against the
allowlist, then called array_merge(["command"=>$command], $params).
PHP's array_merge with string keys lets later values overwrite earlier
ones, so a "command" key in the POST body $params silently replaced the
validated command, allowing execution of any occ command.

Add unset($params["command"]) before the merge to strip any
attacker-supplied command key, ensuring the validated value is always
what reaches Symfony Console.

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>
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