瀏覽代碼

[Web] Validate plain md5 hashes, closes #3017

andryyy 6 年之前
父節點
當前提交
80a9c39956
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      data/web/inc/functions.inc.php

+ 6 - 0
data/web/inc/functions.inc.php

@@ -386,6 +386,12 @@ function verify_hash($hash, $password) {
       return true;
     }
   }
+  elseif (preg_match('/^{PLAIN-MD5}/i', $hash)) {
+    $hash = preg_replace('/^{PLAIN-MD5}/i', '', $hash);
+    if (md5($password) == $hash) {
+      return true;
+    }
+  }
   elseif (preg_match('/^{SHA512-CRYPT}/i', $hash)) {
     // Remove tag if any
     $hash = preg_replace('/^{SHA512-CRYPT}/i', '', $hash);