On August 10, 2014 at 11:25pm, Matt V. reported the following along w/ the attached patch...

I ran the Coder Review module against version 7.x-1.7 of the "Redirect 403 to User Login" module and it flagged the following:

sites/all/modules/contrib/r4032login/r4032login.module:
 +116: [critical] Potential problem: drupal_set_message http://api.drupal.org/api/function/drupal_set_message/() only accepts filtered text, be sure to use check_plain http://api.drupal.org/api/function/check_plain/(), filter_xss http://api.drupal.org/api/function/filter_xss/() or similar to ensure your $variable is fully sanitized.

I can confirm the XSS vulnerability in both the Drupal 6 and 7 versions. In Drupal 7, I went to the Site Information Page and added <script>alert(document.cookie);</script> to the end of the "User login 'access denied' message" field. When I then open a separate incognito window (not logged into the site) and try to visit /admin, my cookie for the site appears in a popup.

In the Drupal 6 version, the effect is the same, though the administration page is titled "Redirect 403 to User Login" and the field is "Display access denied message on login page".

I'm attaching a patch that fixes the issue for me.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bdone’s picture

Greggles supplied a second patch and added...

I was able to replicate the issue. Attached is a patch that uses filter_xss_admin - I think that makes more sense given that the permission required to exploit this issue is "administer site configuration".

After careful review, this vulnerability can be fixed publicly as per http://drupal.org/security-advisory-policy because
* it requires the compromised account to have an advanced permission that already makes the site compromised

Please file a critical bug report against http://drupal.org/node/add/project-issue/r4032login?tags=Security%20impr... in the public issue queue. I'm granting access to this issue for the module maintainers so they are aware of it.

Thank you for reporting this issue to the Drupal security team.

bdone’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.