Community discussions

MikroTik App
 
asaddotcom
just joined
Topic Author
Posts: 12
Joined: Tue Apr 15, 2008 6:55 pm
Location: Pakistan
Contact:

Virus Ports Block

Fri Aug 19, 2011 3:29 am

I'm using Mikrotik v5.6 with Linux cache server. I had notice my local area / pppoe users have infected computer with Trojans/Virus's and their computers continually flooding and attacks to my Linux box, so on browsing goes very slow. So i want to block all virus ports. Anyone can post script or firewall .

How can i block??
help
You do not have the required permissions to view the files attached to this post.
 
User avatar
MCT
Member Candidate
Member Candidate
Posts: 158
Joined: Wed Mar 03, 2010 5:53 pm

Re: Virus Ports Block

Fri Aug 19, 2011 9:20 am

There are no defined 'virus ports'. You need to provide more information on the traffic before anyone can help you. Malware, a virus, depending on the particular sample can use any ports or protocols the author desires.

It's also helpful if you would provide a reasonably sized packet capture, a few hundred packets or so, of that traffic as it's common enough to find something unique about it that can be used to filter it.

What would help some is if you ran torch on the interface with protocol and port included and a timeout of a minute or so. You can block out parts of your addresses, enough so they can be pointed out without exact IPs, but leave the ports visible. It could be something as simple as spam bots. If you see a lot of port 25 activity that's probably the case. You can tag that traffic and rate limit it for home users normally, a business or 'power user' may want to run their own email server with more traffic volume but you can deal with that on a case by case basis.
Last edited by MCT on Fri Aug 19, 2011 7:03 pm, edited 1 time in total.
 
User avatar
aacable
Member
Member
Posts: 435
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: Virus Ports Block

Fri Aug 19, 2011 12:09 pm

I'm using Mikrotik v5.6 with Linux cache server. I had notice my local area / pppoe users have infected computer with Trojans/Virus's and their computers continually flooding and attacks to my Linux box, so on browsing goes very slow. So i want to block all virus ports. Anyone can post script or firewall .
How can i block??
help
First analyze what is going on your networking, TORCH can be a good friend in this case :) see what specific traffic is hitting your router in rough manner, for example it could be famous blaster or other worms using 135 or 445 or 25 port. Just block those ports.

The best approach is to allow only related traffic and block all other traffic. OR you can just block the famous virus ports available in this post. http://wiki.mikrotik.com/wiki/Securing_your_router

http://wiki.mikrotik.com/wiki/Protecting_your_customers
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Virus Ports Block

Fri Aug 19, 2011 2:59 pm

Good point to start is our demo2 router. Login to demo2.mt.lv (login demo without password), you will find filter chain=viruses, export it and use on your router.
Add additional ports.

This approach blocks only known viruses ports, but viruses can use "good" ports as well.
 
User avatar
MCT
Member Candidate
Member Candidate
Posts: 158
Joined: Wed Mar 03, 2010 5:53 pm

Re: Virus Ports Block

Fri Aug 19, 2011 5:20 pm

I'm not a fan of just blocking ports to people just because it could be used by malware. If you follow that mentality you'll end up blocking legitimate port users. I've seen a lot of malware use port 80, you going to block that?

If there is a signature or unique property that can be used to target the traffic then that needs to be used. Most of the current malware samples are fairly agile and adaptive. If you block a port, then it will use a different port.

If you have something unique about the traffic though you can tag the traffic and limit it. That will mitigate the effect on your network and will prevent more advanced malware types from just switching to a new port. It's a good practice to try to implement things as close to the source as possible to reduce the impact on your network.

Arbitrarily blocking ports as a service provider is an amateur's solution. That's not to say you can't monitor that port number, classify it as possibly malicious and then do further checking to see if it actually is malicious. If you put something like snort on your network and mirror the traffic to it that will tell you based on signatures if it's a known malicious signature.
 
User avatar
mahnet
Long time Member
Long time Member
Posts: 654
Joined: Tue Jul 07, 2009 9:11 pm

Re: Virus Ports Block

Fri Aug 19, 2011 8:13 pm

Good point to start is our demo2 router. Login to demo2.mt.lv (login demo without password), you will find filter chain=viruses, export it and use on your router.
Add additional ports.

This approach blocks only known viruses ports, but viruses can use "good" ports as well.
No Bridge. No ethernet. No Wlan in the demo.
????
 
asaddotcom
just joined
Topic Author
Posts: 12
Joined: Tue Apr 15, 2008 6:55 pm
Location: Pakistan
Contact:

Re: Virus Ports Block

Sun Aug 21, 2011 3:59 pm

I've monitor my infected users by using touch tool.. the result is in given attached screen shot.
Please see the screen shot and suggest me what to do?
You do not have the required permissions to view the files attached to this post.
 
User avatar
mahnet
Long time Member
Long time Member
Posts: 654
Joined: Tue Jul 07, 2009 9:11 pm

Re: Virus Ports Block

Sun Aug 21, 2011 4:57 pm

add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=135-139 protocol=tcp
add action=drop chain=virus comment="Drop Messenger Worm" disabled=no dst-port=135-139 protocol=udp
add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=444-445 protocol=tcp
add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=444-445 protocol=udp

this helps ...
 
User avatar
MCT
Member Candidate
Member Candidate
Posts: 158
Joined: Wed Mar 03, 2010 5:53 pm

Re: Virus Ports Block

Sun Aug 21, 2011 6:55 pm

add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=135-139 protocol=tcp
add action=drop chain=virus comment="Drop Messenger Worm" disabled=no dst-port=135-139 protocol=udp
add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=444-445 protocol=tcp
add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=444-445 protocol=udp

this helps ...
As I said before this type of arbitrary port blocking is an amateur's solution. Target specific behavior not ports. I know I said arbitrary filtering is generally bad practice but what you have is a worm actively attacking other machines, not something like spam. If it's an active attack filter it to protect users on the other end. It would be something like this.

/ip firewall mangle
add action=add-src-to-address-list address-list=Worm-Infected-p445 address-list-timeout=1h chain=prerouting connection-state=new disabled=no dst-port=445 limit=5,10 protocol=tcp

/ip firewall filter
add action=drop chain=forward disabled=no dst-port=445 protocol=tcp src-address-list=Worm-Infected-p445

That way legitimate use isn't blocked but something like a worm sending out mass amounts will be detected and stopped. You may have to play with the rates a little as I don't have traffic to test on, but that's a much more elegant solution than blocking a bunch of ports for all users. Yes, this could be done with a rate specific firewall rule, but this gives you a nice list of user IPs that need to clean up their machines.

It's best to try and filter the traffic as close to the source of it as you can get. It keeps such things from taking up bandwidth on your links.
 
asaddotcom
just joined
Topic Author
Posts: 12
Joined: Tue Apr 15, 2008 6:55 pm
Location: Pakistan
Contact:

Re: Virus Ports Block

Mon Aug 22, 2011 12:25 pm


As I said before this type of arbitrary port blocking is an amateur's solution. Target specific behavior not ports. I know I said arbitrary filtering is generally bad practice but what you have is a worm actively attacking other machines, not something like spam. If it's an active attack filter it to protect users on the other end. It would be something like this.

/ip firewall mangle
add action=add-src-to-address-list address-list=Worm-Infected-p445 address-list-timeout=1h chain=prerouting connection-state=new disabled=no dst-port=445 limit=5,10 protocol=tcp

/ip firewall filter
add action=drop chain=forward disabled=no dst-port=445 protocol=tcp src-address-list=Worm-Infected-p445

That way legitimate use isn't blocked but something like a worm sending out mass amounts will be detected and stopped. You may have to play with the rates a little as I don't have traffic to test on, but that's a much more elegant solution than blocking a bunch of ports for all users. Yes, this could be done with a rate specific firewall rule, but this gives you a nice list of user IPs that need to clean up their machines.

It's best to try and filter the traffic as close to the source of it as you can get. It keeps such things from taking up bandwidth on your links.
I really appreciate your advice that do not block ports and use worms limit.
I'll apply the firewall rules then post the result.

But before I apply the rule, I have a question!! as your define limit in mangle rule, will you please tell me, this limit will work for a single user or work for entire network users??
also shortly brief this "limit=5,10" What it do for and what it mean?
 
User avatar
MCT
Member Candidate
Member Candidate
Posts: 158
Joined: Wed Mar 03, 2010 5:53 pm

Re: Virus Ports Block

Mon Aug 22, 2011 3:20 pm


As I said before this type of arbitrary port blocking is an amateur's solution. Target specific behavior not ports. I know I said arbitrary filtering is generally bad practice but what you have is a worm actively attacking other machines, not something like spam. If it's an active attack filter it to protect users on the other end. It would be something like this.

/ip firewall mangle
add action=add-src-to-address-list address-list=Worm-Infected-p445 address-list-timeout=1h chain=prerouting connection-state=new disabled=no dst-port=445 limit=5,10 protocol=tcp

/ip firewall filter
add action=drop chain=forward disabled=no dst-port=445 protocol=tcp src-address-list=Worm-Infected-p445

That way legitimate use isn't blocked but something like a worm sending out mass amounts will be detected and stopped. You may have to play with the rates a little as I don't have traffic to test on, but that's a much more elegant solution than blocking a bunch of ports for all users. Yes, this could be done with a rate specific firewall rule, but this gives you a nice list of user IPs that need to clean up their machines.

It's best to try and filter the traffic as close to the source of it as you can get. It keeps such things from taking up bandwidth on your links.
I really appreciate your advice that do not block ports and use worms limit.
I'll apply the firewall rules then post the result.

But before I apply the rule, I have a question!! as your define limit in mangle rule, will you please tell me, this limit will work for a single user or work for entire network users??
also shortly brief this "limit=5,10" What it do for and what it mean?
Along with the other rules it means 5 packets per second with a burst of 10 specific to new connections. The mangle rule will put addresses on a list when it exceeds that limit. You can just use that rule and tweak it until you're satisfied with what it detects and then you can apply the firewall one.
 
asaddotcom
just joined
Topic Author
Posts: 12
Joined: Tue Apr 15, 2008 6:55 pm
Location: Pakistan
Contact:

Re: Virus Ports Block

Mon Aug 22, 2011 7:35 pm

Along with the other rules it means 5 packets per second with a burst of 10 specific to new connections. The mangle rule will put addresses on a list when it exceeds that limit. You can just use that rule and tweak it until you're satisfied with what it detects and then you can apply the firewall one.
I have found some IP's you can see in screen shot.
now which rule i should apply for them?

Thanks & I must appreciate your reply...
You do not have the required permissions to view the files attached to this post.
 
User avatar
Bongo
newbie
Posts: 37
Joined: Thu Aug 11, 2011 4:28 am

Re: Virus Ports Block

Mon Aug 22, 2011 11:50 pm

hi like your rule for viruses just want to know, do i still have to keep my old viruses rule as shown below in blue or do i just leave as is & just add your rule by as shown in red


add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=135-139 protocol=tcp
add action=drop chain=virus comment="Drop Messenger Worm" disabled=no dst-port=135-139 protocol=udp
add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=444-445 protocol=tcp
add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=444-445 protocol=udp



/ip firewall mangle
add action=add-src-to-address-list address-list=Worm-Infected-p445 address-list-timeout=1h chain=prerouting connection-state=new disabled=no dst-port=445 limit=5,10 protocol=tcp

/ip firewall filter
add action=drop chain=forward disabled=no dst-port=445 protocol=tcp src-address-list=Worm-Infected-p445
 
asaddotcom
just joined
Topic Author
Posts: 12
Joined: Tue Apr 15, 2008 6:55 pm
Location: Pakistan
Contact:

Re: Virus Ports Block

Tue Aug 23, 2011 2:21 am

hi like your rule for viruses just want to know, do i still have to keep my old viruses rule as shown below in blue or do i just leave as is & just add your rule by as shown in red


add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=135-139 protocol=tcp
add action=drop chain=virus comment="Drop Messenger Worm" disabled=no dst-port=135-139 protocol=udp
add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=444-445 protocol=tcp
add action=drop chain=virus comment="Drop Blaster Worm" disabled=no dst-port=444-445 protocol=udp



/ip firewall mangle
add action=add-src-to-address-list address-list=Worm-Infected-p445 address-list-timeout=1h chain=prerouting connection-state=new disabled=no dst-port=445 limit=5,10 protocol=tcp

/ip firewall filter
add action=drop chain=forward disabled=no dst-port=445 protocol=tcp src-address-list=Worm-Infected-p445
I think you don't need to keep [blue code] after applying [red] one..
am i right MCT?
 
User avatar
MCT
Member Candidate
Member Candidate
Posts: 158
Joined: Wed Mar 03, 2010 5:53 pm

Re: Virus Ports Block

Tue Aug 23, 2011 9:13 pm

Correct, you don't need the old ones anymore, at least for port 445.
 
User avatar
mahnet
Long time Member
Long time Member
Posts: 654
Joined: Tue Jul 07, 2009 9:11 pm

Re: Virus Ports Block

Tue Aug 23, 2011 9:41 pm

HI MCT,

Your advice is fine. I have not tried it but is worth thinking over. However I had a few queries. The mangle u showed is for "tcp" only but we know that UDP ports are also vulnerable.
Also, after the IP's have been identified as in asad's list in the picture 4444.jpg does it only identify the IP's or drop the worms spreading from the IP's.

Is there a similar method to drop torrent users. or torrent usage for specific IP addresses. or torrent usage during specific times.

Your help would be really appreciated,
Thanks
 
User avatar
MCT
Member Candidate
Member Candidate
Posts: 158
Joined: Wed Mar 03, 2010 5:53 pm

Re: Virus Ports Block

Tue Aug 23, 2011 10:26 pm

HI MCT,

Your advice is fine. I have not tried it but is worth thinking over. However I had a few queries. The mangle u showed is for "tcp" only but we know that UDP ports are also vulnerable.
Also, after the IP's have been identified as in asad's list in the picture 4444.jpg does it only identify the IP's or drop the worms spreading from the IP's.

Is there a similar method to drop torrent users. or torrent usage for specific IP addresses. or torrent usage during specific times.

Your help would be really appreciated,
Thanks
There's nothing stopping you from making a duplicate rule for UDP. I was just specifically targeting the traffic that was causing problems.

The mangle rule identifies and then the firewall rule drops the traffic from detected IPs.

It's certainly possible to detect torrents based on traffic behavior. A normal user transferring data will usually be on one of the main service ports like FTP, HTTP, etc. Torrent clients tend to use high numbered ports. If you see a lot of data on ports above 6000 and multiple connections then it's a good bet that's torrent traffic.

I was actually looking at the possibility of using L7 detection on tracker file structure when they're downloaded. If a tracker file is downloaded then its reasonable to assume someone is using torrents and add them to a list that takes actions on high level port activity such as throttling and/or dropping the QoS level.
 
User avatar
Bongo
newbie
Posts: 37
Joined: Thu Aug 11, 2011 4:28 am

Re: Virus Ports Block

Mon Aug 29, 2011 9:53 pm

Hi MCT

thanks for replying to virus question i asked

i want to ask if you could help me out with some stuff

i have 433uah bored, running adsl, my pc, my proxy, etc.....

my proble is my proxy, firewall, mangle, queue rules etc... does not follow on my clients pc's

all rules ive set out falls on my master lan which is my pc, where i work from

if can help me out thanks
 
asaddotcom
just joined
Topic Author
Posts: 12
Joined: Tue Apr 15, 2008 6:55 pm
Location: Pakistan
Contact:

Re: Virus Ports Block

Mon Jan 23, 2012 1:07 pm

Dear MCT,

I came here with my new problem, i hope you'll help me to solve it as you've done before.
I am attaching the infected user screen shot, I'm using firewall rules as you suggest me before but my one of user continually spamming and main thing i have noticed that i gave this user 64k uplink in queue but he's still spamming on 1.5mb uplink.. why its happening?? does my firewall not working or what else??

Please find out a way for me...
thanks

best regards
You do not have the required permissions to view the files attached to this post.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Virus Ports Block

Thu Feb 02, 2012 1:59 am

50.50.50.62 has some virus - just find'em and punish'em!

p.s. if you see this in Torch - it doesn't mean that it's not blocked by Firewall filter
 
tamilmaran
Frequent Visitor
Frequent Visitor
Posts: 74
Joined: Mon Sep 05, 2011 9:36 pm

Re: Virus Ports Block

Fri Jun 22, 2012 7:21 am

can anyone can tell with example screen shot ,how to find the infected port by using torch tool...
waiting for valuable reply...
Thank in advance.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Virus Ports Block

Sat Jun 23, 2012 2:49 pm

example screenshot is two posts above :)
 
tamilmaran
Frequent Visitor
Frequent Visitor
Posts: 74
Joined: Mon Sep 05, 2011 9:36 pm

Re: Virus Ports Block

Sat Jun 23, 2012 5:52 pm

example screenshot is two posts above :)
how could i find extactly it is virus or some messenger & anything else..
any tips pls...
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Virus Ports Block

Sat Jun 23, 2012 7:41 pm

messengers (except Skype :) ) won't try to connect to dozens addresses simultaneously
 
tamilmaran
Frequent Visitor
Frequent Visitor
Posts: 74
Joined: Mon Sep 05, 2011 9:36 pm

Re: Virus Ports Block

Tue Jul 17, 2012 5:02 pm

instead of blocking the specfic ports,
can we use to block the ips by packet per second.
is it is reliable method..
can anyone suggest me the best...

Who is online

Users browsing this forum: GoogleOther [Bot], infabo, llamajaja, sas2k and 63 guests