Question

Block IP After "x" Number of Failed FTP/HTTP Logon Attempts

Asked by: btpringle

Environment:

Internet Connection: Bright House Cable Internet, Standard Cable Modem, Dynamic IP
Router/Firewall: D-Link DI-524 (External IP: DHCP on 192.168.0.x Network;  Internal IP: 192.168.1.1)
Web Server: Windows XP Professional running IIS (FTP and HTTP), IP address: 192.168.1.10, Norton Antivirus 2005


Physical Connection Looks Like This:

Internet ------ Motorola Cable Modem ----- D-Link DI-524 w/firewall enabled ----- Windows XP Pro w/IIS


Firewall Rules:

Deny     Block Bad IP        WAN,124.114.97.6 *,* TCP,*  
Deny     Block Bad IP        WAN,203.135.160.34 *,* TCP,*  
Deny     Block Bad IP        WAN,222.62.149.99 *,* TCP,*  
Allow    FTP                    WAN,* LAN,192.168.1.10 TCP,21  
Allow    HTTP                  WAN,* LAN,192.168.1.10 TCP,80  
Allow    Ping WAN port     WAN,* LAN,192.168.1.1 ICMP,8  
Deny     Default                *,* LAN,* *,*  
Allow    Default                LAN,* *,* *,*


The first three rules, I manually created and edit them to block an IP address of anyone that I find is currently trying to gain access using a brute force attack, which seems to be nightly.  The only traffic allowed through the firewall is either on port 80 (HTTP) or port 21 (FTP).  Nothing else is allowed through.


Desired Outcome:

Currently, if I notice that there is an excessive amount of network activity on the workstation (I monitor the activity lights on the router), I look in the IIS logs located in the subfolders under C:\Windows\System32\LogFiles.  I check to see what they are trying to access, which is usually FTP, and copy their IP address.  I then sign on to the DI-524 and go into the firewall rules and change the IP address in the "Block Bad IP" rule so that they are no longer allowed.  I accomplish my desired outcome because they are blocked, but I have to constantly monitor and manually edit the rules.

What I would like is for *Windows* to handle monitoring attempts to sign in and block their *IP Address* if it finds that there are too many failed attempts to authenticate as a specific user within a given amount of time.  In other words, if Windows (or IIS) sees that there are five failed attempts to sign in to FTP using the "Administrator" account from the same IP address within a five minute window, I want it to block the IP address for thirty minutes.  

I would prefer to accomplish this with minimal monetary investment -- preferably freeware.


Please refrain from posting flames about Windows, IIS, Norton, the router, and etc.  

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-11-29 at 12:38:56ID22076911
Tags

block

,

ip

,

ftp

Topic

Microsoft IIS Web Server

Participating Experts
2
Points
500
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. computers not to bright
    my display has suddenly became darker. I still get all the colors but it looks like i'm wearing sunglasses. i don't thinks it's the monitor because i have a TV tuner card that completely bypasses the video card and it still looks fine, that could be because i can control t...
  2. FTP Server attacks
    We've had about 100 attacks in a few minutes (brute force) on our ftp server. In the event viewer I saw : Event ID : 100 Source : MSFTPSVC Type : Warning Description : The server was unable to logon the windows NT account 'administrator' due to the following error : Logon ...
  3. Deleting IIS logs in C:\WINNT\system32\LogFiles\W…
    Hi all, We currently have a system drive that is approaching capacity very rapidly. The space is being used by IIS log files being created in the following directory: C:\WINNT\system32\LogFiles\W3SVC1 Is there anyway to safely delete these logs and then prevent this from re...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: giltjrPosted on 2006-12-07 at 16:37:54ID: 18098475

Not sure if you going to be able to do this.  The DI-524 uses a web interface to manage it.  You would have to capture the data stream while adding an IP address to the block list and see if you might be able to create a script using a telnet client that supports scripting.

You might be able to enable the Windows firewall and script is easier.  This does not stop the traffic to the Windows box, but it does stop the traffic from getting to the application level (IIS and FTP).

 

by: btpringlePosted on 2006-12-07 at 16:52:15ID: 18098534

I don't want to try to block it on the router.  As far as Windows is concerned, that box does not really exist except for being the default gateway.

I want Windows to look at the incoming request, see that it is someone trying to authenticate from a particular IP address, see that it fails, see that they try it again (say five more times), and then Windows blocks the IP address from that box.  

What I want is something along the lines of Norton AntiVirus where when it detects an incoming request from a known worm, it will block the IP address.  However, I want it based on failed logon attempts.

 

by: giltjrPosted on 2006-12-07 at 17:09:42ID: 18098609

Actually Norton AntiVirus doesn't do that.  Their firewall may, but not their Antivirus.

In order to do this, you would need stop using Windows authentication programs, write your own and have it do what you want.

You might be able to find a ftp server program that already does that, however I am not sure if it will be free or cheap.

 

by: btpringlePosted on 2006-12-07 at 19:31:03ID: 18099090

In your above post, you mentioned writing a script for the firewall.  How would I do that?

 

by: giltjrPosted on 2006-12-07 at 20:12:15ID: 18099281

You would have to caputer the datastream that is sent to the router/firewall when you update it using the web interface and examine it to see if it looks like you could script that.

You also need to caputer the stream when you logon to the firewall.

If the logon and the update appear to be able to be scripted, then you can get a telnet client that supports scripting, write the scritp.  The next step is to figure out how to invoke the script.

 

by: richrumblePosted on 2006-12-13 at 05:58:18ID: 18130384

Snort in combination with SnortSAM is an effective tool, SnortSAM can update a windows ISA firewall, you set a threshold, a whitelist of ip's not to block, and even a timeout for the block if you wish: http://www.snortsam.net/ It can also do this on the cisco router or pix firewall. You'd turn off about every rule that snort has, basically commenting them out, and having it sniff the traffic.
You could possibly script this with a WMI script that looked inside the event logs for a certain event, and parsed the IP address out, and have the wmi script update the windows firewall, I'm not sure how you could enable a timeout for the block in this manner however with a simple script.
http://www.microsoft.com/technet/scriptcenter/scripts/logs/eventlog/default.mspx
http://www.microsoft.com/technet/scriptcenter/scripts/network/firewall/default.mspx
-rich

 

by: btpringlePosted on 2006-12-13 at 11:53:04ID: 18133455

richrumble,

I was looking at the SnortSAM site and it lists that it works with ISA Server, but does not list that it will work with Windows XP with IIS.  Do you know for sure that this will work?

Thanks

 

by: richrumblePosted on 2006-12-13 at 12:09:48ID: 18133563

It will not, it only will configure a windows ISA firewall, it will also only receive it's information from snort. I'll look at writing a script that might do this via the netsh command... I'm not sure why no one hasn't done this already, other than this sort of automation can't fully be trusted, as it's easy to DoS yourself without a proper white-list, spoofed packets can make it so that you block your own traffic if your not careful. I don't really trust my scripting is another factor ;) There are tools like Snare or GFI's events manager that can alert you in real-time to these attempts.
http://www.intersectalliance.com/projects/SnareWindows/
http://www.gfi.com/eventsmanager/

-rich

 

by: giltjrPosted on 2006-12-13 at 12:11:26ID: 18133573

It won't work with IIS it works with firewalls and IIS is not a firewall.

With the WMI script you that richrumble mentioned you write another script to remove the block (an "unblocking script").  In the "blocking" script get the current time and then schedule to run the "unblocking script" with the IP address as a parameter using the AT command.

In fact, can you even block IP addresses within IIS?

 

by: richrumblePosted on 2006-12-13 at 12:24:38ID: 18133683

Yes, IIS can block via ip/dns name http://www.hostmysite.com/support/dedicated/IIS/blockip/
But a firewall is the best place typically, if the IIS server is the same that has the firewall, it won't make much of a difference in preformance, if you block on a hardware firewall or router ACL your server won't work as hard. Snort can be used in "inline" mode and you don't have to get SnortSam installed, snort can actually send a connection "reset" packet (spoofed) and the connection will be disconnected. http://www.snort.org/docs/snort_htmanuals/htmanual_2.4/node7.html
Again, the method can't be completely trusted, I'd advise you get alerted to the attempts and configure the iss file with an updated ip/dns name to block, and restart IIS.
-rich

 

by: giltjrPosted on 2006-12-13 at 12:49:11ID: 18133876

Ah, real IIS does.  I have only used the "Personal Web Server" IIS version that comes with XP.   At least on my PC the IP Address stuff is grayed out and I can't change it.  I am making the assumption that btpringle  is running the "personal" version also.

Yes, a firewall is the best place to do this.  I am not 100% sure what he is attempting to accomplish.  Maybe attempting to slow down people that are attempting to guess at userid and passwords?

 

by: richrumblePosted on 2006-12-13 at 13:06:05ID: 18134001

I didn't even know there was a "mini" IIS, hmmm he/she might not be able to do this... IIS 5.1 as it's called, is intended for development and not production. Apache might be a better web server to use: http://httpd.apache.org/docs/1.3/windows.html you use the .htaccess file (called ht.acl on M$) to block via IP. There are quite a few limitations to 5.1, 10 concurrent connections default, 40 max, no double decode, and only ONE! virtual host (vhost)...
-rich

 

by: giltjrPosted on 2006-12-13 at 14:02:34ID: 18134432

Yep, not to robust.  I only use IIS, and only the mini version, when I have to.   In fact I only use Windows because that is what my company installs, I use Apache on Linux for my personal stuff and anyplace/everyplacy I can at work.

 

by: btpringlePosted on 2006-12-14 at 19:02:13ID: 18144087

I am looking into using Snort, but the site is not too user-friendly.  How do I get started?  I am using Windows, so their Linux and Apache guides do not apply.

 

by: btpringlePosted on 2006-12-14 at 19:16:08ID: 18144140

http://support.microsoft.com/kb/304197

The version of IIS that is installed in Windows XP Pro is IIS v5.1.  The version for Windows 2000 was IIS v5.0.  Microsoft dropped the IP address packet filtering in IIS v5.1, so it is not available for use in Windows XP.  The capability is again enabled in IIS v6.0.

Any workarounds for getting this to work on XP?

 

by: richrumblePosted on 2006-12-15 at 05:56:21ID: 18145959

I can't find any workaround for IIS 5.1, Apache can do this, and it's more secure by default and also the most used web server on the net as well. Snort can be tough to get going for a lot of folks, here is a site dedicated to win32 snort http://www.winsnort.com/ and it will work with snortsam as he has ported ss to win32.
If you wanted a script that might do this, I'd open another question in the VBScripting TA here on EE for that. A script that parses the event logs, looking for X number of failed events from a single ip address, in X amount of time. If that condition is meet, issue the netsh commands to block that ip indefinitely. See if a whitelist can be used to allow certain ip's to never be firewalled. The script should back up the firewall's settings so that you can easily roll-back if you need to.
C:\>netsh firewall show config >c:\FW_back-up.txt      (to write a backup file with the current firewall settings before the block is set)
C:\>netsh firewall set portopening ALL 21 DISABLE CUSTOM x.x.x.x    (x.x.x.x is the ip of the offending "attacker")

Look at the netsh /? help commands for further examples, netsh firewall /?      netsh firewall set /? etc...
-rich

 

by: btpringlePosted on 2006-12-15 at 06:33:52ID: 18146225

richrumble,

I am going to continue working on this and would appreciate it if you have any more information, but I think the "netsh firewall" command above might be what I need, so I am accepting that as the answer.  Thanks for all of your help and I will post here again when I have a working solution.

Thanks,
Brian

 

by: richrumblePosted on 2006-12-15 at 06:37:00ID: 18146245

NP, the netsh commands might help speed things along, and perhaps instead of automatically blocking via snortsam/vbscript, perhaps simply parsing the event logs and giving you a report of the ip's to block, and all you have to do is a quick copy-paste onto the netsh command. You'll want to test, but that command should work fine.
-rich

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...