Community discussions

MikroTik App
 
Abd56ullah
just joined
Topic Author
Posts: 2
Joined: Wed May 22, 2024 1:26 pm

What are the best practices for securing a MikroTik router from external threats?

Fri Aug 02, 2024 1:00 pm

I’ve recently set up a MikroTik router for my home network to play the Nulls Brawl APK game, and I’m concerned about potential security vulnerabilities. I’ve configured the basic firewall rules and updated the firmware, but I’d like to know more about advanced security measures. What are the best practices for securing a MikroTik router from external threats, and are there any specific configurations or tools that can help enhance the security of my network? Any advice on monitoring and responding to security incidents would also be appreciated.
Last edited by Abd56ullah on Sun Aug 04, 2024 1:04 pm, edited 1 time in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12918
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: What are the best practices for securing a MikroTik router from external threats?

Fri Aug 02, 2024 2:54 pm

>>>What are the best practices for securing a MikroTik router from external threats?

Leave firewall to default values and do not touch what you do not know, do not follow "youtube & co." advices.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 23096
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: What are the best practices for securing a MikroTik router from external threats?

Fri Aug 02, 2024 5:39 pm

Who is that Leonardo de Pussy ??
 
User avatar
TheCat12
Long time Member
Long time Member
Posts: 527
Joined: Fri Dec 31, 2021 9:13 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Fri Aug 02, 2024 8:12 pm

It looks like a combination of Vincent van Purr and Claude Meowet
 
Apachez
Member Candidate
Member Candidate
Posts: 147
Joined: Mon Jul 01, 2024 11:45 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Fri Aug 02, 2024 8:33 pm

I’ve recently set up a MikroTik router for my home network to play the Nulls Brawl game, and I’m concerned about potential security vulnerabilities. I’ve configured the basic firewall rules and updated the firmware, but I’d like to know more about advanced security measures. What are the best practices for securing a MikroTik router from external threats, and are there any specific configurations or tools that can help enhance the security of my network? Any advice on monitoring and responding to security incidents would also be appreciated.
If possible disable all /ip/services and only use consolecable to configure your Mikrotik.

Then there are other improvements like VRF etc.

If you choose to enable /ip/services make sure to add a list clients based on IP-address like so (below example have ssh and www enabled and everything else disabled including the mac-based backdoor - also the example assumes your mgmt-client uses IP-address 192.168.1.2 so you need to change that to whatever IP and/or range your mgmt-client will be using):
/ip service set telnet address=192.168.1.2/32 disabled=yes
/ip service set ftp address=192.168.1.2/32 disabled=yes
/ip service set www address=192.168.1.2/32 disabled=no
/ip service set ssh address=192.168.1.2/32 disabled=no
/ip service set www-ssl address=192.168.1.2/32 disabled=yes certificate=$myCERT tls-version=only-1.2
/ip service set api address=192.168.1.2/32 disabled=yes
/ip service set winbox address=192.168.1.2/32 disabled=yes
/ip service set api-ssl address=192.168.1.2/32 disabled=yes certificate=$myCERT tls-version=only-1.2

/tool mac-server set allowed-interface-list=none
/tool mac-server mac-winbox set allowed-interface-list=none
/tool mac-server ping set enabled=no
/tool romon set enabled=no
In order to enable www-ssl (and disable www) you need a certificate in your box, one way to set such up is using a selfsigned cert like so:
:global myCERT "WEBFIG";
:global myCERTCN "TEST.example.com";
:global myCERTSAN "IP:192.168.1.88";
:global myCERTO "EXAMPLE.COM";
:global myCERTOU "TEST";
:global myCERTC "SE";
:global myCERTVALID "730";
:global myCERTDATE "2024-08-01";
:global myCERTTIME "12:00:00";

/system/clock/set date=$myCERTDATE time=$myCERTTIME
/certificate add name=$myCERT digest-algorithm=sha256 country=$myCERTC organization=$myCERTO unit=$myCERTOU common-name=$myCERTCN key-size=2048 subject-alt-name=$myCERTSAN days-valid=$myCERTVALID trusted=yes key-usage=digital-signature,key-cert-sign,crl-sign,tls-server 
/certificate sign $myCERT

/ip service set www address=192.168.1.2/32 disabled=yes
/ip service set www-ssl address=192.168.1.2/32 disabled=no certificate=$myCERT tls-version=only-1.2
[code]

Of course you can and need adjust the above to your choice like if you want key-size=4096 instead of 2048 etc. Note that increased keysize will take more time to generate the cert but also use more cpu once you login to your Mikrotik using https. So unless you administer your Mikrotik over the Internet a keysize of 2048 bits is often good enough even these days.

Edit: Make sure to use latest stable release which is 7.15.3 stable as of writing.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 23096
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: What are the best practices for securing a MikroTik router from external threats?

Fri Aug 02, 2024 9:49 pm

Why??
/tool mac-server mac-winbox set allowed-interface-list=none

Its an encrypted protocol/service, what should be said if using winbox, make sure this is set to the TRUSTED subnet/interface.
 
jaclaz
Forum Guru
Forum Guru
Posts: 2561
Joined: Tue Oct 03, 2023 4:21 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Fri Aug 02, 2024 11:47 pm

I find somewhat intriguing how half the new members posts asking how to access the router after having managed to lock themselves out, and the other half posts asking for recipes that ultimately increase the risk of locking oneself out.

Seriously, one thing is doing whatever Is possible to prevent external threats, another one is (IMHO senselessly) making access from the LAN difficult for hypothetical physical intruders while complicating the life of the authorized user(s).

The probability that someone will enter your home and will start fiddling with your (crappy) network is very, very low.

On the other hand, I would hope that the people actually managing security in high risk professional environments already know what to do (and AFAIK most of the effort is about preventing physical access to the local devices and network).
 
User avatar
pepperino
just joined
Posts: 1
Joined: Fri Aug 02, 2024 10:10 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 12:17 am

 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12918
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 12:52 pm

Who is that Leonardo de Pussy ??

It looks like a combination of Vincent van Purr and Claude Meowet

At least something interesting with artificial intelligence...
 
Apachez
Member Candidate
Member Candidate
Posts: 147
Joined: Mon Jul 01, 2024 11:45 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 4:32 pm

Why??
/tool mac-server mac-winbox set allowed-interface-list=none

Its an encrypted protocol/service, what should be said if using winbox, make sure this is set to the TRUSTED subnet/interface.
Because:

1) I dont like backdoors.

2) Management of these units should only occur from the management network either through consolecable (through consoleserver) and/or through SSH or HTTPS (www-ssl) using IP through the MGMT/BOOT interface.
Last edited by Apachez on Sat Aug 03, 2024 4:43 pm, edited 1 time in total.
 
Apachez
Member Candidate
Member Candidate
Posts: 147
Joined: Mon Jul 01, 2024 11:45 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 4:36 pm

I find somewhat intriguing how half the new members posts asking how to access the router after having managed to lock themselves out, and the other half posts asking for recipes that ultimately increase the risk of locking oneself out.

Seriously, one thing is doing whatever Is possible to prevent external threats, another one is (IMHO senselessly) making access from the LAN difficult for hypothetical physical intruders while complicating the life of the authorized user(s).

The probability that someone will enter your home and will start fiddling with your (crappy) network is very, very low.

On the other hand, I would hope that the people actually managing security in high risk professional environments already know what to do (and AFAIK most of the effort is about preventing physical access to the local devices and network).
Mikrotik is not only used in your home - these devices are being used by ISP's and enterprise coorporations etc.

Having backdoored unfiltered access to your Mikrotik devices leads to situations like these:

https://blog.cloudflare.com/de-de/meris-botnet

https://thehackernews.com/2024/07/ovhcl ... llion.html

So in my case I disable ALL such access EXCEPT for console, SSH and HTTPS (www-ssl).

Also the OP asked about how to secure your Mikrotik device - not how to make it wide open...
 
User avatar
mozerd
Forum Veteran
Forum Veteran
Posts: 955
Joined: Thu Oct 05, 2017 3:39 pm
Location: Canada
Contact:

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 5:33 pm

In addition to the great suggestions made I suggest that you consider

Who will attack and HACK your Internet connection?
 
jaclaz
Forum Guru
Forum Guru
Posts: 2561
Joined: Tue Oct 03, 2023 4:21 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 6:14 pm

@Apachez
I thought that remote as in:
The Meris botnet is formed of infected routers and networking hardware manufactured by the Latvian company MikroTik. According to MikroTik’s blog, the attackers exploited a vulnerability in the router’s operating system (RouterOS) which enabled attackers to gain unauthenticated remote access to read and write arbitrary files (CVE-2018-14847).
actually meant remote and vulnerability in the OS meant vulnerability in the OS, specifically Meris - according to MIkrotik - did not affect any Mikrotik device using default firewall configuration.
Mikrotik is not only used in your home - these devices are being used by ISP's and enterprise coorporations etc.
And - as already said - I hope these ISP's, corporations, etc, have dedicated personnel that know well what to do.
 
Apachez
Member Candidate
Member Candidate
Posts: 147
Joined: Mon Jul 01, 2024 11:45 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 8:52 pm

From the previous link:
According to MikroTik’s blog, the attackers exploited a vulnerability in the router’s operating system (RouterOS) which enabled attackers to gain unauthenticated remote access to read and write arbitrary files (CVE-2018-14847).

RouterOS is the router operating system that’s used by MikroTik’s routers and the RouterBOARD hardware product family, which can also be used to turn any PC into a router. Administration of RouterOS can be done either via direct SSH connection or by using a configuration utility called WinBox. The vulnerability itself was possible due to a directory traversal vulnerability in the WinBox interface with RouterOS.
https://mikrotik.com/supportsec/meris-botnet

https://blog.n0p.me/2018/05/2018-05-21- ... issection/

https://github.com/BasuCert/WinboxPoC

So there is that...

Again if you want to use the mac-backdoor for whatever reason, good for you.

Personally I prefer (and recommend) to disable ALL "features" and ONLY enable those I actually need (which unfortunately none of the NOS out there (yes Im looking at you Cisco, Arista, Juniper, VyOS, Mikrotik, HPE, Aruba etc) do these days where most junk is enabled by default so the box will happily inform its surroundings (and even the internet) which version it runs etc).
 
jaclaz
Forum Guru
Forum Guru
Posts: 2561
Joined: Tue Oct 03, 2023 4:21 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 9:01 pm

That was a REMOTE exploit possible only on routers that had "wrong" firewall settings and thus allowed access from the outside (WAN).

By setting:
/tool mac-server mac-winbox set allowed-interface-list=none
you are disabling it completely, also from LAN.
It creates a big inconvenience in normal management.

It makes much more sense in any normal setup to have a dedicated interface for management and allow winbox on that interface.
 
Apachez
Member Candidate
Member Candidate
Posts: 147
Joined: Mon Jul 01, 2024 11:45 pm

Re: What are the best practices for securing a MikroTik router from external threats?

Sat Aug 03, 2024 9:30 pm

Again, disabling not needed features is NOT an "inconvenience" rather the opposite.
 
holvoetn
Forum Guru
Forum Guru
Posts: 7265
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: What are the best practices for securing a MikroTik router from external threats?

Sun Aug 04, 2024 12:54 pm

Actually, security always comes with some level of inconvenience.
It's up to the admin to decide what he/she values most: convenience or security.

Accept inconvenience then or get rid of humans ... :shock:
we all should be quite aware the human factor (and it's accompanying need for convenience) is the biggest thread for anything related to security

Access your router remotely directly
or
first fire up your VPN, then access your router

Most will take the first option. Simply for convenience.