CVE-2020-1938

9.8 CRITICAL

📋 TL;DR

CVE-2020-1938 (GhostCat) is a critical vulnerability in Apache Tomcat's AJP connector that allows attackers to read arbitrary files from the server and potentially execute remote code. It affects Tomcat versions 7.0.0-7.0.99, 8.5.0-8.5.50, and 9.0.0.M1-9.0.0.30 when the AJP connector is exposed to untrusted networks. The vulnerability is particularly dangerous because the AJP connector is enabled by default in affected versions.

💻 Affected Systems

Products:
  • Apache Tomcat
Versions: 7.0.0 to 7.0.99, 8.5.0 to 8.5.50, 9.0.0.M1 to 9.0.0.30
Operating Systems: All operating systems running affected Tomcat versions
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable if AJP connector is enabled and accessible to attackers. Default configuration includes enabled AJP connector listening on all interfaces.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, and lateral movement within the network.

🟠

Likely Case

Arbitrary file read allowing access to sensitive configuration files, credentials, and application source code.

🟢

If Mitigated

No impact if AJP connector is not exposed to untrusted networks or properly secured.

🌐 Internet-Facing: HIGH - If AJP port (default 8009) is exposed to the internet, attackers can easily exploit this vulnerability.
🏢 Internal Only: MEDIUM - Internal attackers or compromised internal systems could exploit this if AJP is accessible on internal networks.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Multiple public exploit tools available. Exploitation requires network access to AJP port (default 8009).

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Apache Tomcat 9.0.31, 8.5.51, or 7.0.100 and later

Vendor Advisory: https://lists.apache.org/thread.html/r1125f3044a0946d1e7e6f125a6170b58d413ebd4a95157e4608041c7%40%3Cannounce.apache.org%3E

Restart Required: Yes

Instructions:

1. Download patched version from Apache Tomcat website. 2. Backup current configuration and applications. 3. Stop Tomcat service. 4. Replace Tomcat installation with patched version. 5. Restore configuration and applications. 6. Start Tomcat service. 7. Verify version and test functionality.

🔧 Temporary Workarounds

Disable AJP Connector

all

Remove or comment out AJP connector configuration in server.xml

Edit $CATALINA_HOME/conf/server.xml and comment out or remove the <Connector protocol="AJP/1.3" ... /> line

Restrict AJP Access

linux

Configure firewall to block external access to AJP port (default 8009)

iptables -A INPUT -p tcp --dport 8009 -j DROP
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="0.0.0.0/0" port port="8009" protocol="tcp" reject'
netsh advfirewall firewall add rule name="Block Tomcat AJP" dir=in action=block protocol=TCP localport=8009

🧯 If You Can't Patch

  • Disable AJP connector completely if not needed for your deployment
  • Implement strict network segmentation and firewall rules to restrict AJP port access only to trusted hosts

🔍 How to Verify

Check if Vulnerable:

Check Tomcat version and verify AJP connector is enabled in server.xml configuration

Check Version:

java -cp $CATALINA_HOME/lib/catalina.jar org.apache.catalina.util.ServerInfo

Verify Fix Applied:

Verify Tomcat version is 9.0.31+, 8.5.51+, or 7.0.100+ and test that AJP functionality still works if required

📡 Detection & Monitoring

Log Indicators:

  • Unusual AJP connection attempts
  • File read attempts via AJP protocol
  • JSP compilation errors for unexpected files

Network Indicators:

  • Traffic to port 8009 from untrusted sources
  • AJP protocol anomalies
  • File retrieval patterns in AJP traffic

SIEM Query:

source="tomcat.logs" AND ("AJP" OR "8009") AND ("error" OR "exception" OR "malformed")

🔗 References

📤 Share & Export