Vulnerabilities > CVE-2016-3088 - Improper Input Validation 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-20
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 Weakness Enumeration (CWE)

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Buffer Overflow via Environment Variables
    This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.
  • Server Side Include (SSI) Injection
    An attacker can use Server Side Include (SSI) Injection to send code to a web application that then gets executed by the web server. Doing so enables the attacker to achieve similar results to Cross Site Scripting, viz., arbitrary code execution and information disclosure, albeit on a more limited scale, since the SSI directives are nowhere near as powerful as a full-fledged scripting language. Nonetheless, the attacker can conveniently gain access to sensitive files, such as password files, and execute shell commands.
  • Cross Zone Scripting
    An attacker is able to cause a victim to load content into their web-browser that bypasses security zone controls and gain access to increased privileges to execute scripting code or other web objects such as unsigned ActiveX controls or applets. This is a privilege elevation attack targeted at zone-based web-browser security. In a zone-based model, pages belong to one of a set of zones corresponding to the level of privilege assigned to that page. Pages in an untrusted zone would have a lesser level of access to the system and/or be restricted in the types of executable content it was allowed to invoke. In a cross-zone scripting attack, a page that should be assigned to a less privileged zone is granted the privileges of a more trusted zone. This can be accomplished by exploiting bugs in the browser, exploiting incorrect configuration in the zone controls, through a cross-site scripting attack that causes the attackers' content to be treated as coming from a more trusted page, or by leveraging some piece of system functionality that is accessible from both the trusted and less trusted zone. This attack differs from "Restful Privilege Escalation" in that the latter correlates to the inadequate securing of RESTful access methods (such as HTTP DELETE) on the server, while cross-zone scripting attacks the concept of security zones as implemented by a browser.
  • Cross Site Scripting through Log Files
    An attacker may leverage a system weakness where logs are susceptible to log injection to insert scripts into the system's logs. If these logs are later viewed by an administrator through a thin administrative interface and the log data is not properly HTML encoded before being written to the page, the attackers' scripts stored in the log will be executed in the administrative interface with potentially serious consequences. This attack pattern is really a combination of two other attack patterns: log injection and stored cross site scripting.
  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.

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