Skip to main content

Ghostcat breach affects all Tomcat versions

Written by
ghostcat feature

February 25, 2020

0 mins read

Apache Tomcat is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language, and Java WebSocket technologies. Tomcat is one of the most popular Java HTTP web server environments and was released in 1998.

Ghostcat is a high severity vulnerability in Tomcat discovered by the security researchers of Chaitin Tech on January 3rd. On February 20, the China National Vulnerability Database (CNVD) published a security advisory for this issue with the number CNVD-2020-10487.

The vulnerability was found in the Apache JServ Protocol (AJP). The issue is that this binary protocol allows an attacker to read or include any file into Tomcat webapp directories.

AJP Connector

The AJP Connector takes care of communication between Tomcat and the outside world. By default, The AJP Connector is enabled in Apache Tomcat on port 8009 for version 6 to 9. As CVE-2020-1938 is a file read/inclusion vulnerability in the AJP Connector within Tomcat, all versions that do not contain the patch have this vulnerability. 

The vulnerability allows an attacker to read the contents of the web application files. If the web application allows file upload, the attacker is also able to upload any files to the server including malicious Java Server Pages (JSP) that enable remote code execution on the server.

GhostCat logo with orange and green cat-eye symbols above bold white and orange lettering

Solution

Apache Tomcat already released patched versions for Tomcat 7, 8, and 9:

The Chaitin researchers are suggesting that if you use the patch, you also add a proper secret to you connector configuration in the /conf/server.xml file.

<Connector port="8009" protocol="AJP/1.3" 
redirectPort="8443" 
address="YOUR_TOMCAT_IP_ADDRESS" 
secret="YOUR_TOMCAT_AJP_SECRET" />

When patching is not an option, there are some other ways to mitigate this issue, according to the Chaitin researchers.

If you are not using the AJP Connector you can safely comment out or delete the declaration of the AJP Connector in the /conf/server.xml file.

<!--<Connector port="8009" protocol="AJP/1.3" 
redirectPort="8443" />-->

If you do use the AJP Connector and updating to the patched version is not an option, add a requiredSecret field with a safe, not easy to guess secret.

<Connector port="8009" protocol="AJP/1.3" 
redirectPort="8443" 
address="YOUR_TOMCAT_IP_ADDRESS" requiredSecret="YOUR_TOMCAT_AJP_SECRET" />

Spring Boot

The latest version of the JVM Ecosystem report shows that Spring Boot is the most widely used server-side framework within the ecosystem. Spring Boot uses an embedded web server and, by default, the embedded version of Tomcat is used. It is possible that the spring-boot-starter-web introduced a vulnerable version of the embedded apache tomcat package into your system.

Edited Mar 2, 2020

It is good to know that by default, Spring Boot does not create an AJP connector out the box. This means that with the default settings an attacker cannot exploit this vulnerability. However, Spring Boot can be configured differently. Depending on your configuration you should check if you’re vulnerable and take appropriate measures.

Get started in capture the flag

Learn how to solve capture the flag challenges by watching our virtual 101 workshop on demand.

Read more

illustration hero ai
Blog

PHP Patches Two Critical Unauthenticated RCEs (CVE-2026-109618, CVE-2026-109619): Update Now

Two critical flaws in PHP’s request lifecycle can enable unauthenticated remote code execution. Upgrade to a fixed release or install a vendor backport for older versions.

blog feature ai lilac
Blog

Turn Your Vulnerability Backlog Into Pull Requests With Agentic Remediation

The Evo Remediation Agent is now in Open Preview, bringing automated dependency resolution to Evo Agentic AppSec. AppSec teams can now run ongoing remediation

AI Background min crop
Blog

AI Is Calling In Every Risk You've Accepted: Seven Insights From The AI Security Panel: Unfiltered

AI is making attacks cheaper and faster, exposing risks organizations already carry. Four security leaders share why machine-speed defense and faster remediation are now essential.