* Advisory ID: DRUPAL-PSA-2012-001 * Project: Drupal core [1] * Version: 6.x, 7.x * Date: 2012-01-11 * Security risk: Less critical [2] * Exploitable from: Remote * Vulnerability: Denial of Service
-------- DESCRIPTION ---------------------------------------------------------
PHP is vulnerable to a hash collision denial of service (DOS) [3] attack. If an attacker can post a large amount of specifically chosen variables to the site, a large amount of CPU time is consumed preventing service to visitors.
Many users deploy the Suhosin PHP extension [4] to limit the amount of posted variables that will be handled by PHP, thus preventing the DOS attack.
There's an unfortunate interaction with the mbstring extension required by Drupal to work with UTF-8. When the setting mbstring.encoding_translation is updated via .htaccess the mbstring extension changes the PHP POST handlers so that only every other POST variable can be handled by Suhosin.
While Suhosin will still remove half of the variables over the post.max_vars limit, it is ultimately unsuccesful in limiting the amount of posted variables and thus in preventing the hash collision DOS attack.
-------- VERSIONS AFFECTED ---------------------------------------------------
All versions
-------- SOLUTION ------------------------------------------------------------
Confirm that the master value of mbstring.encoding_translation is set to Off via:
* Drupal 7: Reports > Status, then More information on the PHP version (admin/reports/status/php) * Drupal 6: Administer > Reports > Status report, then follow the link on the PHP version (admin/reports/status/php)
Next, remove the lines from the file .htaccess in the Drupal root.
For Drupal 7.x remove the lines: php_flag mbstring.encoding_translation off
For Drupal 6.x remove the lines: php_value mbstring.encoding_translation off
If the master value of mbstring.encoding_translation is On, change it to Off via PHP.ini. Contact your hosting provider if necessary.
If you do not use Suhosin, limit the amount of variables posted to your site in another way. You should consider upgrading to PHP 5.3.9 and using its newly introduced directive 'max_input_vars'.
Please note that setting such limits too low (whether via Suhosin or PHP) can break processing on long forms like the permissions administration screen.
It is likely that the near-future will see an update to Suhosin, making the procedure described in this PSA unnecessary.
See also the Drupal core [5] project page.
-------- REPORTED BY ---------------------------------------------------------
* Dominic Böttger
-------- CONTACT AND MORE INFORMATION ----------------------------------------
The Drupal security team can be reached at security at drupal.org or via the contact form at http://drupal.org/contact [6].
Learn more about the Drupal Security team and their policies [7], writing secure code for Drupal [8], and securing your site [9].
[1] http://drupal.org/project/drupal [2] http://drupal.org/security-team/risk-levels [3] http://www.ocert.org/advisories/ocert-2011-003.html [4] http://www.hardened-php.net/ [5] http://drupal.org/project/drupal [6] http://drupal.org/contact [7] http://drupal.org/security-team [8] http://drupal.org/writing-secure-code [9] http://drupal.org/security/secure-configuration