LinuxQuestions.org
Help answer threads with 0 replies.
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 01-25-2012, 09:07 AM   #1
metalaarif
Member
 
Registered: Oct 2011
Location: Nepal
Distribution: RHEL, CentOS, Slackware
Posts: 131
Blog Entries: 1

Rep: Reputation: 3
Samhain not detecting rootkit or false logins


Unlike OSSEC, Samhain HIDS is not being able to detect any false login, its not being able to detect rootkits or do any kernel level checks.

I have configured Kernel, SUID, Login and logout but it seems it doesn't take any effect.

The things that it can detect only if I add users and it performs file integrity check.

I would really appreciate if anyone could help or provide me with any suggestions.
Its intalled and configured properly according to BOOK (Host Integrity Monitoring Using Osiris and Samhain) yet it is not detecting a thing.
I dont know where i'm making mistake.

I even have installed rootkit and it doesn't even detect any file modification cause by it.

I seriously need help..
 
Old 01-25-2012, 09:57 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by metalaarif View Post
Unlike OSSEC,
I could be wrong but AFAIK the rootkit component of OSSEC HIDS hasn't been significantly updated in a while...


Quote:
Originally Posted by metalaarif View Post
Samhain HIDS is not being able to detect any false login,
Define "false login"?
How did you test it?


Quote:
Originally Posted by metalaarif View Post
its not being able to detect rootkits or do any kernel level checks.
How did you test this?
What Samhain release?
Installed from source or as a distribution or third party package?
What distribution do you use (maybe fill in your Control Panel details)?
What kernel do you run?


Quote:
Originally Posted by metalaarif View Post
Its intalled and configured properly
Attach your full configuration file?


Quote:
Originally Posted by metalaarif View Post
I even have installed rootkit and it doesn't even detect any file modification cause by it.
That is not a suggestion I would make unless you test inside an isolated and expendable virtualization guest.
What rootkit BTW?
 
Old 01-25-2012, 12:07 PM   #3
metalaarif
Member
 
Registered: Oct 2011
Location: Nepal
Distribution: RHEL, CentOS, Slackware
Posts: 131

Original Poster
Blog Entries: 1

Rep: Reputation: 3
I am performing this in a virtual environment. I am doing it in VMware to be safe and secure.
I have installed latest version of samhain-3.0.1 in Ubuntu 10.04 Desktop edition (server edition) both, kernel version 2.6.32.33.
I did I have done gpg check too and its totally fine.
To install I performed
Quote:
# ./configure
# make
# make install
I didn't do
Quote:
(# make install-boot)
because i am just testing and if reboot it will scan everything and will take more than an hour to start up.

I do not have problem with tuning configuration files for file integrity check. I have done minor changes and left rest to default setting.

I changed few things, it is exactly same to books configuration
Quote:
[SuidCheck] (Check the filesystem for SUID/SGID binaries)
SuidCheckActive = yes
SuidCheckSchedule = 0 16 * * Wed
SeveritySuidCheck = crit
SuidCheckQuarantineFiles = no

[Kernel] (Check for loadable kernel module rootkits )
KernelCheckActive = True
KernelCheckInterval = 300
SeverityKernel = info

[Utmp](Logging of login/logout events)
LoginCheckActive = True
SeverityLogin=info
SeverityLoginMulti=warn
SeverityLogout=info
These are just how I configured.

Now, I need to create a baseline

Quote:
# samhain -t init
# samhain -t check -p warn --foreground
I just checked with above command and it detects few alerts, that's fine, I'm not much worried about minor ones for now.

Now lets test for real threats
Quote:
I will create 1 user
# useradd dragon
# passwd dragon
I will delete files and add
# mkdir /etc/dragon
# vi /etc/dragon/hacker.txt
# vi /etc/dragon/hello.txt
# rm -f /etc/dragon/hello.txt
# touch /bin/ls
#touch /bin/ps
I am doing these changes directly in the ubuntu desktop.

In my case false login is like this (This is for internal threat test.):
I am direclty trying to login to root but providing wrong password.
I have installed openssh-server then i'm trying to login via ssh client from different computer.
I have been doing brute-force attack using hydra. Unlike OSSEC which detects and log each and every detail.

Quote:
Finally, the rootkit which i installed was kbeast-v1 from core.ipsecs.com
I installed and # ./setup build
installation successful!!!

After installing and modifing I need to scan for possible threats

# samhain -t check -p warn --foreground

Quote:
WARN : [2012-01-06T14:52:33+0000] msg=<Unrecognized section heading in line 362 of configuration file>
WARN : [2012-01-06T14:52:33+0000] msg=<Unrecognized section heading in line 414 of configuration file>
WARN : [2012-01-06T14:52:33+0000] msg=<Unrecognized section heading in line 435 of configuration file>
I don't know why i get these warning, I shouldn't be getting isn't it. I don't know why, I changed these before creating a baseline.

For some reason for the first time, I just performed everything and it really detected most of those things I mentioned.
It detected kbeast but I'm not sure if it detected it as rootkit and I didn't find any false login.

I have attached configuration and log files.
Attached Files
File Type: txt samhain_log.txt (61.2 KB, 9 views)
File Type: txt samhainrc.txt (15.8 KB, 18 views)

Last edited by metalaarif; 01-25-2012 at 12:08 PM. Reason: spelling mistake
 
Old 01-28-2012, 04:47 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Sorry for the late reply. Priorities and such.


Quote:
Originally Posted by metalaarif View Post
I am performing this in a virtual environment. I am doing it in VMware to be safe and secure.
Good.


Quote:
Originally Posted by metalaarif View Post
I have attached configuration and log files.
Thanks.


Quote:
Originally Posted by metalaarif View Post
I changed few things, it is exactly same to books configuration
You should not assume everybody knows or has that book. Anyway. The [Kernel] section is missing values the documentation (samhain-3.0.1/docs/MANUAL-2_3.html/MANUAL-2_3/checking-for-kernel-module-rootkits.html) talks about. Without these the LKM check can't detect changes.


Quote:
Originally Posted by metalaarif View Post
I am direclty trying to login to root but providing wrong password.
If you run Ubuntu then root is not allowed to log in so which password you use should not matter.


Quote:
Originally Posted by metalaarif View Post
I have installed openssh-server then i'm trying to login via ssh client from different computer.
I have been doing brute-force attack using hydra. Unlike OSSEC which detects and log each and every detail.
The configuration file has generic "SetFilecheckTime" of one hour but the [Utmp] section is missing a specific "LoginCheckInterval" for scheduling the login/logout check.
* IMHO OSSEC HIDS shouldn't be compared with Samhain. If you would then in some aspects it may perform better and worse in others.
** Also I've noticed you use "SyslogFacility=LOG_LOCAL2". Did you define this facility in your syslog configuration, initialize the log file and restart syslog?


Quote:
Originally Posted by metalaarif View Post
I don't know why i get these warning
Maybe the checks weren't enabled when you compiled Samhain. Check your build directory, the configure.log / configure.status files.


Quote:
Originally Posted by metalaarif View Post
For some reason for the first time, I just performed everything and it really detected most of those things I mentioned. It detected kbeast but I'm not sure if it detected it as rootkit and I didn't find any false login.
Doubtful. At least your (current) log and configuration file don't support that. Samhain detected Kbeast only by the files added to the /usr/_h4x_ path.
 
Old 01-28-2012, 05:02 AM   #5
metalaarif
Member
 
Registered: Oct 2011
Location: Nepal
Distribution: RHEL, CentOS, Slackware
Posts: 131

Original Poster
Blog Entries: 1

Rep: Reputation: 3
Finally, I have corrected my mistakes and I am quite happy with your suggestion never the less this link really helped me a lot http://www.linuxquestions.org/questi...amhain-895613/.

I Understood and now I have compiled various optional modules required.

Quote:
# ./configure --enable-login-watch
# ./configure --enable-mount-check
# ./configure --with-kcheck=[/boot/system.map]
# ./configure --with-checksum=CHKSUM
Later I installed Kbeast, I got these results I just want you to confirm if these are the possible changes done in kernel due to the rootkit installtion

Quote:
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<003 sys_read>, path=<K_syscall_0003>, size_old=<3223365664>, size_new=<4161972336>,
13F01F5CB2A4005B5754FAC955FEED518DD1F71EF24F8D95
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<004 sys_write>, path=<K_syscall_0004>, size_old=<3223365552>, size_new=<4161974384>,
196708541F0E21CE9DA61A326130B94BC60B5434AB2695D7
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<005 sys_open>, path=<K_syscall_0005>, size_old=<3223355440>, size_new=<4161975808>,
E6F0D12EE4806DA620219EC3812BB8BE94DA1728294B8103
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<010 sys_unlink>, path=<K_syscall_0010>, size_old=<3223412352>, size_new=<4161974720>,
473942FBD654ECEE9F591B34EC4A27A771C0067E1FD0E231
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<037 sys_kill>, path=<K_syscall_0037>, size_old=<3222664816>, size_new=<4161971488>,
B4348EE70BD22CCD3D62D5D1D6B5B060E20C6C28427A35F4
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<038 sys_rename>, path=<K_syscall_0038>, size_old=<3223411920>, size_new=<4161975408>,
CFE91FE49A033374F720770AAEC5CCA4BB38BE8A50182B86
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<040 sys_rmdir>, path=<K_syscall_0040>, size_old=<3223412688>, size_new=<4161974944>,
7AEE135C158652610EC2B66F2C20917CD6135C55DCE92F06
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<129 sys_delete_module>, path=<K_syscall_0129>, size_old=<3222801696>, size_new=<4161976048>,
44F0D88CBBA1AB7B4103D19BA8F13E188961C81E2A60E8C1
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<220 sys_getdents64>, path=<K_syscall_0220>, size_old=<3223425008>, size_new=<4161976256>,
25931C3C01747EF7505453A5B1FBF301B27B0FACB0809FAA
CRIT : [2012-01-27T19:10:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<301 sys_unlinkat>, path=<K_syscall_0301>, size_old=<3223412624>, size_new=<4161975168>,
E5382A779A8C95E6B5F0073066E5A08A5B2AD7BC93877E9F
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<003 sys_read>, path=<K_syscall_0003>, ctime_old=<[1978-12-31T06:59:31]>, ctime_new=<[2013-04-28T07:03:04]>, mtime_old=<[2016-03-13T15:37:57]>, mtime_new=<[1947-02-19T14:02:09]>
BE416394BE15B9B7CD19AA746B6DACF909898027A66E5128
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<004 sys_write>, path=<K_syscall_0004>, ctime_old=<[1978-12-31T06:59:31]>, ctime_new=<[1942-11-05T14:40:51]>, mtime_old=<[2016-03-13T15:37:57]>, mtime_new=<[1980-05-16T17:29:40]>
7445417BB66BA36546F9342474F452620BF9669F0242C460
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<005 sys_open>, path=<K_syscall_0005>, ctime_old=<[2019-09-23T18:37:32]>, ctime_new=<[2032-06-27T07:51:08]>, mtime_old=<[1904-01-09T12:21:41]>, mtime_new=<[1904-01-09T12:21:41]>
5E72F221D1A57B58237B1C20B14DA29154744FCC12AAAF0E
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<010 sys_unlink>, path=<K_syscall_0010>, ctime_old=<[1970-01-01T04:50:39]>, ctime_new=<[1963-04-02T07:02:00]>, mtime_old=<[1978-06-14T19:39:01]>, mtime_new=<[1989-02-23T22:43:16]>
818109304E94E3F71C36AF93E9E6C765A633BB35391C7BC3
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<037 sys_kill>, path=<K_syscall_0037>, ctime_old=<[1902-05-11T22:10:27]>, ctime_new=<[1982-12-04T05:08:33]>, mtime_old=<[2016-03-13T15:37:57]>, mtime_new=<[1972-11-26T07:12:54]>
F5D524DE0F76D7DB1951C55C2EE03EA123C3796D715122B7
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<038 sys_rename>, path=<K_syscall_0038>, ctime_old=<[1986-07-07T00:44:28]>, ctime_new=<[1983-01-13T02:42:07]>, mtime_old=<[1904-01-09T12:21:41]>, mtime_new=<[1962-08-12T08:45:47]>
CDC65B065F48BE89185DD3547A45640F0CCB11D7757BD389
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<040 sys_rmdir>, path=<K_syscall_0040>, ctime_old=<[1970-01-01T04:50:39]>, ctime_new=<[1908-11-17T09:22:12]>, mtime_old=<[1978-06-14T19:39:01]>, mtime_new=<[1907-04-08T15:47:01]>
C317712C4786868BF1EB2DC33FB825D24650E4414566D1B6
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<129 sys_delete_module>, path=<K_syscall_0129>, ctime_old=<[2019-09-24T00:01:48]>, ctime_new=<[1970-01-01T00:00:00]>, mtime_old=<[1904-01-09T12:21:41]>, mtime_new=<[2002-01-17T12:43:59]>
4448AD81140B88FDCA56BB219462369905AB9B3B108E778D
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<220 sys_getdents64>, path=<K_syscall_0220>, ctime_old=<[2019-09-23T19:28:44]>, ctime_new=<[2006-12-23T22:40:05]>, mtime_old=<[1904-01-09T12:21:41]>, mtime_new=<[1906-09-26T11:48:17]>
A7C2A7E9A3FC004BE3A7DAD59419D06EFF869A7588F94EB0
CRIT : [2012-01-27T19:11:04+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<301 sys_unlinkat>, path=<K_syscall_0301>, ctime_old=<[1970-02-21T16:06:39]>, ctime_new=<[1963-04-24T08:01:44]>, mtime_old=<[2014-08-09T02:37:09]>, mtime_new=<[2014-08-09T02:37:09]>
79F9DE79AF2D6B08C35B541588DB2CE241CED574EECF0DF3
CRIT : [2012-01-27T19:13:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<003 sys_read>, path=<K_syscall_0003>, ctime_old=<[2013-04-28T07:03:04]>, ctime_new=<[1995-03-20T12:21:53]>, mtime_old=<[1947-02-19T14:02:09]>, mtime_new=<[1995-03-14T09:40:05]>
B8A6BF33A33E4D979BDAF73596DECFA4B9D7B5C1AC8A9D55
CRIT : [2012-01-27T19:13:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<037 sys_kill>, path=<K_syscall_0037>, ctime_old=<[1982-12-04T05:08:33]>, ctime_new=<[1994-02-28T17:44:23]>, mtime_old=<[1972-11-26T07:12:54]>, mtime_new=<[2030-09-13T18:33:36]>
714A439F8FFB7D4F8CCE1B247BBB927A2A6ED87CE59D5550
MARK : [2012-01-27T19:14:20+0000] msg=<---- TIMESTAMP ---->
475C9981130E3ED0B3EC0D5D6ADE7DF5D6FB298C5A5ACF9D
CRIT : [2012-01-27T19:20:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<003 sys_read>, path=<K_syscall_0003>, ctime_old=<[1995-03-20T12:21:53]>, ctime_new=<[1970-01-01T00:00:00]>, mtime_old=<[1995-03-14T09:40:05]>, mtime_new=<[1975-02-23T16:21:20]>
6367A20F5A92161260BB1CA1904C191E3FA3D2BD420A9CA9
CRIT : [2012-01-27T19:20:34+0000] msg=<POLICY [Kernel] SYSCALL modified> syscall=<037 sys_kill>, path=<K_syscall_0037>, ctime_old=<[1994-02-28T17:44:23]>, ctime_new=<[1975-02-22T00:25:44]>, mtime_old=<[2030-09-13T18:33:36]>, mtime_new=<[1975-02-24T20:41:28]>
264E652B01FCB64CDEA0F7E7B182EEC0A6C85B48FE5D5649
I defined [Utmp] so that I can monitor login events
Quote:
[Utmp]
LoginCheckActive = True
SeverityLogin=info
SeverityLoginMulti=warn
SeverityLogout=info
LoginCheckInterval = 30
I don't know for some reason it worked once but then it wasn't working. But I'm sure I'll get it working.

Finally, I would like to know which checksum does samhain support by default.

Last edited by metalaarif; 01-28-2012 at 05:03 AM. Reason: removed colour red
 
Old 01-28-2012, 05:37 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by metalaarif View Post
Ah, yes, one of the more elaborate threads of 2011. Was fun doing that.


Quote:
Originally Posted by metalaarif View Post
Later I installed Kbeast, I got these results I just want you to confirm if these are the possible changes done in kernel due to the rootkit installtion
Yes, it would be very uncommon for any process to modify system calls. Looks good. Except the log line ctime and mtime values look wacky. Best run that by Rainer Wichmann, the Samhain developer via http://la-samhna.de/contact.html or http://la-samhna.de/forum/cgi-bin/wolfbbs_index.cgi.


Quote:
Originally Posted by metalaarif View Post
Finally, I would like to know which checksum does samhain support by default.
See samhain-3.0.1/docs/MANUAL-2_3.html/MANUAL-2_3/hash-function.html and samhain-3.0.1/docs/MANUAL-2_3.html/MANUAL-2_3/file-signatures.html: TIGER but SHA-1 or MD5 can be used.
 
Old 01-28-2012, 05:51 AM   #7
metalaarif
Member
 
Registered: Oct 2011
Location: Nepal
Distribution: RHEL, CentOS, Slackware
Posts: 131

Original Poster
Blog Entries: 1

Rep: Reputation: 3
I think now I am able to do what I really wanted to do.
Thanks for the help.
 
  


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
LXer: Using scponly To Allow SCP/SFTP Logins And Disable SSH Logins On Debian Squeeze LXer Syndicated Linux News 0 08-24-2011 04:20 AM
Samhain questions kaplan71 Linux - Security 1 06-16-2010 05:16 PM
rootkit hunter false positive for Xzibit Rootkit on CentOS 4.8? abefroman Linux - Security 2 12-20-2009 08:19 AM
what can or can't OSSEC do compare to samhain? kissfreeman Linux - Newbie 3 06-19-2008 07:56 AM
Samhain vs Osiris? Opinions welcome. humbletech99 Linux - Security 1 01-02-2007 03:49 AM

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

All times are GMT -5. The time now is 02:27 PM.

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