What is the WordPress REST API User Enumeration vulnerability?
One vulnerability that is of low severity, according to Acunetix, but can pose a significant threat to WordPress websites is the WordPress REST API User Enumeration vulnerability. Since the release of WordPress 4.7.1, the user enumeration vulnerability has become a cause for concern among website owners. In this comprehensive blog post, we will explore the intricacies of user enumeration, discuss the associated security risks and concerns, and provide in-depth remediation strategies to ensure the security and protection of your WordPress site.
Understanding the User Enumeration Vulnerability:
User enumeration is an attack technique that allows malicious actors to extract information about registered users on a WordPress website. Before WordPress 4.7, this vulnerability was not a significant concern. However, with the introduction of the WordPress REST API, attackers gained the ability to retrieve user information through API calls. If left unprotected, this feature can be exploited to obtain a list of usernames or user IDs, which can be leveraged for subsequent attacks, such as brute-force passwords.
How do website attackers enumerate users using WPScan?
WPScan security scanner is often considered a versatile tool for enhancing WordPress security. In addition to its primary purpose of detecting vulnerable plugins, themes, and WordPress core installations, WPScan can also be utilized for a technique called user enumeration.
Executing the following command initiates WPScan's user enumeration feature, which aims to retrieve a list of all users associated with a specific WordPress installation.
wpscan –url http://wordpress-website-example.com –enumerate u
Why does WordPress have user enumeration?
WordPress user enumeration is inherent in every WordPress site by default due to a feature called 'permalinks.' Permalinks are permanent URLs assigned to individual WordPress posts and pages, typically represented as https://wordpress-website-example.com/?p=123.
Apart from posts and pages, WordPress also permits listing all posts associated with a specific author's username using a URL structure like https://wordpress-website-example.com/author/matt.
It is important to note that WordPress also allows authors to be referenced by their ID, which leads to a redirect to the URL mentioned above containing the username (e.g., https://wordpress-website-example.com/?author=1). Attackers can exploit this functionality to identify valid usernames associated with a specific WordPress site.
Security Risks and Concerns:
Knowing users' usernames on your WordPress website does not directly lead to immediate, impactful problems. During this initial phase, attackers aim to gather as much information as possible about the target website. This includes usernames, installed plugins and themes, their versions, and other factors.
The user enumeration vulnerability in WordPress gives rise to several security risks and concerns that website owners must be aware of:
Brute-Force Attacks
Armed with a list of usernames or user IDs obtained through user enumeration, attackers can launch brute-force attacks to guess passwords and gain unauthorized access to user accounts. This can lead to data theft, defacement of the website, or even complete compromise of the system.
Social Engineering
User enumeration exposes usernames, providing attackers with valuable information that can be exploited for social engineering attacks. Armed with the knowledge of specific usernames, attackers can craft convincing phishing emails or messages tailored to target individual users, to trick them into revealing sensitive information or performing unintended actions.
Account Harvesting
User enumeration facilitates the collection of valid user credentials, which can be sold on the dark web or used in credential-stuffing attacks. By reusing leaked credentials across multiple websites, attackers can gain unauthorized access to accounts and potentially cause significant damage.
Privacy Concerns
User enumeration compromises the privacy of website users by exposing their usernames or user IDs. Malicious actors can use this information to build user profiles, track user activity, or launch targeted attacks against specific individuals or organizations.
Preventing User Enumeration on WordPress
While knowing the usernames alone may not enable them to hack into your website directly, limiting the amount of information available to them is still crucial. Reducing their knowledge about your website increases the overall security posture.
By implementing measures to hide usernames and other sensitive details, you can mitigate the risk of targeted attacks and ensure the security of your WordPress website. Remember, the more information you can conceal from attackers, your website will be better protected.
Here are some ways to prevent user enumeration on your WordPress Website:
- Disable WordPress REST API if it's not being used. This can be configured for custom post types. A lot of WordPress Block Editor-enabled themes need the REST API enabled, so disable it with caution. We recommend using the Disable WP REST API Plugin.
- Disable WordPress XML-RPC. This applies to about 99% of websites. We prefer to use the Disable Comments plugin for this because we can secure a site two ways because it includes a way to disable XML-RPC.
- Don’t expose /wp-admin and /wp-login.php paths directly. We prefer to use WPS Hide Login for this.
- Do not use a WordPress username as the Display Name.
- Configure your web server to block requests to /?author=<number> (This varies by server. Apache Example below)
.htaccess file code example to block author scans
# BEGIN block all author scans
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (author=\d+) [NC]
RewriteRule .* - [F]
# END block all author scans
Remediation Strategies and Solutions
To effectively mitigate the risks associated with user enumeration vulnerability in WordPress, website owners can implement the following remediation strategies:
Utilize WordPress Security Plugins

Install and configure reputable security plugins that specifically address user enumeration vulnerabilities. One such plugin is "Stop User Enumeration," which blocks initial enumeration attempts and allows you to log IP addresses for further blocking. These plugins add an extra layer of protection and help prevent unauthorized access to user information.
Disable REST API User Endpoints
WordPress provides granular control over REST API endpoints. Disabling user-related endpoints can prevent unauthorized access to user information via the API. This can be accomplished by adding custom code snippets to your theme's functions.php file or by utilizing security plugins or the Disable WP REST API plugin that offer this functionality.
Implement Google ReCAPTCHA
Introduce CAPTCHA challenges or rate-limiting mechanisms to impede automated scripts attempting to enumerate users. CAPTCHA presents a challenge that only humans can solve, thereby deterring bots from further exploration.
Regularly Update WordPress
Keeping your WordPress installation and plugins up to date is crucial for maintaining security. WordPress frequently releases updates that address vulnerabilities, including user enumeration. By promptly applying these updates, you ensure that your site benefits from the latest security patches and enhancements. Having a WordPress Maintenance Plan in place is the best way to keep up with the latest security updates.
Related: The Importance of Maintaining Your WordPress Website
Use Strong Passwords and Two-Factor Authentication
It's important to use strong and unique passwords, understand the risks of password reuse, and the need to be cautious of phishing attempts. Regularly adopt good security practices, such as enabling two-factor authentication and promptly reporting any suspicious activity to your website security team.
Implement a Web Application Firewall (WAF)
Consider implementing a web application firewall to provide an additional layer of protection. A WAF can detect and block malicious requests, including user enumeration attempts before they reach your website.
Change the default WordPress login URL
Securing your WordPress login page is essential for safeguarding your website from unauthorized access. One effective method is to change the default login URL. When you modify the login URL, it becomes more challenging for hackers to locate the login page, making it harder for them to breach your website's security. By obscuring your login page's address, you enhance your site's protection. When the login page is not easily identifiable, potential attackers must invest additional time and effort to discover its location. This is a deterrent, discouraging automated scripts and malicious individuals from attempting to breach your website's security defenses. Implementing this measure significantly reduces the risk of successful user enumeration attacks and unauthorized access attempts.
To implement a custom login URL, you can leverage various plugins available in the WordPress repository, such as "WPS Hide Login." These plugins allow you to customize the login URL to a unique address that is not readily associated with WordPress. It is crucial to choose a custom login URL that is complex and not easily guessable, as this enhances the effectiveness of the security measure.
The Takeaway
The User Enumeration vulnerability in WordPress poses a threat to the security and privacy of website owners and users. By understanding the nature of this vulnerability and implementing the recommended remediation strategies, you can effectively protect your WordPress site from user enumeration attacks. Security plugins, disabling REST API user endpoints, implementing CAPTCHA, regularly updating WordPress, maintaining strong passwords, considering additional security measures such as web application firewalls, and using plugins like WPS Hide Login are all vital steps to prevent the exposure of user data and maintaining a secure online presence. By staying proactive and employing these security measures, you can fortify your WordPress website against user enumeration vulnerabilities and ensure the integrity of your WordPress website.