Просмотр исходного кода

Security - Fix (#2784)

Fix for Information disclosure vulnerability
mayappear 3 лет назад
Родитель
Сommit
eb368c9fc6
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      web/inc/2fa/secret.php

+ 4 - 1
web/inc/2fa/secret.php

@@ -1,5 +1,8 @@
 <?php
 
+session_start();
+if ((isset($_SESSION['userContext']) === False) && (php_sapi_name() !== 'cli'))  exit;
+
 require_once '/usr/local/hestia/web/inc/2fa/loader.php';
 Loader::register('./','RobThree\\Auth');
 
@@ -10,4 +13,4 @@ $tfa = new TwoFactorAuth('Hestia Control Panel');
 $secret = $tfa->createSecret(160);  // Though the default is an 80 bits secret (for backwards compatibility reasons) we recommend creating 160+ bits secrets (see RFC 4226 - Algorithm Requirements)
 $qrcode = $tfa->getQRCodeImageAsDataUri(gethostname(), $secret);
 
-echo $secret . "-" . $qrcode;
+echo $secret . "-" . $qrcode;