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