22

We are having some issues with an external developer.

We want to limit access to the wp-admin site to internal access only (via VPN). Simply so it will not be attacked by external users. We can enumerate the admins from the site and do not want them to be phished.

Our developer is saying we can't do that because the site needs to have the admin page accessible externally so the page will function. specifically the admin-ajax page.

What does the admin-ajax.php page do?

It is located in the admin section of WordPress. Is it accessed unauthenticated by end users? Is it an unsafe practice to have this available to external users?

1

3 Answers 3

15

admin-ajax.php is part of the WordPress AJAX API, and yes, it does handle requests from both backend and front. Try not to worry about the fact that it is in wp-admin. I think that is a strange place for it too, but it is not a security problem in itself. How this relates to "enumerate the admins", I don't know.

3
  • would you recommend moving the wp admin page from being externally available? and do you know if doing so would disrupt anything with the ajax admin?
    – nick
    Commented Dec 27, 2012 at 16:38
  • I am not 100% sure what this means but if you require that access to files in wp-admin be from your VPN's IP, then yes that should mess up AJAX. AJAX calls are from the user's browser so come from the user's IP.
    – s_ha_dum
    Commented Dec 27, 2012 at 16:52
  • 1
    Can you explain why, specifically, it is not a security problem for us n00bs? Otherwise, decent answer.
    – daaxix
    Commented Apr 28, 2015 at 18:53
8

For unauthenticated and untrusted users, you'll want to make two specific exceptions to your VPN / Firewall / Apache .htaccess, which are:

  • example.com/wp-admin/admin-post.php
  • example.com/wp-admin/admin-ajax.php

These are two auto-magic endpoints used by a lot by both internal WP and also various plugins.

Here's some explanation of what admin-post.php does:

admin-ajax.php works in a very similar way, and a helpful explanation is here.

4

If you want to limit access to the WP backend (ex: wp-admin), just use a .htaccess rule on the wp-admin directory.

Check out this article for a general overview: Password Protect a Directory Using .htaccess

Also check out this topic for your specific case: Password protecting /wp-admin/

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.