Skip to content

Commit 84092f3

Browse files
Merge tag '7.34' into 7.x
7.34 release Conflicts: CHANGELOG.txt includes/bootstrap.inc
2 parents 76faa7d + 81586d9 commit 84092f3

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

CHANGELOG.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11

2-
Drupal 7.34, xxxx-xx-xx (development version)
2+
Drupal 7.35, xxxx-xx-xx (development version)
33
-----------------------
44

5+
Drupal 7.34, 2014-11-19
6+
----------------------
7+
- Fixed security issues (multiple vulnerabilities). See SA-CORE-2014-006.
8+
59
Drupal 7.33, 2014-11-07
610
-----------------------
711
- Began storing the file modification time of each module and theme in the

includes/bootstrap.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* The current system version.
1010
*/
11-
define('VERSION', '7.34-dev');
11+
define('VERSION', '7.35-dev');
1212

1313
/**
1414
* Core API compatibility.

includes/password.inc

+5-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function _password_enforce_log2_boundaries($count_log2) {
140140
* @param $algo
141141
* The string name of a hashing algorithm usable by hash(), like 'sha256'.
142142
* @param $password
143-
* The plain-text password to hash.
143+
* Plain-text password up to 512 bytes (128 to 512 UTF-8 characters) to hash.
144144
* @param $setting
145145
* An existing hash or the output of _password_generate_salt(). Must be
146146
* at least 12 characters (the settings and salt).
@@ -150,6 +150,10 @@ function _password_enforce_log2_boundaries($count_log2) {
150150
* The return string will be truncated at DRUPAL_HASH_LENGTH characters max.
151151
*/
152152
function _password_crypt($algo, $password, $setting) {
153+
// Prevent DoS attacks by refusing to hash large passwords.
154+
if (strlen($password) > 512) {
155+
return FALSE;
156+
}
153157
// The first 12 characters of an existing hash are its setting string.
154158
$setting = substr($setting, 0, 12);
155159

includes/session.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function _drupal_session_read($sid) {
7979
// Handle the case of first time visitors and clients that don't store
8080
// cookies (eg. web crawlers).
8181
$insecure_session_name = substr(session_name(), 1);
82-
if (!isset($_COOKIE[session_name()]) && !isset($_COOKIE[$insecure_session_name])) {
82+
if (empty($sid) || (!isset($_COOKIE[session_name()]) && !isset($_COOKIE[$insecure_session_name]))) {
8383
$user = drupal_anonymous_user();
8484
return '';
8585
}

modules/simpletest/tests/password.test

+21
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,25 @@ class PasswordHashingTest extends DrupalWebTestCase {
5757
$this->assertFalse(user_needs_new_hash($account), 'Re-hashed password does not need a new hash.');
5858
$this->assertTrue(user_check_password($password, $account), 'Password check succeeds with re-hashed password.');
5959
}
60+
61+
/**
62+
* Verifies that passwords longer than 512 bytes are not hashed.
63+
*/
64+
public function testLongPassword() {
65+
$password = str_repeat('x', 512);
66+
$result = user_hash_password($password);
67+
$this->assertFalse(empty($result), '512 byte long password is allowed.');
68+
$password = str_repeat('x', 513);
69+
$result = user_hash_password($password);
70+
$this->assertFalse($result, '513 byte long password is not allowed.');
71+
// Check a string of 3-byte UTF-8 characters.
72+
$password = str_repeat('€', 170);
73+
$result = user_hash_password($password);
74+
$this->assertFalse(empty($result), '510 byte long password is allowed.');
75+
$password .= 'xx';
76+
$this->assertFalse(empty($result), '512 byte long password is allowed.');
77+
$password = str_repeat('€', 171);
78+
$result = user_hash_password($password);
79+
$this->assertFalse($result, '513 byte long password is not allowed.');
80+
}
6081
}

0 commit comments

Comments
 (0)