Community discussions

MikroTik App
 
suporteitanet
just joined
Topic Author
Posts: 19
Joined: Fri Sep 20, 2013 4:01 pm

SSH attack

Fri May 30, 2014 2:41 am

Greetings ,for the last days, every time I open the log, I see a list of critical login failures via ssh and telnet and the source ip belongs to my network. Is possible someone has copied this ip, placed in a device and be trying invade the routerboard?

Sorry for my bad English , but I am worried about this.
Last edited by suporteitanet on Thu Apr 30, 2015 11:24 pm, edited 2 times in total.
 
plisken
Forum Guru
Forum Guru
Posts: 2511
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: SSH attack

Fri May 30, 2014 8:52 am

You can block the access for SSH disable SSH if you don't need SSH

Or you can make that you IP-address can connect with SSH

Go to "IP" "services"

Doubbleclick on the line SSH

Than give you a IP-address from the PC that can login with SSH
You do not have the required permissions to view the files attached to this post.
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1286
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: SSH attack

Fri May 30, 2014 10:12 am

I use this solution... Allow a few attempts, then filter the IP.
/ip firewall filter
add action=drop chain=input src-address-list=blacklist

add action=log chain=input connection-state=new dst-port=22 \
    log-prefix="SSH Brute Force Blocked" protocol=tcp src-address-list=ssh_stage3

add action=add-src-to-address-list address-list=blacklist \
    address-list-timeout=4w chain=input comment="Block SSH 4th Attemp" \
    connection-state=new dst-port=22 protocol=tcp src-address-list=ssh_stage3

add action=add-src-to-address-list address-list=ssh_stage3 \
    address-list-timeout=1m chain=input comment="Log SSH 3rd Attemp" \
    connection-state=new dst-port=22 protocol=tcp src-address-list=ssh_stage2

add action=add-src-to-address-list address-list=ssh_stage2 \
    address-list-timeout=1m chain=input comment="Log SSH 2st Attemp" \
    connection-state=new dst-port=22 protocol=tcp src-address-list=ssh_stage1

add action=add-src-to-address-list address-list=ssh_stage1 \
    address-list-timeout=1m chain=input comment="Log SSH 1st Attemp" \
    connection-state=new dst-port=22 protocol=tcp

 
suporteitanet
just joined
Topic Author
Posts: 19
Joined: Fri Sep 20, 2013 4:01 pm

Re: SSH attack

Fri May 30, 2014 2:35 pm

Ty everyone , for the fast response. I will close the topic.
 
Rudios
Forum Veteran
Forum Veteran
Posts: 977
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: SSH attack

Fri May 30, 2014 4:54 pm

@intrusdave
Why all the lists?
Looks like you are blocking anyway after multiple tries.
Could be blocked from the start?

Actually I get it. Upon successful connection the first time. Source Ip is only listed in 1stage list.
Only endup in blacklist upon multiple failed tries :)
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1286
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: SSH attack

Sat May 31, 2014 8:19 am

Exactly. You get 3 attempts, then blocked.
 
servaris
Frequent Visitor
Frequent Visitor
Posts: 67
Joined: Tue May 20, 2014 4:30 pm
Location: Planet Earth
Contact:

Re: SSH attack

Mon Jun 02, 2014 3:46 am

I am no Mikrotik guru but I would say it is easier to use a different port for SSH. We use a 5 digit port number (same one of course) on every one of our servers. Never got broken into. We used PF on the Servers (running FreeBSD). IThen you can use the firewall rule the person above said to use for the new ssh port. Just not sure if you can block port scans but I suspect one can do that too.
 
AlexS
Member Candidate
Member Candidate
Posts: 282
Joined: Thu Oct 10, 2013 7:21 am

Re: SSH attack

Thu Apr 30, 2015 11:19 pm

personally I would use the firewall to limit access to the ssh port from known good locations.

All you need it 4-5 rsync's and scps and ssh's to put yourself on the blacked list.

If you limit to known good internal ip address, and your on the internet, use a VPN to get inside and then connect outside.

security by obscurity is not the best.


Last bumped by suporteitanet on Thu Apr 30, 2015 11:19 pm.