Is '/usr/bin/find' reliable if '/bin/ls' has been replaced?
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is '/usr/bin/find' reliable if '/bin/ls' has been replaced?
I have a system running RH9 which appears to have been compromised. I believe /bin/ls has been replaced with a "customized" version to confound attempts at inspecting the system. I am using /usr/bin/find (which appears to have been left alone) in order to identify all files which have changed since the time of the compromise (I don't think the intruder was clever enough to hide the footprints he left in the modifcation times of the files). My concern is that, if find relies upon ls, its output may also be unreliable.
I'm pretty sure that find just calls the stat system call directly, without interpreting ls results. However, if you suspect binaries have been replaced, you really ought to boot of known good media such as a rescue CD and then run a rootkit detector.
You can try using rpm -Va to verify the integrity of system files (assuming that the md5sum and rpm binaries haven't been replaced either). Probably the best way to verify is to use a cdrom-based distro like knoppix and mount the potentially compromised drive read-only. Then calculate md5sums and compare to the "normal" versions. If your system has been compromised, then you will need to reformat the drive and re-install completely (don't reinstall from a backup). Simply replacing trojaned versions isn't a safe way to recover from a security compromise.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.