Recently we had a rash of brute-force hacking attempts on a variety of WordPress sites that we manage. The commonality in the attacks is that they all originated from the Ukraine – more specifically they all came from the Kyivstar ISP.
A user with IP address 18.104.22.168 has been locked out from the signing in or using the password recovery form for the following reason: Exceeded the maximum number of login failures which is: 20. The last username they tried to sign in with was: ‘admin’
User IP: 22.214.171.124
User hostname: 37-115-188-126-broadband.kyivstar.net
I looked for a variety of ways to block this, and ultimately decided to do it based on IP address. Through a little research I found that Kyivstar has 14 different IPv4 origin ranges, so they all needed to be blocked individually. Fortunately, this is possible through the WordFence Plugin.
If you’re not using WordFence, go install it right now. They have a free version that offers a ton of functionality but upgrading to the pro version is certainly worthwhile in my opinion.
Blocking IP Address Ranges in WordFence
Blocking IP address ranges in WordFence is easy. Simply go to WordFence >> Advanced Blocking and there is an input for the IP address range. You’ll need to enter all 14 of the following ranges individually. I named them all “Kyivstar Block X of Y” but you can give them whatever name you want.
The 14 IP address ranges that you need to block are:
- 126.96.36.199 – 188.8.131.52
- 184.108.40.206 – 220.127.116.11
- 18.104.22.168 – 22.214.171.124
- 126.96.36.199 – 188.8.131.52
- 184.108.40.206 – 220.127.116.11
- 18.104.22.168 – 22.214.171.124
- 126.96.36.199 – 188.8.131.52
- 184.108.40.206 – 220.127.116.11
- 18.104.22.168 – 22.214.171.124
- 126.96.36.199 – 188.8.131.52
- 184.108.40.206 – 220.127.116.11
- 18.104.22.168 – 22.214.171.124
- 126.96.36.199 – 188.8.131.52
- 184.108.40.206 – 220.127.116.11
Warning: This will block 709,632 IP addresses! That’s a ton of addresses, but in this case it was worth it because we have no legitimate traffic originating from these IPs. The focus of the particular series of blogs that I’m securing is for a particular demographic of people who are largely based in the United States, so blocking traffic from the Ukraine isn’t a huge concern. We figure that odds of a blog reader being on vacation in the Ukraine and happening to use Kyivstar for internet AND getting angry because they can’t access the blog is low.
There are always tradeoffs, and this was an acceptable one for us.
It certainly would have been easier to block on hostname, but there are two problems with this:
- WordFence doesn’t have this capability
- It would require a reverse DNS lookup on each IP address which would be a huge load on the server which would negatively impact page load times which could hurt SEO ranking.
It’s my guess that WordFence doesn’t have hostname blocking for this very reason, but that’s speculation on my part.
This is a pretty simple way to block traffic from a broadband connection that dynamically assigns IP addresses to its customers. The same approach could be used to block any ISP, but be extra careful to make sure you’re not blocking legitimate traffic to your blog.