LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-24-2008, 01:14 PM   #1
aq_mishu
Member
 
Registered: Sep 2005
Location: Bangladesh
Distribution: RH 7.2, 8, 9, Fedora
Posts: 217

Rep: Reputation: 30
Question 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...
 
Old 03-24-2008, 01:20 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
sshd_config:
Code:
PermitRootLogin no
Then reload sshd.
 
Old 03-24-2008, 01:27 PM   #3
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

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

-C
 
Old 03-24-2008, 01:30 PM   #4
aq_mishu
Member
 
Registered: Sep 2005
Location: Bangladesh
Distribution: RH 7.2, 8, 9, Fedora
Posts: 217

Original Poster
Rep: Reputation: 30
Thumbs up

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....
 
Old 03-24-2008, 01:36 PM   #5
aq_mishu
Member
 
Registered: Sep 2005
Location: Bangladesh
Distribution: RH 7.2, 8, 9, Fedora
Posts: 217

Original Poster
Rep: Reputation: 30
Question

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.....
 
Old 03-24-2008, 01:42 PM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
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.
 
Old 03-24-2008, 01:53 PM   #7
aq_mishu
Member
 
Registered: Sep 2005
Location: Bangladesh
Distribution: RH 7.2, 8, 9, Fedora
Posts: 217

Original Poster
Rep: Reputation: 30
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!!!!!
 
Old 03-24-2008, 02:32 PM   #8
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Perhaps you should read this sticky
 
Old 03-24-2008, 04:48 PM   #9
aq_mishu
Member
 
Registered: Sep 2005
Location: Bangladesh
Distribution: RH 7.2, 8, 9, Fedora
Posts: 217

Original Poster
Rep: Reputation: 30
thans a lot... now i'm working on it...
 
Old 03-24-2008, 05:39 PM   #10
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
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.
 
Old 03-25-2008, 04:59 AM   #11
aq_mishu
Member
 
Registered: Sep 2005
Location: Bangladesh
Distribution: RH 7.2, 8, 9, Fedora
Posts: 217

Original Poster
Rep: Reputation: 30
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....
 
Old 03-25-2008, 07:06 AM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
If you want to share offender IPs see the Dshield or Mywatchmen clients.
 
Old 03-25-2008, 02:45 PM   #13
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by aq_mishu View Post
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.
 
Old 03-25-2008, 06:55 PM   #14
v00d00101
Member
 
Registered: Jun 2003
Location: UK
Distribution: Devuan Beowulf
Posts: 514
Blog Entries: 1

Rep: Reputation: 37
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.
 
Old 03-25-2008, 07:02 PM   #15
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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

Last edited by billymayday; 03-25-2008 at 07:03 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The hacker's way harmattan General 7 07-24-2007 08:04 PM
Intrution Detection using Packet Analysis johnnyde Linux - Security 1 03-26-2005 09:33 AM
A Hacker's Poem misfit-x General 6 01-15-2004 07:50 AM
cannot remove hacker's file jupiter Linux - Security 4 09-14-2001 05:54 PM
cannot remove hacker's file jupiter Linux - Newbie 1 09-03-2001 08:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration