Ruby on Rails路径穿越与任意文件读取漏洞复现(CVE

2020-04-08  本文已影响0人  低调求发展

漏洞概述:

    Ruby on Rails是一个 Web 应用程序框架,是一个相对较新的 Web 应用程序框架,构建在 Ruby 语言之上。它被宣传为现有企业框架的一个替代,而它的目标,就是让 Web 开发方面的生活,变得更轻松。

这个漏洞主要是由于网站使用了为指定参数的render file来渲染应用之外的视图,我们可以通过修改访问某控制器的请求包,通过“../../../../”来达到路径穿越的目的,然后再通过“{{”来进行模板查询路径的闭合,使得所要访问的文件被当做外部模板来解析。

Versions Affected: All.

Not affected:      None.

Fixed Versions:    6.0.0.beta3, 5.2.2.1, 5.1.6.2, 5.0.7.2, 4.2.11.1

Impact

There is a possible file content disclosure vulnerability in Action View.

Specially crafted accept headers in combination with calls to render file:

can cause arbitrary files on the target server to be rendered, disclosing the

file contents.

The impact is limited to calls to render which render file contents without

a specified accept format.  Impacted code in a controller looks something like this: classUserController< ApplicationControllerdefindex    render file: "#{Rails.root}/some/file" end end

影响版本:

Rails全版本

其中修复版本

6.0.0.beta3,

5.2.2.1

5.1.6.2

5.0.7.2

4.2.11.1

漏洞环境:

使用vulhub搭建,版本5.2.2

1

漏洞复现:

可以先看下robots正常响应

2

直接抓取robots包,然后修改Accept:为 ../../../../../../etc/passwd{{

3 4

直接可以读取passwd文件

漏洞修复:

1.升级没有漏洞版本。

2.补丁地址

上一篇下一篇

猜你喜欢

热点阅读