فهرست منبع

Merge pull request #506 from Flatta/fix-sec-backup

Fix #505: Strict backup filename check.
Serghey Rodin 10 سال پیش
والد
کامیت
4dce22cd77
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      web/download/backup/index.php

+ 1 - 1
web/download/backup/index.php

@@ -13,7 +13,7 @@ if ($_SESSION['user'] == 'admin') {
 }
 }
 
 
 if ((!empty($_SESSION['user'])) && ($_SESSION['user'] != 'admin')) {
 if ((!empty($_SESSION['user'])) && ($_SESSION['user'] != 'admin')) {
-    if (preg_match("/^".$user."/i", $backup)) {
+    if (strpos($backup, $user.'.') === 0) {
         header('Content-type: application/gzip');
         header('Content-type: application/gzip');
         header("Content-Disposition: attachment; filename=\"".$backup."\";" ); 
         header("Content-Disposition: attachment; filename=\"".$backup."\";" ); 
         header("X-Accel-Redirect: /backup/" . $backup);
         header("X-Accel-Redirect: /backup/" . $backup);