Remote code execution in Apache Tomcat



Published: 2019-04-11 | Updated: 2019-05-30
Risk High
Patch available YES
Number of vulnerabilities 2
CVE-ID CVE-2019-0232
CVE-2019-0221
CWE-ID CWE-78
CWE-79
Exploitation vector Network
Public exploit Public exploit code for vulnerability #1 is available.
Public exploit code for vulnerability #2 is available.
Vulnerable software
Subscribe
Apache Tomcat
Server applications / Web servers

Vendor Apache Foundation

Security Bulletin

This security bulletin contains information about 2 vulnerabilities.

UPDATED: 22.04.2019
Added fixed version to the advisory. Advisory status changed to Patched.
UPDATED: 30.05.2019
Added vulnerability #2.

1) OS Command Injection

EUVDB-ID: #VU18236

Risk: High

CVSSv3.1: 7 [CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C]

CVE-ID: CVE-2019-0232

CWE-ID: CWE-78 - Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

Exploit availability: Yes

Description

The vulnerability allows a remote attacker to execute arbitrary commands on the target system.

The vulnerability exists due to an input validation error within the CGI Servlet when passing arguments from JRE to the Windows environment. A remote attacker can send a specially crafted request to the CGI Servlet, inject and execute arbitrary OS commands on the system with Apache Tomcat privileges.

Successful exploitation of the vulnerability requires that Apache Tomcat is installed on Windows operating system with enabled option “enableCmdLineArguments” (CGI Servlet and “enableCmdLineArguments” option are disabled by default).

Mitigation

Install update from vendor's website.

Vulnerable software versions

Apache Tomcat: 7.0.0 - 9.0.16

External links

http://tomcat.apache.org/security-9.html#Fixed_in_Apache_Tomcat_9.0.19
http://tomcat.apache.org/security-8.html#Fixed_in_Apache_Tomcat_8.5.40
http://tomcat.apache.org/security-7.html#Fixed_in_Apache_Tomcat_7.0.94


Q & A

Can this vulnerability be exploited remotely?

Yes. This vulnerability can be exploited by a remote non-authenticated attacker via the local network (LAN).

How the attacker can exploit this vulnerability?

The attacker would have to send a specially crafted request to the affected application in order to exploit this vulnerability.

Is there known malware, which exploits this vulnerability?

No. We are not aware of malware exploiting this vulnerability. However, a fully functional exploit for this vulnerability is available.

2) Cross-site scripting

EUVDB-ID: #VU18638

Risk: Low

CVSSv3.1: 5.5 [CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N/E:P/RL:O/RC:C]

CVE-ID: CVE-2019-0221

CWE-ID: CWE-79 - Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Exploit availability: Yes

Description

The disclosed vulnerability allows a remote attacker to perform cross-site scripting (XSS) attacks.

The vulnerability exists due to insufficient sanitization of user-supplied data within SSI printenv command, when parsing URI. A remote attacker can trick the victim to follow a specially crafted link and execute arbitrary HTML and script code in user's browser in context of vulnerable website.

Successful exploitation of this vulnerability may allow a remote attacker to steal potentially sensitive information, change appearance of the web page, perform phishing and drive-by-download attacks.

Example:

http://[host]/printenv.shtml?%3Cscript%3Ealert(%27xss%27)%3C/script%3E

Mitigation

Install updates from vendor's website.

Vulnerable software versions

Apache Tomcat: 7.0.0 - 9.0.16

External links

http://seclists.org/fulldisclosure/2019/May/50
http://lists.apache.org/thread.html/6e6e9eacf7b28fd63d249711e9d3ccd4e0a83f556e324aee37be5a8c@%3Cannounce.tomcat.apache.org%3E
http://tomcat.apache.org/security-9.html#Fixed_in_Apache_Tomcat_9.0.19
http://tomcat.apache.org/security-8.html#Fixed_in_Apache_Tomcat_8.5.40
http://tomcat.apache.org/security-7.html#Fixed_in_Apache_Tomcat_7.0.94


Q & A

Can this vulnerability be exploited remotely?

Yes. This vulnerability can be exploited by a remote non-authenticated attacker via the Internet.

How the attacker can exploit this vulnerability?

The attacker would have to send a specially crafted request to the affected application in order to exploit this vulnerability.

Is there known malware, which exploits this vulnerability?

No. We are not aware of malware exploiting this vulnerability. However, proof of concept for this vulnerability is available.



###SIDEBAR###