Make WordPress Core

Opened 8 years ago

Last modified 2 years ago

#39645 new defect (bug)

If user "admin" doesn't exist (renamed admin account) users can create a user with username admin

Reported by: jobst's profile jobst Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.1
Component: Users Keywords: has-patch
Focuses: Cc:

Description

I am not sure whether this is a bug, should be discussed or changed.

I have renamed my "admin" account to something else for security reasons.

I was surprised to see a person being able to create a user with username "admin" due to the email address given "admin@…".

I cannot count the amount of script kiddies trying to get into the installation everyday using 'admin' ... so having a user with username "admin" it is a little bit of a security problem.

Should there not be a way to disable the creation of particular usernames?
Should this be done through wordpress core?

Would this not be a good feature to have that certain usernames cannot be created?

Attachments (3)

39645.diff (1.2 KB) - added by Presskopp 8 years ago.
39645.2.diff (861 bytes) - added by Presskopp 3 years ago.
refreshed patch
39645.3.diff (907 bytes) - added by noam@… 3 years ago.

Download all attachments as: .zip

Change History (22)

#1 follow-up: @lukecavanagh
8 years ago

@jobst

So being able to disallow specific usernames to be a core feature?

#2 follow-up: @mrtortai
8 years ago

There are millions of bots targeting WordPress login pages and 'admin' is by far the most common username attempted. A common security recommendation to harden an installation is to change the default 'admin' username to something else.

There are security plugins available which let you block certain usernames. However, I wonder if WP core prevented 'admin' and 'administrator' from ever being used, how it will impact security as well as usability.

I think it could be a boost to security with very little usability impact.

#3 follow-up: @Presskopp
8 years ago

I wonder if there are living people called 'Admin'?

http://www.babynamespedia.com/meaning/Admin

2c

#4 in reply to: ↑ 1 @jobst
8 years ago

Replying to lukecavanagh:

@jobst

So being able to disallow specific usernames to be a core feature?

Sorry for the delay - been in the country with not so good Internet access.

Yes, @lukecavanagh, disallow specific usernames to be a core feature.

Jobst

#5 in reply to: ↑ 3 @jobst
8 years ago

Replying to Presskopp:

I wonder if there are living people called 'Admin'?

http://www.babynamespedia.com/meaning/Admin

2c

@Presskopp, the problem is the username "admin" is the default administrator username and someone being called "Admin" as first name is rather seldom. I'd rather have the core return "not exist" then adding CPU cycles checking the password and returning "username and/or password incorrect".

#6 in reply to: ↑ 2 @jobst
8 years ago

Replying to mrtortai:

There are millions of bots targeting WordPress login pages and 'admin' is by far the most common username attempted. A common security recommendation to harden an installation is to change the default 'admin' username to something else.

There are security plugins available which let you block certain usernames. However, I wonder if WP core prevented 'admin' and 'administrator' from ever being used, how it will impact security as well as usability.

I think it could be a boost to security with very little usability impact.

Fully agreed.

@Presskopp
8 years ago

#7 follow-up: @Presskopp
8 years ago

Some 'proof of concept' patch to play around.

#8 @lukecavanagh
8 years ago

39645.diff Patch applies cleanly.

#9 @Presskopp
8 years ago

Thank you @lukecavanagh , but in this form it will not be translated for example, that's why I'm playing with

$errors->add( 'invalid_username', ( __( 'Security error.') . ' ' . __( 'Cheatin’ uh?') ) );

or we would introduce a new string..

Would be nice to know if this is ending up as a wontfix, but I see some sense in it.

#10 in reply to: ↑ 7 @jobst
8 years ago

Replying to Presskopp:

Some 'proof of concept' patch to play around.

Looks good!!!
thanks

#12 @SergeyBiryukov
5 years ago

#48910 was marked as a duplicate.

@Presskopp
3 years ago

refreshed patch

#13 @Presskopp
3 years ago

  • Keywords has-patch added

@noam@…
3 years ago

#14 @Presskopp
3 years ago

@noamcleanforestsolutionscom I don't think we need to use strtolower because adMin or aDmIn etc. would not appear to be the real admin account imo.

#15 @jobst
3 years ago

@Presskopp the fix including the 'strtolower' does not cost lots of space nor does it cost lots of computing power but it helps the admin to have a clean site without a suspicious username.

Keep the 'strtolower' 100%.

#16 @jobst
3 years ago

I would even go so far as using

strncasecmp(strtolower($sanitized_user_login), 'admin', 5)

for the comparison, anything starting with "admin" would be disallowed.

#17 @Presskopp
3 years ago

Ok, then if we go into that direction we could also think about using Spoofchecker::isSuspicious

#18 @jobst
3 years ago

@PressKopp: That too!

Last edited 3 years ago by jobst (previous) (diff)

This ticket was mentioned in Slack in #core by presskopp. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.