Skip to content

Commit 7f639b4

Browse files
authored
Merge pull request #24 from wirecli/security-fix-weak-crypto-salts-1961918382625126282
🔒 Replace weak cryptographic functions for salt generation
2 parents fdea413 + ae18884 commit 7f639b4

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

src/Helpers/Installer.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -346,17 +346,8 @@ public function checkDatabaseConnection($values, $out = true) {
346346
* @param array $values
347347
*/
348348
protected function dbSaveConfigFile(array $values) {
349-
$file = __FILE__;
350-
$time = time();
351-
$host = empty($values['httpHosts']) ? '' : implode(',', $values['httpHosts']);
352-
353-
if(function_exists('random_bytes')) {
354-
$authSalt = sha1(random_bytes(random_int(40, 128)));
355-
$tableSalt = sha1(random_int(0, 65535) . "$host$file$time");
356-
} else {
357-
$authSalt = md5(mt_rand() . microtime(true));
358-
$tableSalt = md5(mt_rand() . "$host$file$time");
359-
}
349+
$authSalt = bin2hex(random_bytes(20));
350+
$tableSalt = bin2hex(random_bytes(20));
360351

361352
$cfg = "\n/**" .
362353
"\n * Installer: Database Configuration" .

0 commit comments

Comments
 (0)