Skip to content
RCE Disclosed report Intermediate

Potential code injection in fun delete_directory

The delete_directory function in the legacy Functions library passes unsanitised parameters to exec three times. If an attacker controls a file name, this could allow arbitrary code execution.

freetom Follow

Originally disclosed on HackerOne

  • Triaged in 3 hours
  • Fixed in 39 days
  • Disclosed after 52 days

Under /system/ee/legacy/libraries/Functions.php, function delete_directory contains calls to exec 3 times using different, potentially "unsanitized" paramateres. As the PHP manual suggest, escapeshellarg should be used to sanitize individual arguments [1].

On an implementation in which the attacker controls the file name, arbitrary code execution is achieved. Better to fix it.

[1] http://php.net/manual/en/function.escapeshellarg.php

The original report as published on HackerOne, by freetom. 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 function builds shell command strings from file paths without escaping them with escapeshellarg.

Impact

On an implementation where the attacker controls the file name, arbitrary code execution could be achieved.

What the attacker needed

Attacker controls a file name used by delete_directory

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.

Some PHP code runs shell commands to delete folders. It puts file names into those commands without cleaning them first. If someone can choose a file name, they might sneak in extra commands that the server then runs.

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 freetom

View all

2 more disclosed reports, best first.

More from ExpressionEngine

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.