LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-08-2012, 06:37 PM   #1
dev102
LQ Newbie
 
Registered: Nov 2011
Location: East Coast
Distribution: RedHat
Posts: 14

Rep: Reputation: Disabled
find out binary file tampering


Hello,
I have a box that i recently leased.
I hardened it pretty good but I'm worried that i may have missed something buried in somewhere.
i run checkrootkit, tiger and found nothing.
My question is
1-how can i find md5 of debian-6 binaries such for following files:
/etc/passwd
/bin/netstat
/bin/ls
/bin/login
/bin/cat
/bin/ps
/usr/bin/last
/usr/bin/apt-get
2- other than finding md5sum of those files and comparing; is there other methods of finding out if they're tempered with?

3 - I run the following to find setgid and got following(I know most of them are normal but just want get 2nd opinion on the ones i don't know i put * next to it)

find / -user root -perm -4000 -print
/bin/mount
/bin/su
/bin/umount
/bin/ping
/bin/ping6

/usr/bin/sudoedit
/usr/bin/gpasswd *
/usr/bin/newgrp *
/usr/bin/chfn *
/usr/bin/sudo
/usr/bin/passwd
/usr/bin/chsh *
/usr/sbin/exim4 *
/usr/lib/pt_chown *
/usr/lib/openssh/ssh-keysign

Thank you all
 
Old 05-09-2012, 04:03 AM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
To verify the binary files on a Debian system, use the debsums command: http://www.digipedia.pl/man/doc/view/debsums.1/
Personally, I am suspicious about a particular binary, I will download the package from the repository and verify it manually against the one installed in my system as the date, time, and md5 sum should all match.

WRT the suid files, on my system: usr/bin/gpasswd, /usr/bin/newgrp, /usr/bin/chfn,/usr/bin/chsh, and pt_chown are all root owned, setuid. I don't have exim.

Quote:
I hardened it pretty good but I'm worried that i may have missed something buried in somewhere
This is a vague and ominous statement and since you are concerned about your binary integrity (root level), may I ask what is giving you cause for concern? While your system binaries may be intact, it does not mean that your system has not been compromised and if something has happened to raise your suspicions a more thorough investigative approach would be in order.
 
Old 05-15-2012, 12:20 PM   #3
djsoundfx
Member
 
Registered: May 2008
Distribution: Gentoo, Ubuntu, RHEL, CentOS, BSD, Solaris
Posts: 82

Rep: Reputation: 23
Noway2 has some great advice and I am too am curious why you think your system is compromised? In the future (depending on your environment) you may want to look in to something like AIDE (Advanced Intrusion Detection environment). Its very configurable (and trust me it takes some time to configure) and its basically like tripwire only free. This way you can keep an eye on files and be alerted to their changing.
 
Old 05-16-2012, 02:39 PM   #4
dev102
LQ Newbie
 
Registered: Nov 2011
Location: East Coast
Distribution: RedHat
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thank you Noway for that tool(i didn't know it).
What i mean by hardening is : after leasing the box, i have went through checklist of items to harden it and checking binary integrity was at end of that list.

Right now, it only accepts ssh-key login from specific IP among other things.
Let me know what you meant by analysis(i have run tiger and checkroot and they found nothing).
 
Old 05-16-2012, 03:00 PM   #5
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Here in LQ-Security, we typically base our investigation and analysis on the CERT Intruder Detection Checklist (see the security references sticky in this forum). In a nutshell, the process involves looking for signs of a compromised system including verifying binaries, looking for cron entries, looking for processes that shouldn't be running, looking for hidden files and folders, especially ones with setuid, and examining the logs for signs of malicious activity.
 
Old 05-20-2012, 02:24 PM   #6
GoodNewsAnybody
LQ Newbie
 
Registered: May 2012
Posts: 4

Rep: Reputation: Disabled
Just wanted to echo that a Host-Intrusion-Detection-System == HIDS can automate the comparision of checksums.

Most HIDS will create a database of known good checksums and will recheck them from time to time.
 
Old 05-21-2012, 04:24 AM   #7
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Quote:
Originally Posted by GoodNewsAnybody View Post
Just wanted to echo that a Host-Intrusion-Detection-System == HIDS can automate the comparision of checksums.

Most HIDS will create a database of known good checksums and will recheck them from time to time.
That is true and in order to make proper use of a HIDs, one needs to install it very early on in the system configuration, ideally before the system is placed on a network and certainly before a suspected intrusion.

I, personally, would recommend using Aide and setting up a cron task to perform a daily scan and email a report. Most systems will see changes as the log files roll over, but the core system should remain unchanged. While some may argue that daily is too much noise or too much effort, I find it only takes about 30 seconds to scan the daily email for unanticipated changes.
 
  


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
Linux utility to combine two or more binary files into a single binary file mageshvan Programming 7 05-05-2011 08:06 AM
How to find the Environment variables in a Binary File zasikumar Linux - Kernel 1 12-17-2010 08:31 AM
Help: Opening GenICs binary file, writing to binary file for GADGET-2 (in C) parallax147 Programming 0 10-05-2010 11:06 AM
Physical tampering of a switch PlatinumX General 14 09-19-2010 12:20 PM
How to find the directory of a binary (in C) DiscoStoo Programming 1 03-22-2002 03:29 PM

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

All times are GMT -5. The time now is 08:29 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