Even Easier Brute-force Login Protection for Wordpress
Here’s another *easy* way to help with those pesky wordpress brute-force logins we have been hearing about. Most automated attacks make a lot of assumptions. Like where your blog’s login page is located, and what information is needed to login via that page. It’s really easy to take those assumptions and make them wrong. The trick is doing it in a way that doesn’t mess up your real users, and can be done without modifying source code. I am writing this for the much-outdated Apache 2.2, since that’s what my server is running. The 2.4 version can easily (and more elegantly I might add) do the same thing, but uses different modules. This example uses only mod_rewrite and mod_usertrack, which should make the scope a little wider, since it’s something that many users will be able to implement in a .htaccess file. So, this is so laughably simple to setup (only 7 lines in the config file!) that you might think it’s useless (and in a week or two it could be,) but the simple truth is most brute-force hacking tools can’t do a lot of things that a real web-browser does all the time. Like follow 302 redirects, and use session cookies. It’s very easy to do this with Apache in a way that doesn’t break the login process for normal users, but will trip up many automated attack tools. So the premise is this, if requests are being generated by a real user that user will likely visit via a link (or maybe even a saved bookmark) to the login page, they will fill out a form, and then submit it. If it’s an attack script, it’s likely got the POST target hard-coded. So here’s an easy way to deal with that.
- When a request comes into the login page, check if there is a session setup for it.
- If the session is valid, process the request.
- If it isn’t, perform a 302 redirect to a (rewritten) version of the login page that will set the session. (Discarding, and ignoring the POST form data in the case of a login attempt!)
I can already hear your thoughts … but that doesn’t validate anything! True, but if you really want you can do that through by adding on mod_security’s session tracking on top of the above measures. See here and here for more on that.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25