IPBan – The Simplest Way to Block Hackers and Bot Nets




IPBan for Windows Donation

Is your server getting hacked? Do you need to block ip addresses automatically? Dealing with a brute force attack? Don’t want to spend your life savings on SysPeace or other overly priced security software? IPBan is for you.

A while ago, I noticed a disturbing trend in the event viewer on one of our dedicated Windows servers. We were getting thousands of failed login attempts to terminal services (remote desktop). I decided I would enable the terminal services auto-ban, so after 5 login attempts the ip address would get banned for 24 hours. This only solved part of the problem, as the attacker continued to flood our server with requests, causing the windows logon process (csrss.exe kept appearing and disappearing in task manager) to continually spin up and shut down. This actually caused significant CPU (10%+) and disk IO as the event viewer continually wrote failed login attempts.

After searching the Interwebs for a better way, I did not find anything that I liked or that didn’t spike my CPU usage, so I decided to make a free (if you install it yourself) tool in C# to auto-ban ip addresses. This tool is constantly improving. Right now it can block ip addresses as found in the event log for audit-failure events. It is very configurable as well.

Features include:
– Unlimited number of ip addresses to ban
– Duration to ban ip address
– Number of failed login attempts before ban
– Whitelist of comma separated ip addresses or regex to never ban
– Blacklist of comma separated ip addresses or regex to always ban
– Custom prefix to windows firewall rules
– Custom keywords, XPath and Regex to parse event viewer logs for failed login attempts
– Refreshes config so no need to restart the service when you change something
– Highly configurable, ban anything that comes through Windows Event Viewer
– A GREAT and FREE (if you install it yourself) alternative to RdpGuard or Syspeace
– Contains configuration to block Remote Desktop attempts, Microsoft SQL Server login attempts and MySQL Server login attempts by default
– Runs on Linux and Windows

If you found IPBan useful, would you consider helping support the project by donating? Thank you for your consideration.

I am also willing to do contracting work to improve IPBan if it doesn’t fit your needs or to help you set it up on your servers. Please email me at [email protected] if you would like paid services.

*INSTRUCTIONS*: https://github.com/jjxtra/IPBan




Windows IPBan Donation

Need help configuring IPBan? I’m happy to help with simple questions. For more involved assistance, I do consulting. Please email me at [email protected] and I’d be happy to consider your proposal.

Testimonials:

A few days ago I was checking the event logs for my server that hosts a MSSQL DB. I could see that I was under attack by a port scanner (changing IP addresses for each attack ‘period’). I know I should not have MSSQL exposed to the world but the users are remote so it was the easiest solution for me. Anyway, I came across IPBAN. Because of the concise directions on your Git repository I was able to easily setup a service. The results were immediate, as the banlog.txt file had an entry immediately after starting the service, thus putting an end to the current attack. The purpose of this email is simply to express my gratitude for developing the program. The people responsible for the attack are the lowlifes of the internet while you are on the complete opposite side of the scale! Thank you, thank you, thank you for the help.

– Jim

Bravo! This is a master piece!

– Periklis

Really a neat tool. This really works as advertised, and wow does it cut down on the noise. Your code structure made it really easy as well to add a couple lines to immediately ban non-US IPs (using a 3rd party geocoding service). Thanks for this great tool.

– Matt C

Sign up for the IPBan Mailing List




Windows IPBan Donation
Visit this Project on GitHub

396
Leave a Reply

avatar
140 Comment threads
260 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
105 Comment authors
jjxtrajean paganucciPaulJulianVlad Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of
jean paganucci
Guest
jean paganucci

Good evening, jjxtra, great work with IPBan, I’m already using on several clients, I’m getting this log “2019-06-04 21: 36: 07.3749 | WARN | DigitalRuby.IPBan.IPBanLog | IP 81.171.98.177,, RDP ban pending. ” It’s already a few minutes, what would it be? thank you so much again.

Paul
Guest
Paul

Awesome program jjxtra!, just joined mailing list and installed on my win2016 term server for testing. I used your application years back but it looks like it has come a long way, keep up the good work. Will donate after testing and looking forward to the GUI!

Julian
Guest
Julian

Hi everyone, Great program and good potential! Tried to set IPBAN up for Kerio Connect mail server log files. I set it up to react on these 2 scenarios (text lines from mail server log): 1) IMAP: Invalid password for user [email protected] Attempt from IP address 186.xxx.xxx.xxx. 2) SMTP: User [email protected] doesn’t exist. Attempt from IP address 186.xxx.xxx.xxx. The config is regex is set up like this : Attempt\sfrom\sIP\saddress\s(?.?) So it reacts to both these with one regex but the IP address extracted is wrong. Running IPBan returns this : 2019-05-11 23:13:31.7582|WARN|DigitalRuby.IPBan.IPBanLog|Login failure: 0.0.0.1, , Kerio, 88 2019-05-11 23:13:31.7582|WARN|DigitalRuby.IPBan.IPBanLog|IP 0.0.0.1,… Read more »

Vlad
Guest
Vlad

Great work,  almost or even better f2b. Thank you!

I have some questions,  i found in config file settings for Ipban pro, i changed it for my needs but nothing, does that settings work ?  Where i can by pro and i need some additional functionality, not for free of course,  need online connection monitoring smth like ntop on linux.

Thank again.

Jaymer
Guest
Jaymer

Thats whats odd… it IS adding the IP to the Windows Firewall IP list (from what I can tell).  I sent you several files.  Hope you can find something.

Am having trouble Replying on this site.  Clicking REPLY doesn’t really do anything.  I manually moved down to the comments windows at the bottom so I don’t know if this is going to make a new thread or reply to you.

Jaymer
Guest
Jaymer

Followup: Maybe what is confusing me is terminology… Take this line from logfile.txt 2019-04-24 19:54:35.5069|WARN|DigitalRuby.IPBan.IPBanLog|Login attempt failed: 185.156.177.220, , RDP, 60 I see this IP has been added to an IPBAN Rule in Windows Firewall by your process.  Thats awesome.  This was their 60th attempt. But for the logfile to say “Login attempt failed” means [to me] they actually got thru a firewall and tried to login to an account, and failed.  Instead, maybe the msg should be “Connection blocked by IPBAN Firewall rule” – that would make me (and someone else viewing the log) more comfortable. I was also… Read more »

Jaymer
Guest
Jaymer

Hi Installed the latest version (as of April 2019) on Windows Server 2012. Within 1 hour, I have 150 IPs added to banlist – am viewing the SqlLite table. One offending IP is now up to a count of 68 FailedLoginCount. How can that be? Wouldn’t he stop getting this far if he was blocked after 5 attempts – I think I first saw this IP when the count was 12. Makes we wonder if they are really getting blocked. The IPAddress shows as an invisible blob (with only a few entries having graphic symbols). IPAddressText is viewable. I did… Read more »

Hans
Guest
Hans

Awesome, looking forward to it! Additional notes: Even though I set the limit to max. 5 failed login attempts, I see some logs where it says “count: 12” etc. Is it a bug from you or a logging issue? I use Windows Server 2012. Furthermore, my own IP got banned, even though I did not have any failed attempts on my own server. The log: 2019-04-16 16:08:31.9999|WARN|IPBan.IPBanLog|Login attempt failed: MY IP, , RDP, 3 2019-04-16 16:08:48.7317|WARN|IPBan.IPBanLog|Banning ip address: MY IP, user name: , config black listed: False, count: 5, extra info: Very strange, goes from 3 to 5 and does… Read more »

Hans
Guest
Hans

Good afternoon,

would you consider to implement a function that restricts connections just to specific countries?

For example: You allow connections to your RDP just from 3 countries, let’s say Germany, Netherlands and Poland. Connections made from other countries get instantly blocked.

If you see connections made from Brazil, China or other “weird” countries you would probably never connect from, then you get my point.

Will
Guest
Will

Nice! Was just trying to figure out if wail2ban would work on server 2016 then I found you. Look forward to testing it out.

Dan Brown
Guest

I Would gladly Donate once I have figured out how it works. I am not a Programmer. One thing I did learn was that I have been looking for a reason why my Customers scanner would scan to any workstation but not the Server.Eventually I found the Scanner IP Address in the Firewall IPban rule but was puzzled as to how it got there because it scans using port 445 and not 3389. I would gladly also contribute to developement of a GUI for us self taught people. It is Obviously working as I see a list of Banned IP… Read more »

Steve Ricketts
Guest
Steve Ricketts

I just downloaded the latest version.  I have tons of 5152 “Filtering Packet Drop” errors in the event log.  I’ve put the following in the IPBan.dll.config file:

<!– This group will block audit failures from failed login attempts to Windows –>
<Group>
<Source>RDP</Source>
<Keywords>0x8010000000000000</Keywords>
<Path>Security</Path>
<Expressions>

<Expression>
<XPath>//EventID</XPath>
<Regex>^(4625|5152)$</Regex>
</Expression>

<Expression>
<XPath>//Data[@Name=’IpAddress’ or @Name=’Workstation’]</XPath>
<Regex>
<![CDATA[
(?<ipaddress>.+)
]]>
</Regex>
</Expression>
</Expressions>
</Group>

Why am I still getting those errors and why is IPBan not putting those IP’s in the ban list?

David Borneman
Guest
David Borneman

Hi, First off, great tool! I am curious where this stores its list of banned IPs in order to maintain the firewall rules properly? I see no files being written in the application folder, and it obviously didn’t install a SQL database of any kind… is this stuff just held in memory? I am looking to hook in to that in some manner so that I can report those banned IPs to a master database, so I can identify IPs that are being banned multiple times and/or hitting multiple servers, so I can perma-ban those IPs in our hardware firewall.… Read more »

Vaughan Wickham
Guest

Hello,

I would like to be able to block failed Outlook Web Access logon attempts.

The default config file is not blocking these failed attempts

Regards

VW

Vaughan Wickham
Guest

Hello,

I have downloaded v1_3_5

I am using Windows

I found a short tutorial here but I can’t find the entries mentioned in the tutorial with regards to logging and log rotation.

Also, if you have plans for a GUI and a supported version, I would be interested in licensing details

Thank you

VW

Thiago
Guest
Thiago

Hello, how can I configure an email to be sent whenever I block or unlock an IP?

Peter
Guest
Peter

One more question: how to remove  any IP from banned IP list? How to control it? Where is it? I can’t see any file created, only log files.

Michael Blackmore
Guest
Michael Blackmore

Hi

Great tool, thank you, using on Win10/RDP.

I cannot find any documentation that says what config file to edit, and how, maybe even examples for white listing IPs etc

Can we reference a text file say whitelist.txt

 

thanks

 

 

Peter
Guest
Peter

I need to monitor RPD traffic in Windows 2012. Downloaded last 1.3.1 but nothing happens (just “Press ENTER to quit”).

How should the configuration file for Windows look like?

default it was:

LogFile: Source = SSH,  PathAndMask = /var/log/…

but it is for Linux SSH… what about  RDP/Windows?

Clinton Fung
Guest
Clinton Fung

tried to run IPBan.exe but the console just comes back with ” press enter to quit”

“C:\IPBan>IPBan.exe debug
Press ENTER to quit”

On both Windows Server 2012 R2 and Windos 10 (1803)

 

1 5 6 7