aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/passwords/driver/bcrypt.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-10-07 16:00:52 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-10-07 16:00:52 +0200
commitf1d29499859a060b8c59a9efbeada74958eee720 (patch)
tree0c1b1f3964cc18373c237f0a172d6d6bc81e088c /phpBB/phpbb/passwords/driver/bcrypt.php
parent035db5e08b961055f0e74a26491ac35b289469cd (diff)
downloadforums-f1d29499859a060b8c59a9efbeada74958eee720.tar
forums-f1d29499859a060b8c59a9efbeada74958eee720.tar.gz
forums-f1d29499859a060b8c59a9efbeada74958eee720.tar.bz2
forums-f1d29499859a060b8c59a9efbeada74958eee720.tar.xz
forums-f1d29499859a060b8c59a9efbeada74958eee720.zip
[feature/passwords] Move check for 8-bit characters to bcrypt driver
PHPBB3-11610
Diffstat (limited to 'phpBB/phpbb/passwords/driver/bcrypt.php')
-rw-r--r--phpBB/phpbb/passwords/driver/bcrypt.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/phpBB/phpbb/passwords/driver/bcrypt.php b/phpBB/phpbb/passwords/driver/bcrypt.php
index 2f6cc1b381..e29379a36f 100644
--- a/phpBB/phpbb/passwords/driver/bcrypt.php
+++ b/phpBB/phpbb/passwords/driver/bcrypt.php
@@ -41,6 +41,16 @@ class bcrypt extends \phpbb\passwords\driver\base
// Revert to 2a if this is the case
$prefix = (!$this->is_supported()) ? '$2a$' : $this->get_prefix();
+ // Do not support 8-bit characters with $2a$ bcrypt
+ // Also see http://www.php.net/security/crypt_blowfish.php
+ if ($prefix === self::PREFIX)
+ {
+ if (ord($password[strlen($password)-1]) & 128)
+ {
+ return false;
+ }
+ }
+
if ($salt == '')
{
$salt = $prefix . '10$' . $this->get_random_salt();