0

I'm trying to block specific ips from connecting to my service. Some poeple are attacking my services and I was hoping to automatically ban their IP when I detect the attack. Here is how I'm implementing it:

command is  netsh advfirewall firewall delete rule name="packet flooder 172.20.10.9" remoteip=172.20.10.9

Deleted 2 rule(s).
Ok.

command is  netsh advfirewall firewall add rule name="packet flooder 172.20.10.9" dir=in action=block remoteip=172.20.10.9
Ok.

command is  netsh advfirewall firewall add rule name="packet flooder 172.20.10.9" dir=out action=block remoteip=172.20.10.9
Ok.

I'm testing this with an attacker on my PC, attacking the service on my PC. Unfortunately the attack still goes through after getting detected and the rules enabled.

I was expecting that once the attack is detected and the rules are added to the firewall the next attack wouldn't work but that isn't the case.

My service has a rule to allow all incoming connections to it.

What am I doing wrong? Why doesn't it work? Is it because I'm testing it both locally? (the service and the attacker) Is it because I've already allowed all incoming connections that its not honoring the block specific IP? Is it because I'm deleting the rule before creating it? (I'm trying to make sure its not duplicated)

I'm using the latest windows server.


UPDATE

enter image description here

8
  • Just to be clear, the attacking PC and victim PC in your test here is the same PC and no virtual machine or anything is coming into play here, right?
    – n8te
    Oct 12, 2018 at 5:54
  • @n8te in my test, yes. I'm just using the wlan0 IP. No virtual machine what-so-ever. Just plain both running on my PC.
    – majidarif
    Oct 12, 2018 at 5:55
  • You need to test from a different PC. The inbound rules you're setting up will not come into play when you're attacking from the same machine. You can test this yourself by running an nmap scan from that PC against itself with the firewall up. It won't see any ports filtered.
    – n8te
    Oct 12, 2018 at 6:00
  • Or setup a virtual machine on that same PC with a bridged network connection if you don't happen to have a 2nd PC handy to test with.
    – n8te
    Oct 12, 2018 at 6:01
  • Is attacking from the windows 10 ubuntu app ok? Or is it still considered the same machine?
    – majidarif
    Oct 12, 2018 at 6:02

0

You must log in to answer this question.

Browse other questions tagged .