LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Hacker's Intrution Attempt (https://www.linuxquestions.org/questions/linux-security-4/hackers-intrution-attempt-630281/)

aq_mishu 03-24-2008 01:14 PM

Hacker's Intrution Attempt
 
I found these in my /var/log/messages...
Quote:

Mar 23 20:50:08 ns1 sshd(pam_unix)[1009]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=srv1.ejps.nl user=root
Mar 23 21:57:34 ns1 sshd(pam_unix)[1095]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=220.241.57.33 user=root
Mar 24 03:21:59 ns1 sshd(pam_unix)[1554]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.62.79.165 user=root
Mar 24 03:55:48 ns1 sshd(pam_unix)[1634]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:57:47 ns1 sshd(pam_unix)[1676]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:57:54 ns1 sshd(pam_unix)[1678]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:58:18 ns1 sshd(pam_unix)[1686]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:58:25 ns1 sshd(pam_unix)[1688]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:58:33 ns1 sshd(pam_unix)[1690]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:58:40 ns1 sshd(pam_unix)[1692]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:58:48 ns1 sshd(pam_unix)[1694]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:59:16 ns1 sshd(pam_unix)[1704]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:59:23 ns1 sshd(pam_unix)[1706]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 03:59:56 ns1 sshd(pam_unix)[1718]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 04:00:14 ns1 sshd(pam_unix)[1744]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 04:00:22 ns1 sshd(pam_unix)[1746]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 04:00:29 ns1 sshd(pam_unix)[1748]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
Mar 24 04:01:49 ns1 sshd(pam_unix)[1815]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=202.105.179.9 user=root
This means I think the guys from these IPs are trying to get access using the ssh and the following pass. Now what should I do?? First can block the IPs in my bann list. then anything?? suggestions.... plz...

anomie 03-24-2008 01:20 PM

sshd_config:
Code:

PermitRootLogin no
Then reload sshd.

custangro 03-24-2008 01:27 PM

Also make sure that you have the ssh ports closed on your firewall...if they aren't already...

-C

aq_mishu 03-24-2008 01:30 PM

I need to open the ssh port because sometimes i need to login from remote. but well, the IP 202.105.179.9 tried with many of the system users ids, used by the deamons. well, i'm doing this... denying root. also i'm adding them to iptables and also monitoring them... thanks a lot....

aq_mishu 03-24-2008 01:36 PM

well, again, i need to see who are trying to get in to my server using ssh. is it enough to check the /var/log/secure file?? for all success and unsuccess?? and also please tell me what should i do to check in this file about all thing regarding the user root... grep?? i mean i want to filter and see only things about root.....

anomie 03-24-2008 01:42 PM

Quote:

Originally Posted by aq_mishu
is it enough to check the /var/log/secure file??

Yes.

Quote:

and also please tell me what should i do to check in this file about all thing regarding the user root... grep??
Yes. Or, for newer Redhat-family distros, logwatch should be installed and configured by default. Check root's mail daily.

aq_mishu 03-24-2008 01:53 PM

shit shit!!!! i doscovered brute force attack on root account and finally i understood i need to write some special codes to grep and fetch them in my database to analyze for accounts and IPs.... it's a war!!!!!

Hangdog42 03-24-2008 02:32 PM

Perhaps you should read this sticky

aq_mishu 03-24-2008 04:48 PM

thans a lot... now i'm working on it...

BrianK 03-24-2008 05:39 PM

FWIW, I block all incoming ssh except internal and specific external ip addresses, i.e. select known sources like my house or my web server.

This can be done with simple hosts.allow/hosts.deny.

I haven't read all the security issues, but, for me, this worked fine. I had been hacked multiple times over the course of a week (old ssh & done to a computer I wasn't monitoring). After a few successful attempts, I was on a list & was getting 50-60 login attempts per hour. modifying hosts.allow/deny fixed it instantly. I updated ssh too, but that was to remove a vulnerability more than control who can attempt brute-force logins.

aq_mishu 03-25-2008 04:59 AM

well, problem is sometimes i have to log in using my GPRS/EDGE connection which is a dynamic IP. Otherwise i would so that. anyways... i think we should make a public shared list of these ediot's IPs....

unSpawn 03-25-2008 07:06 AM

If you want to share offender IPs see the Dshield or Mywatchmen clients.

BrianK 03-25-2008 02:45 PM

Quote:

Originally Posted by aq_mishu (Post 3099585)
well, problem is sometimes i have to log in using my GPRS/EDGE connection which is a dynamic IP. Otherwise i would so that. anyways... i think we should make a public shared list of these ediot's IPs....

I had the same problem which is why I put my webserver into the loop. My webserver is open to ssh access from anywhere & is manned by people who watch it all the time with all sorts of fancy security devices. I don't have that luxury, so I use theirs. In other words, I ssh to my web server, then down to my office, this way I can get to my office from anywhere.

Again, just $.02.

v00d00101 03-25-2008 06:55 PM

If you happen to be lucky and have a router that supports port forwarding but allows you to set both internal and external ports, then set the external port to something high, but forward it to the normal ssh port number.

So external port is 63000, but internal port is 22. If i need ssh access from the real world, i do that.

If not look at port knocking.

billymayday 03-25-2008 07:02 PM

Or better still, have sshd listen on another port for external traffic - no need to forward your router. I also only allow one specifically created user to ssh from outside.

Edit - and block external connections to port 22


All times are GMT -5. The time now is 12:42 AM.