owncloud / owncloud/testing

Why do we escapeshellarg the parts of occ commands?

Open
#35 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
4
Forks
4
Avg merge
9h 26m
Merged PRs (30d)
1

Description

In lib/Occ.php function execute() we escapeshellarg the parts of the command to be executed.

We make exceptions to that for parts of occ commands that we know we need to send aalready enclosed in quotes, like:

--display-name='User One'
' '
'A value that has space in it'

It gradually gets more complicated to let through these string patterns and escapeshellarg everything else.

If you enable the testing app, and you know the admin password, then you can already do lots of nasty things to your system. If you know the admin password, then you may also have command line access to your system anyway - so you can type any command that you like.

So why do we try to protect occ command execution from command injection?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/Occ.php at function execute() and trace how command parts are passed through escapeshellarg, including the listed quoted exceptions. Determine the security rationale and scope of the current behavior; done means reaching a documented decision about whether the protection should remain, change, or be removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
cli, security
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.