- Advisory ID: DRUPAL-PSA-2012-001
- Project: Drupal core
- Version: 6.x, 7.x
- Date: 2012-01-11
- Security risk: Less critical
- Exploitable from: Remote
- Vulnerability: Denial of Service
Update, June 12th 2012: this advisory is related to flaws in PHP with CVE identifiers CVE-2011-4885 and CVE-2012-0830. Users are encouraged to update the PHP used for their site to a version that is known to fix those vulnerabilities. See below for mitigation techniques if your site runs a version of PHP that doesn't contain those fixes and you cannot change it.
PHP is vulnerable to a hash collision denial of service (DOS) 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 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.
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 0
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 project page.
- 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.