someone scanning my ports
I am a new Linode user and need a little help in analyzing my iptables log.
Yesterday (April 27) I setup iptables on my linode and decided to leave the linode running to see if the firewall would pick up any action. Today I looked at my log and looks like someone was scanning my ports.
Even though the source ip is different, all the packets are originating from the same mac address and are targeted towards some common ports like 22, 135, 8080 etc.
What would be a good way to deal with these scans? A program that can add rules to iptables to block requests originating from a particular nic or ip? The timing of these attacks/scans is really spread out also so.. I doubt I can capture them using some time limit.
Any help appreciated.
12 Replies
I mean his packets are being dropped right now.. but if he tries something different.
@BipBop:
Even though the source ip is different, all the packets are originating from the same mac address and are targeted towards some common ports like 22, 135, 8080 etc.
That's the MAC address of the router between the Internet and you. MAC addresses are only used to identify entities within the same local area network (in the Linode architecture, a /24 subnet). Anything beyond there will (hopefully) have the MAC address of a router.
(Edit: Also, there is no "someone" or "the scanning user"; there's probably hundreds of thousands, if not millions, of computers out there which are doing this continuously in an attempt to bring your computer into their collective. Anthropomorphizing this activity into that of "some guy" is not a good way to think about it.)
@eld101:
You can install something like OSSEC, which scans your logs and can notify you of port scans, brute force attempts, etc…
I forgot to mention it can also automatically block the suspect IP for a given amount of time. I think default is 5 minutes.
Also, while it's not "security", moving services like SSH to higher port numbers will cut down on failed login entries, since they will be less likely to hit the right port.
Just want to add my 2 cents.
Had experienced this at my previous company. Would notice a ton of random scans on a brand new public ip or domain linked to a vm.
It's scary how quickly they (bots i assume) discover your newly registered domain and start scanning for open ports.
I also noticed once they found an open port, like 22, 80 or 21, they start fairly soon to attempt logins with "default" known usernames. root, admin websitename-admin, wpadmin etc…
its fun to watch actually.
i used to spend 30min bi-daily to check ossec for such activity and add them to blacklist on physical firewall :)
Usually the port scanning continues from another IP in same region once previous one is blocked
Yea, it's scary/fascinating how quickly bots will probe and try to exploit detected vulnerabilities on new systems.
We routinely recommend running through the Secure Your Server guide to help protect against intrusion attempts, including configuring a firewall quickly after you've spun up your Linode. Initial security configurations are also common in StackScripts for this reason.
It's also helpful to test your security by examining your Linode's listening processes with sudo ss -plutn
and/or running external scans on your own systems with a tool such as nmap — I often refer to this cheatsheet for my own testing.