Skip to content
RCE Disclosed report Intermediate

Remote Code Execution through "Files_antivirus" plugin

An administrator could point the files_antivirus plugin's antivirus binary path at the PHP interpreter and pass an uploaded file as its argument, so the uploaded PHP code ran on the server. This let an admin-level user execute code on the host, bypassing the intended separation between the application and the system layer.

pabl00nicarres Follow

Originally disclosed on HackerOne

  • Disclosed after 12 months

Hi, I would like to report a Remote Code Execution in OwnCloud. The flaw is exploitable as an authenticated user and level of privileges required is "Administrator". Vulnerable component is the plugin "files_antivirus", freely downloadable via the market and available in owncloud github repository at

Environment used: LAMP stack . Owncloud version: 10.4.1.3. Considerations: In owncloud separation between application/database/system layer is cleary a (good) design choice and neither an Administrator user in a default configuration scenario is supposed to upload custom code if not provided with shell access level. POC: Below the steps to reproduce the issue and get code execution:

  • Login in owncloud as Administrator.
  • If not installed, go to marketplace and install the aforementioned "files_antivirus" plugin.
  • Download the config report from the general menu.
    Screenshot_(174).png
    Screenshot_(174).png From the original on HackerOne
  • Open the report, all sensitive infos are stripped but absolute paths are still there. We're mostly interested in the config value "datadirectory" in order to understand where exactly the uploaded files are. Other interesting values are in the "enviroment structure, where we can get the php interpreter path (just an example, this can be done with bash etc.).
    Screenshot_(178).png
    Screenshot_(178).png From the original on HackerOne
  • Go to "Files" and upload a file with php code, extension is not relevant.
Screenshot_(180).png
Screenshot_(180).png From the original on HackerOne
  • Go to "Protection" and, using the previously obtained path from the config report, set the clamscan av path with the PHP interpreter path. The first argument will be the file with php code we just uploaded (the use of escapeshellarg function is not relevant here, we're not injecting shell arguments/commands).
    Screenshot_(182).png
    Screenshot_(182).png From the original on HackerOne
  • Save the new config, ignore the error about the scan that cannot be executed and verify that the PHP code was successfully executed.

Kind Regards Paolo Serracino

Impact

Depends from the environment, an attacker who is able to get admin creds could use this flaw to move laterally, steal cloud metadata infos and so on.

The original report as published on HackerOne, by pabl00nicarres. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the plugin lets an administrator configure an arbitrary executable path and arguments for scanning, without restricting it to a genuine antivirus binary, so any uploaded file can be run as code.

Impact

An attacker holding administrator credentials could run code on the host and use it to move laterally or steal cloud metadata, depending on the environment.

What the attacker needed

Administrator account; files_antivirus plugin installed

How it was found

  1. Log in to ownCloud as an administrator.
  2. Install the files_antivirus plugin from the marketplace if it is not already present.
  3. Download the configuration report and read the data directory and PHP interpreter paths from it.
  4. Upload a file containing PHP code; the extension does not matter.
  5. In the Protection settings, set the clamscan path to the PHP interpreter with the uploaded file as its first argument.
  6. Save the configuration, ignore the scan error, and confirm the PHP code executed.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

The antivirus plugin runs an external program to scan uploaded files, and an admin can choose which program that is. By choosing the PHP interpreter and an uploaded file as its input, the admin made the server run their own code. This matters because admins are not meant to get full control of the underlying machine.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by pabl00nicarres

View all

3 more disclosed reports, best first.

More from ownCloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.