Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look at return code in addition to request path #13

Open
yitzhaq opened this issue Apr 18, 2021 · 2 comments
Open

Look at return code in addition to request path #13

yitzhaq opened this issue Apr 18, 2021 · 2 comments

Comments

@yitzhaq
Copy link

yitzhaq commented Apr 18, 2021

Currently, the strategy to handle false positives seems to be to "make sure you stop using such plugins or themes and rename any folders or files to something more suitable".

Wouldn't it be better if instead the regex was updated to take return code into consideration? Like, say the entry for wp-login.php - this makes the filter unsuitable for any site actually powered by WordPress (or at least which uses WordPress at root level). To stop using WordPress, or renaming wp-login.php, will not be practical for most users.

If the regex was instead updated to take the return code into consideration, no such adjustments would be required. A 200, 301 or similar would not match, whereas a 404, 403 etc would match. That way, any site which does run WordPress would be excluded, and requests against a site not powered by WordPress, where one can reasonably assume that such requests are indeed just probing, can match and trigger.

@yitzhaq
Copy link
Author

yitzhaq commented Apr 18, 2021

I am getting much better results with this (which I'm sure could be further improved):

^<HOST> -.*(GET|POST|HEAD).*(\/wp-login\.php.*\ (403|404)\ )

@yitzhaq
Copy link
Author

yitzhaq commented Apr 18, 2021

Actually, for WordPress, this works better:

^<HOST> -.*POST.*(\/(wp-login|xmlrpc)\.php.*\ (200|403|404)\ )

Limited to POST since a GET or HEAD against these endpoints can't really do any harm. And 200 included because a successful auth (with POST) will result in a redirect, whereas a failed one will return a 200.

(Some inspiration borrowed from https://graspingtech.com/using-fail2ban-protect-wordpress-blog-brute-force-attacks/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant