From c5b73766b2ad0e9a850584092016f3609f88fd4c Mon Sep 17 00:00:00 2001 From: Giuseppe Criscione <18699708+giuscris@users.noreply.github.com> Date: Sun, 30 Oct 2022 18:51:56 +0100 Subject: [PATCH] Add basename to fix path traversal on backup download --- admin/src/Controllers/Backup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/src/Controllers/Backup.php b/admin/src/Controllers/Backup.php index 14057716..9e66e754 100644 --- a/admin/src/Controllers/Backup.php +++ b/admin/src/Controllers/Backup.php @@ -37,7 +37,7 @@ public function make(): void public function download(RouteParams $params): void { $this->ensurePermission('backup.download'); - $file = $this->option('backup.path') . base64_decode($params->get('backup')); + $file = $this->option('backup.path') . basename(base64_decode($params->get('backup'))); try { if (FileSystem::isFile($file, false)) { HTTPResponse::download($file);