This module will disable the error message when someone enters an invalid email address in the forgot password form. When the module is enabled, the error message will be replaced for the same message as a valid user and they will be redirected back to the login form. This is to stop hackers from guessing usernames.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | username_enumeration_prevention-1150452-15.patch | 12.49 KB | tim.plunkett |
Comments
Comment #1
joachim commentedGood idea.
I'd rather see this as a patch for core though :)
Comment #2
gregglesThere are at least three other common places that this module should directly address or document.
1. If a site has "access user profiles" granted to anonymous or authenticated users then someone can serially visit all integers in user/UID and get the username from that, or they can go through the alphabet on the core callback at http://drupal.org/user/autocomplete/tone and get the username from that
2. If a site has the views module installed then views exposes an autocomlete callback which can be similarly enumerated with letters of the alphabet to get all the names on a site. See http://drupal.org/admin/views/ajax/autocomplete/user/Tone for example. This callback doesn't have any access restrictions.
3. The "submitted by" information on nodes exposes usernames - site builders should either use realname or some other similar tool. This module could check for the presence of that function and/or an override of theme('username')
My suggestion in each case is that this module either provide documentation for these areas, or check for the problems and set messages inside the site, or all of the above.
It's probably also worth documenting the fact that names could be exposed in other places that this module doesn't know about such as views exposed filters, views themself, etc.
Given that this module is incomplete in its stated purpose I'm marking this as needs work.
There's also a leftover in the README.txt - "Installing Views:"
Comment #3
ToneUK commentedThanks for the input greggles. So what is it that you want me to do? Provide documentation once the module has been enabled about the 3 issues? Is there some way we could prevent the callbacks from being displayed when they are not called from the correct place or is it something that is called from too many places to protect?
I new about the "submitted by" being in posts but I just thought it would be best for sites that do not display any usernames to at least have some protection by not having the password reset form potentially display users. My thoughts were also that the admin user could not be guessed using the password reset form.
I did not know about the callbacks which is an even easier way of getting the users than the password reset form :( Typing in http://drupal.org/admin/views/ajax/autocomplete/user/admin gives an attacker a good start but then maybe trying to prevent every username from being found out is over the top? Especially with the brute force prevention in Drupal 7 but it still makes attacking a Drupal 6 installation easier.
I would still feel safer knowing usernames on the system could not easily be found out. What's your thoughts on this?
Comment #4
ToneUK commentedI have been doing some testing and I have found the callback you mentioned in point 1 is only an issue with Drupal 7. Running tests on the latest Drupal 6 show access denied messages for all users apart from admin. As for the views callback mentioned in point 2, the following code put in this module should prevent that:
The code only allows the callback to be run when the user has permission to administer the views. Although, I assume this should be checked with views team to make sure it has no issues. I think, I just need to find out why the first callback does not have the same behaviour in Drupal 7 as it does in Drupal 6 and then like you say display warnings for the remaining issues.
Cheers
Comment #5
gregglesFor the autocomplete callbacks you could do a hook_menu_alter and require the "access user profiles" permission to use them. That makes more sense than administer views. Contrary to the URL, the views callback is used in user facing views.
For the "submitted by" information I think you should do 2 things:
1. look for the realname module and/or an override of theme_username - http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/6 shoudl provide example code for how to find that override
2. Provide documentation about this problem in a README.txt and on the project page
Comment #6
ToneUK commentedOk, I don't think there is anything that can be done for the views callback then. Maybe an issue could be submitted to views and they could do something to prevent the callback being called directly? I will add the documentation to the README and project page and also make the module check for realname and a username override.
I will add the issues you have mentioned to the documentation and add some checks with warnings into the module. I will make the module check the following on enable:
1. If the "access user profiles" has been granted to anonymous users. Display warning.
2. If views is enabled. Display warning and information about the views callback.
3. Recommend realname to obfuscate usernames from submitted content.
Comment #7
gregglesWhy not a hook_menu_alter?
I agree an issue in views would be a good idea as well.
Comment #8
ToneUK commentedThere is already an issue http://drupal.org/node/1069326 and they have come up with a patch. Only problem is if I do the same thing in this module, it could potentialy cause issues for certain users of views.
Comment #9
gregglesI suggest you use hook_menu_alter to change the permission required. Do not mess with an extra POST parameter (that is not actually security).
Comment #10
ToneUK commentedI have made the changes asked for and also added the hook_menu_alter for the views callback.
Comment #11
ToneUK commentedbump, its been over a week now and would like some feedback on getting full access. I also have another module pending review at http://drupal.org/node/1157628
Thanks
Comment #12
ToneUK commentedBump.
Would like some feedback on getting full access.
I have this and another project that I would like to change from Sandbox to release http://drupal.org/sandbox/ToneUK/1180974
Thanks
Comment #13
svendecabooterMarking as critical as per http://drupal.org/node/894256
Sorry for the long wait.
Comment #14
sreynen commentedIt looks like you've addressed all of greggles' feedback and I don't see any further issues. Note: we only review one project as part of this approval process. If you'd like a review of your second project, the peer review group is a good place to ask.
Comment #15
tim.plunkettI agree that this module is ready for a release, even though it has some coding standards issues.
Attached is a patch that will handle most of the problems for you.
I've granted you full project creation rights. Use this ability carefully!
Thank you for your patience.