Question

Wordpress Fail2Ban Cron Attack Configuration

Notice that a new kind of attack started to occur on Apache2 Wordpress servers that the default Fail2Ban configuration does not discover.

Attack are aimed towards cron.php If you in /var/log/apache2/access.log find something like POST /wp-cron.php?doing_wp_cron=1482585007.5419580936431884765625 HTTP/1.1

Solution / Fix edit /etc/fail2ban/jail.config and add this at bottom

[cron]
enabled = true
filter = cron
action = iptables[name=cron, port=http, protocol=tcp]
logpath = /var/log/apache2/access.log
bantime = 43600
maxretry = 2

create file /etc/fail2ban/filter.d/cron.conf and add this

[Definition]
failregex = ^<HOST> .*POST .*wp-cron\.php.*
ignoreregex =

Open up SSH and run service fail2ban restart To check status run tail -f /var/log/fail2ban.log

Extra XMLRPC attacks are nothing new but i put the config for it here also

edit /etc/fail2ban/jail.config and add this at bottom

[xmlrpc]
enabled = true
filter = xmlrpc
action = iptables[name=xmlrpc, port=http, protocol=tcp]
logpath = /var/log/apache2/access.log
bantime = 43600
maxretry = 2

create file /etc/fail2ban/filter.d/xmlrpc.conf and add

[Definition]
failregex = ^<HOST> .*POST .*xmlrpc\.php.*
ignoreregex =

Restart fail2ban again for settings to be active.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Ryan Quinn
DigitalOcean Employee
DigitalOcean Employee badge
December 27, 2016
Accepted Answer

Thanks for sharing this!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.