Re:There’s a rootkit in the closet
by barrkel on Saturday March 13, 2010 @03:04AM
(#1188672)
If this style of interception becomes popular, it seems to argue for a statically linked busybox or similar that uses syscalls directly.
[ Parent
| on HN ]
The nice thing about this method is that you don't have to muck about in the kernel with a kernel module or anything like that. Also, you don't have to replace any binaries on the system, so everything _looks_ fine to an md5 comparison. Also, if you've setup something like tripwire to only watch specific configuration files and services, it might not catch the newly created /etc/ld.so.preload file.
Some programs (such as login), are already statically compiled to prevent this exact thing from happening.
I think that the default tripwire config (and definitely the default samhain config) includes monitoring new files in /etc, so at least there's that protection. Unfortunately not many people use those applications in real deployments.
Hmm, I have not encountered a suid login. Since login runs passwd, and passwd uses pam, and pam is heavily based on demand-loaded libraries, that would be rather hard and big.
Static shell? Sure, sash. Also helpful when ldso or libc is busted via non-rootkit means.
He was able to find it for this reason; ldd is statically-linked:
$ ldd `which ldd`
not a dynamic executable
But if you audit your /etc files or the list of files in the executable directory of your web app, you also would have noticed this. It's not really undetectable, as it doesn't hide itself or the things it needs to run at all. More people check /etc once in a while than check the md5sums of their binaries.It's not a static binary either, it's a script:
$ file `which ldd`
/usr/bin/ldd: Bourne-Again shell script text executable
It's also worth reading up on LD_TRACE_LOADED_OBJECTS and the possible exploits therein, e.g. http://news.ycombinator.com/item?id=902958If the attacker were a little more clever, they could have faked bogus ldd output too.
Running ldd can also invoke arbitrary code: http://www.catonmat.net/blog/ldd-arbitrary-code-execution/