Drupal 6.x Core XSS Vulnerability
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.
Drupal 6.14 was tested and shown to be vulnerable.
XSS vulnerabilities may expose site administrative accounts to compromise which could lead to web server process compromise.
To carry out the XSS exploit below the attacker must have 'administer languages' permissions.
Proof of Concept:
- Install Drupal 6.14 and enable the Locale module from Administer -> Modules
- Click Administer -> Site configuration -> Languages
- Click 'Add language'
- Expand the form area by clicking 'Custom language'
- Enter "<script>alert('xss1');</script>" in the 'Language name in English' text area
- Enter "<script>alert('xss2');</script>" in the 'Native language name' text area
- Enter arbitrary values for 'Direction' and click the 'Add custom language' button
- Click Administer -> User management -> Users
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.
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;
Upgrade to the latest version.