Drupal 6.x Core XSS Vulnerability

30 November -0001

Description of Vulnerability:

Drupal (http://drupal.org) is a robust content management system (CMS) written in PHP and MySQL that provides extensibility through various third party modules. The Locale module "Enables the translation of the user interface to languages other than English." The Local module is one of the Drupal core modules, distributed with every Drupal site, but not enabled by default.

Systems affected:

Drupal 6.14 was tested and shown to be vulnerable.

Impact:

XSS vulnerabilities may expose site administrative accounts to compromise which could lead to web server process compromise.

Mitigating factors:

To carry out the XSS exploit below the attacker must have 'administer languages' permissions.

Proof of Concept:

  1. Install Drupal 6.14 and enable the Locale module from Administer -> Modules
  2. Click Administer -> Site configuration -> Languages
  3. Click 'Add language'
  4. Expand the form area by clicking 'Custom language'
  5. Enter "<script>alert('xss1');</script>" in the 'Language name in English' text area
  6. Enter "<script>alert('xss2');</script>" in the 'Native language name' text area
  7. Enter arbitrary values for 'Direction' and click the 'Add custom language' button
  8. Click Administer -> User management -> Users
  9. Click the 'Add user' button to observe the rendered JavaScript

Technical details:

The locale module fails to sanitize the output of the language name and native language name before display. Applying the following patch fixes this vulnerability.

Patch

Applying the following patch mitigates these threats.

--- modules/locale/locale.module    2009-02-25 06:47:37.000000000 -0500
+++ modules/locale/locale.module      2009-11-11 14:26:40.704648132 -0500
@@ -229,7 +229,7 @@ function locale_user($type, $edit, &$use
       '#type' => (count($names) <= 5 ? 'radios' : 'select'),
       '#title' => t('Language'),
       '#default_value' => $user_preferred_language->language,
-      '#options' => $names,
+      '#options' => array_map('filter_xss', $names),
       '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? t("This account's default language for e-mails, and preferred language for site presentation.") : t("This account's default language for e-mails."),
     );
     return $form;

Vendor Response

Upgrade to the latest version.