插句話,本文中的ip地址和主機名都被替換了,請不要對號入座,本文手法僅供參考,在正規的入侵檢測操作中,我們還是需要注意很多流程和細節上的問題。另外本文對一些基本概念或者程序之類的不做解釋,如果有不明白的地方,請教google。
進了肉雞,換上我們的ssh后門,具體的方法可以在http://baoz.net 或http://xsec.org 上找到,帶視頻教程 如果看完視頻之后還有疑問,可以到http://cnhonker.com/bbs/ 的linux版交流一下。
一進ssh,哦,奇怪,米國人民問候韓國人民?有異樣……
Last login: Fri Nov 17 08:21:14 2006 from ac9e2da9.ipt.aol.com
好奇,掃一下。
[fatb@baoz ~]$ nmap -P0 ac9e2da9.ipt.aol.com -O |
來,看看:
##檢查是不是vmware的機器
[root@victim root]# ifconfig -a | grep -i -e "00-05-69" -e "00-0C-29" -e "00-50-56" ; dmesg | grep -i vmware |
[root@victim root]# cat /proc/cpuinfo | grep name ;cat /proc/meminfo | grep MemTotal model name : Intel(R) Xeon(TM) CPU 2.80GHz model name : Intel(R) Xeon(TM) CPU 2.80GHz model name : Intel(R) Xeon(TM) CPU 2.80GHz model name : Intel(R) Xeon(TM) CPU 2.80GHz MemTotal: 1030228 kB |
關于anti-honeynet,下面有兩個文章不錯,不過都是針對vmware或者User Mode Linux的了,如果人家用真實機器,那還得靠人品啊,呵呵。
http://xsec.org/index.php?module=arc...ew&type=3&id=5
http://xsec.org/index.php?module=arc...ew&type=3&id=6
關于honeynet和anti-honeynet的討論,可以來這里聊聊
http://cnhonker.com/bbs/thread.php?fid=15&type=1
廢話少說,接下來第二個事就是看看有沒道友在上面,有的話就不好意思了,得請出去
一般我都會先打幾個命令看看,因為有些rootkit他改的不好,或者是因為版本的問題,反正不管什么原因,有一些被替換了的程序的一些參數會沒有的。
[root@victim root]# ls -alh ls: invalid option -- h Try `ls --help' for more information. |
呵呵,ls被替換了。在看看netstat
[root@victim root]# netstat -anp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1702/httpd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1516/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1540/ tcp 0 300 123.123.123.123:22 10.20.30.40:2245 ESTABLISHED 6097/sshd: tcp 0 0 123.123.123.123:22 10.20.30.40:2247 ESTABLISHED 6815/sshd: Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 121430 6815/sshd: /tmp/ssh-vfJj6815/agent.6815 unix 2 [ ACC ] STREAM LISTENING 116904 6097/sshd: /tmp/ssh-weHq6097/agent.6097 unix 6 [ ] DGRAM 1560 1476/syslogd /dev/log unix 2 [ ] DGRAM 1771 1570/crond unix 2 [ ] DGRAM 1728 1549/ unix 2 [ ] DGRAM 1714 1540/ unix 2 [ ] DGRAM 1568 1480/klogd |
不管3721,直接搞兩個檢查rootkit的東西回來看看,chkrootkit和rkhunter。
先爽一下chkrootkit:
注意,我們現在是在根本不可信的環境下檢查的,可能有朋友會問“為什么要在不可信的環境里檢查啊”,原因是這樣的,因為我們先在一個不可信的環境里檢查,得出一份結果,然后再在稍微可信的環境里檢查,再得到一份結果,這樣我們前后對比,大致就可以知道這位道友是否有使用LKM或者更高級的rootkit 了。
檢查完之后,我們發現下面有趣的信息:
[root@victim chkrootkit-0.47]# ./chkrootkit Checking `ifconfig'... INFECTED Checking `pstree'... INFECTED Searching for t0rn's v8 defaults... Possible t0rn v8 \(or variation\) rootkit installed Searching for Showtee... Warning: Possible Showtee Rootkit installed Searching for Romanian rootkit... /usr/include/file.h /usr/include/proc.h Checking `bindshell'... not infected Checking `lkm'... You have 2 process hidden for ps command chkproc: Warning: Possible LKM Trojan installed |
我們再找rkhunter爽一下:
rkhunter的輸出信息比較人性化也比較多,--quite選項輸出又有點問題,我就rip比較有用的信息出來,日志在/var/log/rkhunter.log。
[root@victim chkrootkit-0.47]# /usr/local/bin/rkhunter -c --createlogfile Rootkit 'SHV4'... [ Warning! ] Rootkit 'SHV5'... [ Warning! ] Rootkit 'Suckit Rootkit'... [ Warning! ] -->還有這個高級貨啊,偷偷的汗了一下。 * Filesystem checks Checking /dev for suspicious files... [ Warning! (unusual files found) ] Unusual files: /dev/srd0: ASCII text --> /dev下有ascii文件…… ---------------------------- Scan results ---------------------------- MD5 MD5 compared: 51 Incorrect MD5 checksums: 6 File scan Scanned files: 342 Possible infected files: 3 Possible rootkits: SHV4 SHV5 Suckit Rootkit Application scan Vulnerable applications: 4 Scanning took 751 seconds Scan results written to logfile (/var/log/rkhunter.log) ----------------------------------------------------------------------- |
我們可以看到,這兩個程序報告的有低級的rookkit,比如t0rn,SHV5,還有高級的rootkit:suckit。先看在眼里,別太在意,因為 rkhunter和chkrootkit這樣的程序都只能檢測一些默認安裝的rootkit,也不排除把這個rootkit報成那個rootkit的可能。
折騰了一下,心里大概有個數了,回過頭來想想,他必定不只替換了一個ls的,找個靜態工具包回來,并且修改一下PATH變量,優先使用我們的靜態程序。
[root@victim root]# export PATH=/root/.../static/:$PATH |
ok,我們現在再看看ls
[root@victim /]# ls -alh /tmp/mc-root/ total 8.0K drwx------ 2 root root 4.0K Nov 8 19:36 . drwxrwxrwt 9 root root 4.0K Nov 18 10:47 .. |
現在我們的程序暫時還是相對比較信得過的。
繼續做上面兩組檢測。
我們把得到的結果和剛才的相比,chkrootkit對elf的檢測沒有報警了,隱藏進程也沒有了,我們大致可以判斷道友隱藏的手段比較低級,但是想起那個suckit的報警。。。。心里不敢大意。還不知道有沒模塊什么的。
為了更清楚一點,我們分析一下/var/log/rkhunter.log這個日志文件看看?戳巳罩,我們就會清楚為什么rkhunter的兩次的檢測報告試一樣的了,因為他是用md5來校驗的,他有一個數據庫,而chkrootkit是檢測輸出信息。
[11:20:04] /bin/ls Hash NOT valid (My MD5: 0a07cf554c1a74ad974416f60916b78d, expected: dbc1a18b2e447e0e0f7c139b1cc79454)
我們把SHV和suckit相關的信息弄出來看看
[11:20:53] *** Start scan SHV4 *** [11:20:53] - File /lib/lidps1.so... WARNING! Exists. [11:21:12] *** Start scan SHV5 *** [11:21:12] - File /etc/sh.conf... WARNING! Exists. [11:21:12] - File /dev/srd0... WARNING! Exists. [11:21:12] - Directory /usr/lib/libsh... WARNING! Exists. [11:21:15] *** Start scan Suckit Rootkit *** [11:21:15] - File /usr/share/locale/sk/.sk12/sk... WARNING! Exists. [11:21:15] - Directory /usr/share/locale/sk/.sk12... WARNING! Exists. |
[root@victim root]# file /lib/lidps1.so /lib/lidps1.so: ASCII text [root@victim root]# cat /lib/lidps1.so ttyload shsniff shp shsb hide ttymon scanner |
root 1584 0.0 0.0 1852 68 ? S Nov17 0:00 /sbin/ttyload -q root 1586 0.0 0.0 1500 168 ? S Nov17 0:26 ttymon tymon [root@victim root]# netstat -anp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:31338 0.0.0.0:* LISTEN 1584/ttyload tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1702/httpd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1516/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1540/ raw 0 0 0.0.0.0:1 0.0.0.0:* 7 1586/ttymon raw 1312 0 0.0.0.0:1 0.0.0.0:* 7 1586/ttymon |
[root@victim root]# lsof -n -p 1584 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME 3 1584 root cwd DIR 8,3 4096 2 / 3 1584 root rtd DIR 8,3 4096 2 / 3 1584 root txt REG 8,3 652620 212994 /tmp/sh-DJYK3MJABRP (deleted) -->這個是upx壓縮后的特征之一。 3 1584 root mem REG 8,3 103044 12828674 /lib/ld-2.3.2.so 3 1584 root mem REG 8,3 91604 12828689 /lib/libnsl-2.3.2.so 3 1584 root mem REG 8,3 23668 12828683 /lib/libcrypt-2.3.2.so 3 1584 root mem REG 8,3 12696 12828711 /lib/libutil-2.3.2.so 3 1584 root mem REG 8,3 1531064 13991938 /lib/tls/libc-2.3.2.so 3 1584 root 0u CHR 1,3 67051 /dev/null 3 1584 root 1u CHR 1,3 67051 /dev/null 3 1584 root 2u CHR 1,3 67051 /dev/null 3 1584 root 3u IPv4 1798 TCP *:31338 (LISTEN) [root@victim root]# lsof -n -p 1586 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME ttymon 1586 root cwd DIR 8,3 4096 2 / ttymon 1586 root rtd DIR 8,3 4096 2 / ttymon 1586 root txt REG 8,3 93476 43663399 /sbin/ttymon ttymon 1586 root mem REG 8,3 103044 12828674 /lib/ld-2.3.2.so ttymon 1586 root mem REG 8,3 52472 12828695 /lib/libnss_files-2.3.2.so ttymon 1586 root mem REG 8,3 1531064 13991938 /lib/tls/libc-2.3.2.so ttymon 1586 root 3u raw 1799 00000000:0001->00000000:0000 st=07 |
[root@victim root]# nc localhost 31338
SSH-1.5-2.0.13
明顯,這個ssh后門,估計是讀那個/etc/sh.conf作為密碼的。raw socket那個我暫時想不到咱們驗證,因為一來不知道他抓的什么包,icmp or tcp,二來也不知道他抓的包的特征。霸王硬上弓吧。先執行一下。
[root@victim root]# /sbin/ttymon [root@victim root]# /sbin/ttymon --help [root@victim root]# /sbin/ttymon -h |
[root@victim root]# strings /sbin/ttymon Usage: %s <dst> <src> <size> <number> Ports are set to send and receive on port 179 dst: Destination Address src: Source Address size: Size of packet which should be no larger than 1024 should allow for xtra header info thru routes num: packets Could not resolve %s fucknut ICMP jess tc: unknown host 3.3.3.3 mservers lamersucks skillz ttymon ./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |
Dameonic.c is a theoretical router based denial of service attack that exploits a weakness within the Border Gateway Protocol (BGP). If a malicious user sends spoofed malformed packets to a neighboring router, the peer will ignore it and possibly kill the session entirely. Written on a Ultra 5 running Linux Zoot, this has been compiled on Linux, OpenBSD, Solaris without problems.
程序在
http://packetstormsecurity.org/0008-exploits/daemonic.c
出于對這位道友野心的好奇,我下了這個程序回來編譯一下
[fatb@baoz ~]$ ./a Daemonic - BGP Killer [Theories in DoS] www.AntiOffline.com/TID/ Usage: ./a <radd> <sradd> <bgsize> <number> Ports are set to send and receive on port 179 radd: Address of router running BGP [victim] sradd: Source address of neighbor router running BGP [attacker] bgsize: Size of packet which should be no larger than 1024 should allow for xtra header info thru routes num: pulverizations per second |
[root@victim root]# file /etc/sh.conf /etc/sh.conf: ASCII text [root@victim root]# cat /etc/sh.conf 6465d1b20c0c4cd408e34e68e630bc7a - |
下面的是t0rnV8里的東西了,12點多了,還沒吃飯,沒什么心情去跟這個低級的rootkit了,也不想知道下面的內容是什么,估計是encode之后的ssh密碼吧,我猜的。
[root@victim root]# file /dev/srd0 SuxCWu5vgapmla+YFx6Kw9fmiWgMTnPV7ZmNC2ww |
繼續看,這個就是他的老巢了,SHV5的默認目錄,里面來來去去就那些東西,.backup里的是原來的elf程序,回頭我們把這些東西cp回去就完事了。
[root@victim root]# ls -alh /usr/lib/libsh total 104K drwxr-xr-x 6 root root 4.0K Nov 17 16:45 . drwxr-xr-x 133 root root 68K Nov 18 10:13 .. drwxr-xr-x 2 root root 4.0K Nov 8 19:33 .backup -rwxr-xr-x 1 122 114 2.4K Jan 30 2006 .bashrc -rwxr-xr-x 1 122 114 1.8K Feb 19 2003 hide drwxr-xr-x 2 root root 4.0K Nov 8 19:33 .owned -rwxr-xr-x 1 122 114 1.3K Feb 19 2003 shsb drwxr-xr-x 2 root root 4.0K Nov 8 19:33 .sniff drwxr-xr-x 2 root root 4.0K Feb 19 2003 utils [root@victim root]# ls /usr/lib/libsh/.backup/ dir find ifconfig ls lsof md5sum netstat ps pstree slocate top |
下面就是大名鼎鼎的sk了,看到sk,首先關注的就是他的prefix,啟動方式和版本。。。。廢話。。。呵呵
[root@victim root]# ls -alh /usr/share/locale/sk/ total 40K drwxr-xr-x 5 root root 4.0K Sep 7 02:02 . drwxr-xr-x 110 root root 4.0K Nov 8 2005 .. -rw-r--r-- 1 root root 6 May 9 2000 charset -rw-r--r-- 1 root root 1.3K Nov 18 2002 entry.desktop drwxr-xr-x 2 root root 16K Nov 8 2005 LC_MESSAGES drwxr-xr-x 2 root root 4.0K Nov 8 2005 LC_TIME drwxr-xr-x 2 root root 4.0K Sep 7 02:02 .sk12 |
sk沒啟動,因為.sk12都顯示出來了,.sniffer文件里也沒記錄到什么密碼,但我對這個sk12還是充滿好奇心,sftp托到我本地機器玩玩。
[fatb@baoz ~]$ strings sk | grep -i fuck [fatb@baoz ~]$ file sk sk: ELF invalid class invalid byte order (SYSV) [fatb@baoz ~]$ ./sk Password: Go away with that, poor boy! [fatb@baoz ~]$ ls -al sk sk2rc2/sk -rwxr-xr-x 1 fatb perlish 30799 Nov 11 18:04 sk -rwxr--r-- 1 fatb perlish 30279 Nov 17 06:06 sk2rc2/sk |
還有一個可以說明這個sk12是sk2,我查找了/etc下的文件,沒找到他啟動的地方,/sbin/init也沒改。到是在/etc/inittab里發現了ttymon的啟動方式:
[root@victim root]# grep ttyload /etc/inittab #0:2345 ![]() [root@victim root]# cat /usr/sbin/ttyload /sbin/ttyload -q >/dev/null 2>&1 /sbin/ttymon >/dev/null 2>&1 |
花開兩朵,各表一支,話說剛才我們確定了這個一定是sk2,在一段時間的掙扎之后,決定還是回頭在《linux后門掠影》里再仔細介紹他。
整理一下思路,我們已經找到了他們替換的elf程序了,現在替換回去就是了,具體步驟就不寫下來了,無非就是cp一下。
[root@victim root]# ls /usr/lib/libsh/.backup/ dir ifconfig lsof netstat pstree top find ls md5sum ps slocate |
如果有什么疑問,可以到http://cnhonker.com/bbs/ 的linux版交流
本文不斷更新中,欲獲得最新版本,請關注http://baoz.net或http://xsec.org的更新信息。
說在最后:
上面說到的方法只是一些最基本的方法,并且rkhunter,chkrootkit這樣的程序都是只能檢測默認安裝的rootkit,修改過的 rootkit或者沒公開的rootkit,它們是基本找不到的。怎么辦?自動化查找不行了,就只有靠我們手動分析了,這個就是體現安全管理員水平高低的時候了。
早睡早起身體好,睡覺去咯。
文章來源于領測軟件測試網 http://www.kjueaiud.com/
版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
技術支持和業務聯系:info@testage.com.cn 電話:010-51297073
老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月