Don't wanna be here? Send us removal request.
Text
MongoDB extorted by a kraken ransomware virus. SOLVED
Recently plenty of servers became a victim of hacker attacks. The reason was the vulnerability of non-relational database mongodb. Hackers used this security hole to erase database from the server and demanded a ransom by inserting the following code in your database:
The victim could find this record in mongodb logfile (for ubuntu-servers the path is mongodb).
When you recover the database hacker will erase it again, so even if you have backups on your server this will not solve a problem.
What should I do to protect my server?
DO NOT PAY TO THIS RASCAL! He will not return your database.
1. If your database should not be reachable for external ips, you may just disable remote access to a MongoDB server. Change mongod.conf (standart path for Ubuntu is /etc/mongod.conf) and uncomment or add the rule: If you need access to your database from external ip-address go to point 2.
2. Deny all incoming traffic from external ip-adresses on port 27017 (or your custom port for MongoDB server)! For Linux systems use iptables program. Remember that rules in iptables configurations fall into chains and chains have an order. At first you should open the port for some external ip and then close it for others. If you will change an order you will disable access for all ips. Insert this rule to open port for local database Insert rules for external servers that use your database (new rule for each ip) Then deny access for everyone else Attention! Do NOT use this command BEFORE you read next! Important additional information, you can read next rule in mongodb help Change Default Policy to DROP https://docs.mongodb.com/manual/tutorial/configure-linux-iptables-firewall/ iptables -P INPUT DROP Unfortunately some people don’t read all sentences. This rule you can use only after completing all iptables configuration, because this rule can close to You all connections to your server including SSH immediately. And you should not use this rule in this exactly case, because closing mongodb port are good enough. But do not worry if you lost connection to your server, just restart it from provider web interface. All iptables rules will be dropped. To check all iptables configuration use this command: To drop ALL iptables: Important! This rules will work up to server restart. So if some rule working wrong and you lost connection to your server, just restart it via your provider web interface. Use iptables-persistent if you need automatically restarting service. Installation: If rules are determined but iptables-peristent are not installed, rules will be saved automatically during installation. To start service: Rules are saved to /etc/iptables/rules.v4 and /etc/iptables/rules.v6
Using this service, you can check your server for open ports: https://www.shodan.io (Just type your server’s ip in the search box)
3 notes
·
View notes
Text
Моя MongoDB была взломана kraken ransomware virus
Недавно интернет захлестнула волна хакерских атак. Причиной стала уязвимость нереляционной базы данных mongodb. Хакеры, пользуясь дырой в безопасности, стирали базу с сервера и требовали выкуп, вставляя в базу следующий код:
insert PLEASE_READ.PLEASE_READ query: { _id: ObjectId('587029b2f933f51ba44157fb'), Info: "Your DB is Backed up at our servers, to restore send 0.1 BTC to the Bitcoin Address then send an email with your server ip", Bitcoin Address: "1J5ADzFv1gx3fsUPUY1AWktuJ6DF9P6hiF", Email: "[email protected]" } ninserted:1 keyUpdates:0 numYields:0 locks(micros) w:103225 103ms 2017-01-07T00:35:13.219+0100 [conn267032] command PLEASE_READ.$cmd command: insert { insert: "PLEASE_READ", ordered: true, documents: [ { _id: ObjectId('587029b2f933f51ba44157fb'), Info: "Your DB is Backed up at our servers, to restore send 0.1 BTC to the Bitcoin Address then send an email with your server ip", Bitcoin Address: "1J5ADzFv1gx3fsUPUY1AWktuJ6DF9P6hiF", Email: "[email protected]" } ] }
Вы можете найти эту запись в логах mongodb (в ubuntu этот лог находится по адресу /var/log/mongodb/mongod.log), если вы подверглись атаке.
После воостановления базы данных, хакер снова стирает ее, поэтому даже если на сервере были бэкапы базы, это решало проблему не надолго.
Что делать, чтобы защитить себя? - Если ваша база не должна быть доступна по сети, просто запретите ей слушать любые ip, кроме localhost. Для этого зайдите в mongod.conf (для стандартной конфигурации ubuntu это /etc/mongod.conf) и откомментируйте или допишите правило bind_ip = 127.0.0.1
Если вам требуется доступ к базе с других ip-адресов, переходите к пункту 2. - Запретите доступ к порту, который слушает mongodb (по умолчанию это порт 27017)! для linux-серверов это можно сделать при помо��и ip-tables
для того, чтобы сервер мог работать с локальной базой iptables -A INPUT -s 127.0.0.1 -p tcp --dport 27017 -j ACCEPT
пропишит�� правила для внешних адресов ваших серверов, которые обращаются к базе (для каждого сервера свое правило) iptables -A INPUT -s xxx.xxx.xxx.xxx -p tcp --dport 27017 -j ACCEPT iptables -A INPUT -s yyy.yyy.yyy.yyy -p tcp --dport 27017 -j ACCEPT
запретите доступ всем остальным адресам к этому порту iptables -A INPUT -p tcp --dport 27017 -j DROP
Для того, чтобы проверить конфигурацию iptables используйте команду iptables -L -n
Важно! Эти правила будут действовать до перезагрузки сервера. Поэтому, если какое-то правило сработало неверно или вы потеряли доступ к своему серверу, просто перезагрузите свою машину.
Для того, чтобы правила действовали после перезагрузки используйте iptables-persistent Установка sudo apt-get install iptables-persistent
Чтобы запустить сервис service iptables-persistent save service iptables-persistent start
Правила сохраняются в /etc/iptables/rules.v4 и /etc/iptables/rules.v6
При помощи данного сервиса вы можете проверить сервер вашего сайта на наличие доступных портов https://www.shodan.io (просто вбейте ip своего сервера в поисковую строку)
#mongo#mongodb#linux#server#db#nodejs#linux tutorial#безопасность#взлом#хакерская атака#kraken#вымогательство#база данных#iptables
0 notes
Text
Подсветка кода в Tumblr при помощи GitHub
Код с подсветкой синтаксиса выглядит гораздо лучше ;)
Для того, чтобы подключить скрипт gist-embed, вставьте следующие строки в секцию head темплейты вашего блога.
Откройте статью на редактирование в режиме html и вставьте следующий код для отображения фрейма с GitHub.
Для подсветки определенных строк кода добавьте параметр data-gist-highlight-line.
Чтобы скрыть номера строк добавьте data-gist-hide-line-numbers.
Если нужно скрыть футер фрейма добавьте атрибут data-gist-hide-footer
4 notes
·
View notes