Skip to content
FunnelGuard

Fix guide by FunnelsGuard

User enumeration via REST API and author pages: how to fix it

OPS-169Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

User enumeration is when anyone can discover the usernames on your site without logging in. On WordPress this happens in two common ways. The REST API route /wp-json/wp/v2/users lists public authors with their slug. The old trick /?author=1 redirects to /author/<username>/, which exposes the author slug, and by default that slug is often the login name.

Why it costs you leads or sales

The direct cost is small. The risk is indirect: a known admin username makes brute-force and credential-stuffing attempts more efficient. A hijacked account can then change forms, redirect traffic, inject spam or take the site down, and that is when leads and sales are lost.

How enumeration leads to lost leads
  1. Username leaked/wp-json/wp/v2/users or ?author=1 shows the login name
  2. Password guessingAttacker targets a known account
  3. Admin takeoverForms, redirects or scripts altered
  4. Leads and sales lostBroken forms, spam, blocklisting

The leak is the first step; the damage comes later if other defences are weak.

How to check if your site has it

Test your own site
  1. Open the users REST routeWordPress

    Visit https://yoursite.com/wp-json/wp/v2/users in a private window. A JSON list with "slug" values means usernames are exposed. A 401 or 403 error means it is restricted.

  2. Try the author redirectWordPress

    Visit https://yoursite.com/?author=1. If you land on /author/something/, the slug is public.

  3. Compare slug and login nameWordPress

    In Users, check whether the exposed slug equals the username you log in with. If it does, the leak is directly useful to an attacker.

  4. Check from the command line

    Run the curl commands below and read the response codes.

  5. Check sitemaps and feedsWordPress

    Open /wp-sitemap-users-1.xml and /author/ pages. Author sitemaps list author URLs.

Quick checks with curlbash
curl -s -o /dev/null -w "%{http_code}\n" https://yoursite.com/wp-json/wp/v2/users
curl -s -I "https://yoursite.com/?author=1" | grep -i -E "^(HTTP|location)"

How to fix it

Fix by platform
  1. Restrict the users REST route

    Add the snippet below to a small custom plugin or your child theme's functions.php. It removes the users routes for visitors who are not logged in.

  2. Stop the ?author= redirect

    Use the second snippet to send ?author=N requests to the home page.

  3. Separate login from public name

    Under Users > Profile, set a Nickname and choose it under 'Display name publicly as'. If the login is also the slug, create a new admin with a different login and delete the old one.

  4. Handle author archives and sitemaps

    If you have one author, disable author archives with your SEO plugin (for example, Yoast SEO: Settings > Advanced > Author archives). This also removes them from the sitemap.

Restrict the users REST route to logged-in usersphp
add_filter( 'rest_endpoints', function( $endpoints ) {
    if ( ! is_user_logged_in() ) {
        unset( $endpoints['/wp/v2/users'] );
        unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] );
    }
    return $endpoints;
} );
Redirect ?author=N requests to the home pagephp
add_action( 'template_redirect', function() {
    if ( ! is_admin() && isset( $_GET['author'] ) ) {
        wp_redirect( home_url( '/' ), 301 );
        exit;
    }
} );
Block ?author= at the server (nginx)nginx
if ($args ~* "(^|&)author=\d+") {
    return 403;
}

How to confirm it's fixed

Confirmation checks
  • /wp-json/wp/v2/users returns 401, 403 or 404 in a private window
  • /?author=1 no longer redirects to /author/username/
  • Author sitemap and archives are gone or show only a safe display name
  • The public slug is not your login name
  • Contact forms, checkout and search still work
Before and after

Exposed

  • /wp-json/wp/v2/users returns JSON with slugs
  • ?author=1 redirects to /author/admin/
  • Login name equals public slug

Hardened

  • Users route returns 401 or 403 for visitors
  • ?author= requests go to the home page
  • Public name differs from login name

How to prevent it happening again

Keep it closed
  • Use a unique login name that is never shown publicly
  • Turn on 2FA and rate limiting for admin accounts
  • Keep WordPress core and plugins updated, since updates and new plugins can re-expose routes
  • Re-run the two checks after changing themes, SEO plugins or security plugins
  • Include this check in your regular security review

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard runs your customer journeys, such as lead forms and checkouts, and checks tracking and lead delivery. It does not test for exposed usernames or other web application security weaknesses.

The kind of tool that fits is a web vulnerability scanner or a WordPress security scanner, ideally paired with a web application firewall that can rate-limit logins. Run the scan on a schedule and after major changes.

Questions people ask

Why can people see my WordPress usernames at /wp-json/wp/v2/users?

WordPress exposes public authors through the REST API by default. The response includes each author's slug, which is often the same as the login name. You can restrict the route to logged-in users with the rest_endpoints filter.

How do I stop ?author=1 from revealing my username?

Redirect any request with an author query parameter to the home page, using a template_redirect hook or a server rule. Also change your public display name and make sure the author slug differs from your login.

Is user enumeration a serious vulnerability?

On its own it is usually rated low. It gives attackers a valid username, which makes password guessing easier. The risk grows if you have weak passwords, no 2FA or no login rate limiting.

Will disabling the users REST endpoint break my site?

It can, if a plugin or headless front end reads that route for logged-out visitors. The block editor still works because you are logged in. Test forms, search and any apps after making the change.

How do I change my WordPress author slug?

The slug is based on the user's login name. Create a new user with a different login, give it the admin role, then delete the old user and reassign its content. Also set a separate public display name in the profile.

How can I test if my site leaks usernames?

Open /wp-json/wp/v2/users and /?author=1 in a private window. If you see a JSON list or land on an /author/name/ page, usernames are exposed. A 401, 403 or 404 means that route is blocked.

Can FunnelGuard detect user enumeration?

No. This is outside what FunnelGuard checks. Use a web vulnerability scanner or a WordPress security scanner for it.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.