如何渗透测试WordPress网站

来源:互联网 发布:四轴飞行器pid算法 编辑:程序博客网 时间:2024/04/28 11:05

原文:http://www.freebuf.com/articles/web/5264.html

前言
英语水平有限,许多地方翻译的不是很通顺,请各位海涵。初见该文章便对文章作者很是佩服,因为在文章中详细的讲述了每一个步骤,这对于初学者来说尤为难得。所以决定将该文章翻译出来,供大家借鉴学习。

正文
原文题目:How Hackers Target and Hack Your Site
这个问题的答案是难以确定的(题目),因为黑客有多种方法去攻击一个网站。我们这篇文章的目的在于向你展示黑客常用的攻击技术和方法。

我们假设这是你的网站:hack-test.com

首先通过ping获得网站的IP地址:

现在我们得到了网站服务器的IP :173.236.138.113,这是我们的网站服务器托管IP。
接下来我们去sameip.org查找同一IP主机:

有26个结果,限于篇幅原因这里只取10个
ID    Domain

1    hijackthisforum.com2    sportforum.net3    freeonlinesudoku.net4    cosplayhell.com5    videogamenews.org6    gametour.com7    qualitypetsitting.net8    brendanichols.com9    8ez.com10    hack-test.com

我们需要更多信息,例如:
1.    DNS记录(A、NS、TXT、MS和SOA);
2.    Web服务器类型(Apache、IIS、Tomcat)
3.    注册信息(你的域名注册公司)
4.    名字、地址、电子邮件和电话
5.    网站所使用的脚步语言(php、asp、asp.net、jsp)
6.    服务器操作系统类型(Unix、Linux、Windows、Solaris等)
7.    服务器开放端口(80、443、21)

让我们开始获取信息,打开who.is网站

搜索后我们找到了hack-test.com的DNS记录信息:
Record    Type    TTL    Priority    Content
hack-test.com    A    4 hours        173.236.138.113
hack-test.com    SOA    4 hours        ns1.dreamhost.com. hostmaster.dreamhost.com. 2011032301 15283 1800 1814400 14400
hack-test.com    NS    4 hours        ns1.dreamhost.com
hack-test.com    NS    4 hours        ns3.dreamhost.com
hack-test.com    NS    4 hours        ns2.dreamhost.com
www.hack-test.com    A    4 hours        173.236.138.113

接下来是服务器类型信息:

我们可以看出服务器类型是Apache

HACK-TEST.COM SITE INFORMATIONIP: 173.236.138.113Website Status: activeServer Type: ApacheAlexa Trend/Rank: 1 Month: 3,213,968 3 Month: 2,161,753Page Views per Visit: 1 Month: 2.0 3 Month: 3.7

接下来是查找域名注册信息、注册人、地址、电子邮件、电话:

现在拥有了你的注册信息和其他虚拟信息,我们使用BackTrack5 R1的Whatweb程序获取你网站的操作系统类型、Web服务器版本等:

我们发现网站使用了一个著名的PHP程序WordPress,服务器类型为Fedora Linux,Web服务器版本为Apache 2.2.15。

接下来查找服务器开放的端口,我们将使用Nmap完成端口扫描:
1.    查找服务器运行的服务

root@bt:/# nmap -sV freebuf.comStarting Nmap 5.59BETA1 ( http://nmap.org ) at 2011-12-28 06:39 EET Nmap scan report for hack-test.com (192.168.1.2) Host is up (0.0013s latency). Not shown: 998 filtered ports PORT STATE SERVICE VERSION 22/tcp closed ssh 80/tcp open http Apache httpd 2.2.15 ((Fedora)) MAC Address: 00:0C:29:01:8A:4D (VMware) Service detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 11.56 seconds

2.    查找服务器操作系统

root@bt:/# nmap -O freebuf.com Starting Nmap 5.59BETA1 ( http://nmap.org ) at 2011-12-28 06:40 EET Nmap scan report for hack-test.com (192.168.1.2) Host is up (0.00079s latency). Not shown: 998 filtered ports PORT STATE SERVICE 22/tcp closed ssh 80/tcp open http MAC Address: 00:0C:29:01:8A:4D (VMware) Device type: general purpose Running: Linux 2.6.X OS details: Linux 2.6.22 (Fedora Core 6) Network Distance: 1 hop OS detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 7.42 seconds

在服务器上仅打开了80端口,服务器系统类型为Linux 2.6.22(Fedora Core6)

现在我们已经搜集了所有关于服务器的信息,接下来我们开始漏洞扫描:
SQL注入、盲注、本地\远程文件包含、跨站脚本攻击、跨站伪造请求等。

我们将使用Nikto.pl进行漏洞信息搜集:

root@bt:/pentest/web/nikto# perl nikto.pl -h http://hack-test.com - Nikto v2.1.4 --------------------------------------------------------------------------- + Target IP: 192.168.1.2 + Target Hostname: hack-test.com + Target Port: 80 + Start Time: 2011-12-29 06:50:03 --------------------------------------------------------------------------- + Server: Apache/2.2.15 (Fedora) + ETag header found on server, inode: 12748, size: 1475, mtime: 0x4996d177f5c3b + Apache/2.2.15 appears to be outdated (current is at least Apache/2.2.17). Apache 1.3.42 (final release) and 2.0.64 are also current. + Allowed HTTP Methods: GET, HEAD, POST, OPTIONS, TRACE + OSVDB-877: HTTP TRACE method is active, suggesting the host is vulnerable to XST + OSVDB-3268: /icons/: Directory indexing found. + OSVDB-3233: /icons/README: Apache default file found. + 6448 items checked: 1 error(s) and 6 item(s) reported on remote host + End Time: 2011-12-29 06:50:37 (34 seconds) --------------------------------------------------------------------------- + 1 host(s) tested

我们也会用W3AF:

root@bt:/pentest/web/w3af# ./w3af_guiStarting w3af, running on: Python version: 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] GTK version: 2.20.1 PyGTK version: 2.17.0 w3af - Web Application Attack and Audit Framework Version: 1.2 Revision: 4605 Author: Andres Riancho and the w3af team.

输入URL,选择【Full_audit】选项:

一段时间后,W3af完成了扫描:

网站存在着SQL注入、跨站脚本攻击和其他的风险。

让我们来看下SQL注入漏洞:

http://hack-test.com/Hackademic_RTB1/?cat=d%27z%220 ,这是漏洞地址和漏洞参数位置。

限于篇幅原因我直接提供翻译后的PDF文件,请大家下载 [下载后重命名为rar解压即可]。

结束
终于翻译完成,持续了大约1个礼拜,事情太多了,忙不过来,基本是利用业余时间完成的,许多翻译的不足之处还请大家多多包涵,个别地方的翻译加入了自己的理解,总体而言文档大家还是都能看的懂的。


祝FreeBuf蒸蒸日上!
By G.r0b1n