I have a Digital Ocean droplet running Ubuntu 14.04. I use it for running quick node.js tests on a publicly available server. I just logged in via SSH and did $ lsof -i
to see what ports I was using. At the bottom of the list I noticed:
sshd 30952 root 3u IPv4 66978103 0t0 TCP xxx.xxx.xxx.xxx:ssh->120.52.72.81:7810 (ESTABLISHED)
sshd 30953 sshd 3u IPv4 66978103 0t0 TCP xxx.xxx.xxx.xxx:ssh->120.52.72.81:7810 (ESTABLISHED)
I didn't expect these ssh connections (it should only be me!) so I looked up the IP address and it seems to be in China. So what should I do now to check whether these ssh connections are malicious and if so what they may have done to the server. I'd rather not nuke it but if it's been compromised (since they have root access I presume it has!) then perhaps that's the simplest thing to do.
Update: Since writing the above, I have 2 different SSH connections so I presume it really is compromised.
sshd 31009 root 3u IPv4 66979206 0t0 TCP xxx.xxx.xxx.xxx:ssh->221.194.44.218:50829 (ESTABLISHED)
sshd 31010 sshd 3u IPv4 66979206 0t0 TCP xxx.xxx.xxx.xxx:ssh->221.194.44.218:50829 (ESTABLISHED)
If anyone can suggest a sensible approach to checking for a compromise/cleaning this up/seeing what's happened that would be great to help me learn (I'm such a n00b!).
Update 2: It appears that this isn't signs of a compromise but rather the signs of brute force log in attempts - see the comments from @bodgit and @ultrajohn below.