Vulnerabilities > CVE-2016-3088 - Unrestricted Upload of File with Dangerous Type vulnerability in Apache Activemq

047910
CVSS 9.8 - CRITICAL
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
HIGH
Integrity impact
HIGH
Availability impact
HIGH
network
low complexity
apache
CWE-434
critical
nessus
exploit available
metasploit

Summary

The Fileserver web application in Apache ActiveMQ 5.x before 5.14.0 allows remote attackers to upload and execute arbitrary files via an HTTP PUT followed by an HTTP MOVE request.

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Accessing Functionality Not Properly Constrained by ACLs
    In applications, particularly web applications, access to functionality is mitigated by the authorization framework, whose job it is to map ACLs to elements of the application's functionality; particularly URL's for web apps. In the case that the administrator failed to specify an ACL for a particular element, an attacker may be able to access it with impunity. An attacker with the ability to access functionality not properly constrained by ACLs can obtain sensitive information and possibly compromise the entire application. Such an attacker can access resources that must be available only to users at a higher privilege level, can access management sections of the application or can run queries for data that he is otherwise not supposed to.
  • Privilege Abuse
    An adversary is able to exploit features of the target that should be reserved for privileged users or administrators but are exposed to use by lower or non-privileged accounts. Access to sensitive information and functionality must be controlled to ensure that only authorized users are able to access these resources. If access control mechanisms are absent or misconfigured, a user may be able to access resources that are intended only for higher level users. An adversary may be able to exploit this to utilize a less trusted account to gain information and perform activities reserved for more trusted accounts. This attack differs from privilege escalation and other privilege stealing attacks in that the adversary never actually escalates their privileges but instead is able to use a lesser degree of privilege to access resources that should be (but are not) reserved for higher privilege accounts. Likewise, the adversary does not exploit trust or subvert systems - all control functionality is working as configured but the configuration does not adequately protect sensitive resources at an appropriate level.

Exploit-Db

  • descriptionApache ActiveMQ 5.11.1/5.13.2 - Directory Traversal / Command Execution. CVE-2015-1830,CVE-2016-3088. Remote exploit for Windows platform
    idEDB-ID:40857
    last seen2016-12-02
    modified2015-08-17
    published2015-08-17
    reporterExploit-DB
    sourcehttps://www.exploit-db.com/download/40857/
    titleApache ActiveMQ 5.11.1/5.13.2 - Directory Traversal / Command Execution
  • descriptionActiveMQ < 5.14.0 - Web Shell Upload (Metasploit). CVE-2016-3088. Remote exploit for Java platform
    fileexploits/java/remote/42283.rb
    idEDB-ID:42283
    last seen2017-06-30
    modified2017-06-29
    platformjava
    port
    published2017-06-29
    reporterExploit-DB
    sourcehttps://www.exploit-db.com/download/42283/
    titleActiveMQ < 5.14.0 - Web Shell Upload (Metasploit)
    typeremote

Metasploit

descriptionThe Fileserver web application in Apache ActiveMQ 5.x before 5.14.0 allows remote attackers to upload and execute arbitrary files via an HTTP PUT followed by an HTTP MOVE request.
idMSF:EXPLOIT/MULTI/HTTP/APACHE_ACTIVEMQ_UPLOAD_JSP
last seen2020-05-22
modified2017-07-24
published2017-06-06
references
reporterRapid7
sourcehttps://github.com/rapid7/metasploit-framework/blob/master//modules/exploits/multi/http/apache_activemq_upload_jsp.rb
titleActiveMQ web shell upload

Nessus

NASL familyCGI abuses
NASL idACTIVEMQ_5_14_0.NASL
descriptionThe version of Apache ActiveMQ running on the remote host is 5.x prior to 5.14.0. It is, therefore, affected by a remote code execution vulnerability. The Fileserver web application allows remote attackers to upload and execute arbitrary files.
last seen2020-06-01
modified2020-06-02
plugin id117601
published2018-09-19
reporterThis script is Copyright (C) 2018-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/117601
titleApache ActiveMQ 5.x < 5.14.0 ActiveMQ Fileserver web application remote code execution (Xbash)
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(117601);
  script_version("1.3");
  script_cvs_date("Date: 2019/04/05 23:25:05");

  script_cve_id("CVE-2016-3088");
  script_bugtraq_id(90827);

  script_name(english:"Apache ActiveMQ 5.x < 5.14.0 ActiveMQ Fileserver web application remote code execution (Xbash)");
  script_summary(english:"Checks the version of ActiveMQ.");

  script_set_attribute(attribute:"synopsis", value:
"The remote host is running a web application that is affected by a
remote code execution vulnerability.");
  script_set_attribute(attribute:"description", value:
"The version of Apache ActiveMQ running on the remote host is 5.x prior
to 5.14.0. It is, therefore, affected by a remote code execution 
vulnerability. The Fileserver web application allows remote attackers
to upload and execute arbitrary files.");
  # http://activemq.apache.org/security-advisories.data/CVE-2016-3088-announcement.txt
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?2581a08b");
  script_set_attribute(attribute:"solution", value:
"Upgrade to Apache ActiveMQ version 5.14.0 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2016-3088");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'ActiveMQ web shell upload');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2016/06/01");
  script_set_attribute(attribute:"patch_publication_date", value:"2016/08/08");
  script_set_attribute(attribute:"plugin_publication_date", value:"2018/09/19");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:apache:activemq");
  script_set_attribute(attribute:"potential_vulnerability", value:"true");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"CGI abuses");

  script_copyright(english:"This script is Copyright (C) 2018-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("activemq_web_console_detect.nasl");
  script_require_keys("installed_sw/ActiveMQ", "Settings/ParanoidReport");
  script_require_ports("Services/www", 8161);

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("http.inc");
include("install_func.inc");
include("vcf.inc");

if (report_paranoia < 2) audit(AUDIT_PARANOID);

app_name = 'ActiveMQ';
port = get_http_port(default:8161);
app = vcf::get_app_info(app:app_name, port:port, webapp:TRUE);

constraints = [{"min_version" : "5.0", "fixed_version" : "5.14.0"}];

vcf::check_version_and_report(app_info:app, constraints:constraints, severity:SECURITY_HOLE, strict:FALSE);

Packetstorm

Redhat

advisories
rhsa
idRHSA-2016:2036

Seebug

bulletinFamilyexploit
descriptionAuthor: The **know Chong Yu 404 laboratory** #### 1\. Background overview ActiveMQ is an Apache Software Foundation under an open source message-driven middleware software. Jetty is an open source servlet container, it is based on Java web container such as JSP and servlet to provide the running environment. ActiveMQ 5.0 and later versions the default integrated jetty. After the start to provide a monitoring ActiveMQ Web application. 2016 4 November 14, the overseas security researchers Simon Zuckerbraun exposure Apache ActiveMQ Fileserver there are multiple security vulnerabilities allowing a remote attacker to use malicious code to replace the Web application on an affected system to remote code execution(CVE-2016-3088)。 #### 2\. Principles of analysis ActiveMQ in the FileServer service allows the user through the HTTP PUT method to upload a file to a specified directory,download [ActiveMQ 5.7.0 source code](<http://archive.apache.org/dist/activemq/apache-activemq/5.7.0/activemq-parent-5.7.0-source-release.zip>) , you can see the background processing PUT the key code is as follows ![](https://images.seebug.org/content/images/2017/07/--1-2.png) The user can upload a file to a specified directory, the path in the `conf/jetty.xml ` in the definition, as follows ![](https://images.seebug.org/content/images/2017/07/--2-2.png) Interestingly, we forged a special upload path, you can burst an absolute path ![](https://images.seebug.org/content/images/2017/07/--3-2.png) Along the PUT method to track, you can see the call to the following function ![](https://images.seebug.org/content/images/2017/07/--4-2.png) At the same time see the background processing to MOVE the key code is as follows, You can see the method is not for the purpose of path any restrictions or filtering. ![](https://images.seebug.org/content/images/2017/07/--5-2.png) Thus, we can construct a PUT request to upload a webshell to the fileserver directory, and then by the Move method to move it to have execute permissions for the admin/ directory. #### 3\. Exploit a variety of poses According to the above vulnerability principle, we can think of a variety of the use of poses. Note: the following results are in the ActiveMQ 5.7.0 in the reproduction, the reproduction process of the MOVE method use is very unstable. * Upload Webshell way First PUT a Jsp Webshell to the fileserver directory ![](https://images.seebug.org/content/images/2017/07/--6-2.png) In the fileserver/ directory Webshell and no execute permissions ![](https://images.seebug.org/content/images/2017/07/--7-2.png) Proof about the absolute path ![](https://images.seebug.org/content/images/2017/07/--8-2.png) Then use the MOVE method to the Webshell moved into the admin/ directory, you can also use relative paths ![](https://images.seebug.org/content/images/2017/07/--9-2.png) Visit http://localhost:8161/admin/1. jsp? cmd=ls, the command successfully executes, the results are as follows ![](https://images.seebug.org/content/images/2017/07/--10-2.png) * Upload the SSH public key mode Since can be arbitrary file upload and moving, very natural can think to upload our ssh public key, enabling SSH login. First generate the key pair. If it's already there then not required ![](https://images.seebug.org/content/images/2017/07/--11-2.png) Then upload, move to the`/root/. ssh/`and rename to `authorized_keys` ![](https://images.seebug.org/content/images/2017/07/--12-2.png) ![](https://images.seebug.org/content/images/2017/07/--13-2.png) Directly after the ssh login. ![](https://images.seebug.org/content/images/2017/07/--14-2.png) #### 4\. Vulnerability The vulnerability affects versions: Apache ActiveMQ 5. x ~ 5.14.0 In [ZoomEye ](<https://www.zoomeye.org>) with date and ActiveMQ as a key to retrieve, respectively, the detection of the 2015 1 month 1 day vulnerability before the outbreak of the one year and 2017 year 1 month 1 day vulnerability after the outbreak of the one year Internet on ActiveMQ the total amount of the case, as follows. ![](https://images.seebug.org/content/images/2017/07/--15-2.png) ![](https://images.seebug.org/content/images/2017/07/--16-1.png) You can see that ActiveMQ in the number of vulnerabilities the outbreak of the front and rear there is a very substantial reduction, from which we can generally guess the vulnerabilities after the outbreak of the many ActiveMQ Web service is restricted from public access. #### 5\. Vulnerability protection programme 1, The ActiveMQ Fileserver function in 5.14.0 and later versions has been removed. Users are recommended to upgrade to 5.14.0 and later versions. 2, by removing `conf\jetty.xml ` the following configuration to disable the ActiveMQ Fileserver function ![](https://images.seebug.org/content/images/2017/07/--17-1.png) #### 6\. Reference links [1] http://activemq.apache.org/security-advisories.data/CVE-2016-3088-announcement.txt [2] https://www.seebug.org/vuldb/ssvid-96268
idSSV:96268
last seen2017-11-19
modified2017-07-04
published2017-07-04
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-96268
titleApache ActiveMQ Fileserver remote code execution vulnerability(CVE-2016-3088)

The Hacker News