Fix #1246 Arbitrary zip/directory deletion vulnerability in backup plugin

This commit is contained in:
Anaggh S 2020-10-01 23:33:59 +05:30
parent 9a82bd4f32
commit 96c21ed2ea

View file

@ -290,6 +290,14 @@ class pluginBackup extends Plugin {
{
global $L;
// Prevent arbitrary deletion. Check if directory/zip backup exists
if (! in_array(
$this->zip ? "$filename.zip" : $filename,
array_map('basename', glob($this->workspace().'*')))
) {
return $this->response(400, sprintf($L->get("Invalid Backup '%s'"), $filename));
}
if ($this->zip) {
// Zip format
$tmp = $this->workspace().$filename.'.zip';