diff --git a/library/Zend/Crypt/Password/Bcrypt.php b/library/Zend/Crypt/Password/Bcrypt.php index bd7a51954fc..3e482d02125 100644 --- a/library/Zend/Crypt/Password/Bcrypt.php +++ b/library/Zend/Crypt/Password/Bcrypt.php @@ -22,8 +22,12 @@ class Bcrypt implements PasswordInterface /** * @var string + * + * Changed from 14 to 10 to prevent possibile DOS attacks + * due to the high computational time + * @see http://timoh6.github.io/2013/11/26/Aggressive-password-stretching.html */ - protected $cost = '14'; + protected $cost = '10'; /** * @var string diff --git a/tests/ZendTest/Crypt/Password/BcryptTest.php b/tests/ZendTest/Crypt/Password/BcryptTest.php index 09572c01fb7..49411e8c6dc 100644 --- a/tests/ZendTest/Crypt/Password/BcryptTest.php +++ b/tests/ZendTest/Crypt/Password/BcryptTest.php @@ -37,7 +37,7 @@ public function setUp() } else { $this->prefix = '$2a$'; } - $this->bcryptPassword = $this->prefix . '14$MTIzNDU2Nzg5MDEyMzQ1NeWUUefVlefsTbFhsbqKFv/vPSZBrSFVm'; + $this->bcryptPassword = $this->prefix . '10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y'; } public function testConstructByOptions() @@ -140,7 +140,7 @@ public function testPasswordWith8bitCharacter() $this->bcrypt->setSalt($this->salt); if (version_compare(PHP_VERSION, '5.3.7') >= 0) { - $this->assertEquals('$2y$14$MTIzNDU2Nzg5MDEyMzQ1NexAbOIUHkG6Ra.TK9QxHOVUhDxOe4dkW', + $this->assertEquals('$2y$10$MTIzNDU2Nzg5MDEyMzQ1NemFdU/4JOrNpxMym09Mbp0m4hKTgfQo.', $this->bcrypt->create($password)); } else { $this->setExpectedException('Zend\Crypt\Password\Exception\RuntimeException',