Netscan detected from host - Help!
##########################################################################
# Netscan detected from host MYSERVERIP #
##########################################################################
time protocol src_ip src_port dest_ip dest_port
---------------------------------------------------------------------------
Fri Dec 28 05:16:28 2012 TCP MYSERVERIP 22 => X.X.X.X 80
Fri Dec 28 05:19:14 2012 TCP MYSERVERIP 22 => X.X.X.X 80
Fri Dec 28 05:14:14 2012 TCP MYSERVERIP 22 => X.X.X.X 80
...
This is actually the second time this has happened, the first time (about 3 weeks ago) I assumed I had been broken in and created a new clean linode from scratch. This time allowing only ssh public keys access and installed fail2ban (I should have done the first time, I know).
However, it now happened again and this time I seriously doubt that the server has been broken into (although I don't completely discard that possibility).
I need advice on what to do, I'm seriously lost.
Please lend me your help!
7 Replies
Any service that you expose to the internet is a potential entry for an attacker. One commonly exploited service are web apps (like a BBS, blog or CMS). Are you running something like that? Is there anything unusual in the logs for any of the internet-facing services you're running?
Plus none of those services should be able to use port 22, right?
It is possible (I just checked with scapy to make sure!) but why? (And how?)
Was it the same destination both times? If so, running 'tcpdump' (or perhaps adding a iptables rule with no action, just matching their dest IP, so that there's a packet counter) might help see wtf is going on.
Also, unless they include more information about the exact composition of the packets, it's possible they're connecting to YOUR port 22 from THEIR port 80, so check your ssh logs
Could it be that someone sent spoofed tcp packets to my server @ port 22, then my server tried to reply and that reply was interpreted as a netscan by the recipients?
My site is quite often the target of synfloods and other DoS attacks (It's a popular multiplayer game with audience being mostly teenagers I get lots of vandalism).
I've now blocked port 22 (moved ssh to another port).
Also, make sure you keep sshd somewhere below port 1024 – otherwise, in the event your sshd dies and someone has non-root access to your machine, they could bind a doppelganger sshd there. (Rare, but possible. Why chance it?)
@hoopycat:
Anything's possible. It might not be a bad idea to set up an IDS of some sort (e.g. snort) to monitor your outgoing traffic, just so you know what your "emissions" are.
I'll have a look at snort, however I'm worried, what do I do if I find nothing? Lack of evidence of my linode being guilty doesn't mean anything, so what do I do about the ticket? :\
@hoopycat:
Also, make sure you keep sshd somewhere below port 1024 – otherwise, in the event your sshd dies and someone has non-root access to your machine, they could bind a doppelganger sshd there. (Rare, but possible. Why chance it?)
Thanks for the advise, I had set the port to a number above 1024 without thinking of that.
Also, wouldn't hurt to consider dropping all traffic to/from the other provider's network