Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Trustwave has observed a surge in attacks exploiting vulnerabilities in Apache ActiveMQ hosts. In certain cases, these host malicious Java Server Pages (JSP) web shells.
The web shells are concealed within an unknown binary format and are designed to evade security and signature-based scanners. Notably, despite the binary's unknown file format, ActiveMQ's JSP engine continues to compile and execute the web shell.
Over the past few weeks, there has been a notable increase in malicious activity targeting a recent critical vulnerability in the Apache ActiveMQ software. This vulnerability is specifically linked to unsafe deserialization practices within the OpenWire protocol and has been designated as CVE-2023-46604. Exploiting this vulnerability enables threat actors to potentially gain unauthorized access to a target system by executing arbitrary shell commands. Since a PoC of the exploit was made publicly available in October 2023, threat actors have been using it to deploy crypto-miners, rootkits, ransomware, and remote access trojans.
Recently, our Global Threat Operations team identified a suspicious JSP file within a client’s server hosting a vulnerable instance of Apache ActiveMQ.
Figure 1 The suspicious file found by Trustwave Global Threat Operations team. Examining the .JSP file reveals that the malicious code is encapsulated within a binary structure of an unidentified file format, marked by the "FLR" magic header.
The malicious file was planted in the “admin” folder within the ActiveMQ installation directory. This folder contains the server scripts for the ActiveMQ administrative and web management console.
Figure 2 The malicious file was planted in the same directory of the Apache ActiveMQ admin page.
Upon further analysis, Trustwave SpiderLabs determined that this JSP code came from an open-source web shell known as the Godzilla Webshell. What makes these malicious files particularly noteworthy is how the JSP code appears to be concealed within an unknown type of binary. This method has the potential to circumvent security measures, evading detection by security endpoints during scanning.
Interestingly, the Jetty JSP engine which is the integrated web server in Apache ActiveMQ, actually parsed, compiled and executed the embedded Java code that was encapsulated in the unknown binary. Further examination of the Java code generated by Jetty showed that the web shell code was converted into Java code and therefore was executed.
Figure 3. Illustrates the Java code produced by the JSP engine, which is generated upon accessing the JSP file.
The unidentified data in the binary is then sent to the client's browser using “out.write()”, resulting in the display of unintelligible characters when accessing the web shell from a browser.
Figure 4. The unidentifiable data in the binary appears as an unintelligible string when accessing the JSP file in the browser. However, the web shell code is now absent, having been transformed into Java code and executed on the server side.
After a successful exploitation and deployment of the JSP payload, the threat actor can connect to the web shell through the Godzilla management user interface, gaining complete control over the target system.
Figure 5 Godzilla's management user interface available to the threat actor
Once deployed in the target websever, the Godzilla Web Shell features a wide range of functionalities including but not limited to:
The following Apache ActiveMQ versions are affected. Users are recommended to upgrade both brokers and clients to version 5.15.16, 5.16.7, 5.17.6, or 5.18.3 which fixes this the vulnerability.
- Apache ActiveMQ 5.18.0 before 5.18.3
- Apache ActiveMQ 5.17.0 before 5.17.6
- Apache ActiveMQ 5.16.0 before 5.16.7
- Apache ActiveMQ before 5.15.16
- Apache ActiveMQ Legacy OpenWire Module 5.18.0 before 5.18.3
- Apache ActiveMQ Legacy OpenWire Module 5.17.0 before 5.17.6
- Apache ActiveMQ Legacy OpenWire Module 5.16.0 before 5.16.7
- Apache ActiveMQ Legacy OpenWire Module 5.8.0 before 5.15.16
IoC:
MD5:
SHA256:
Godzilla’s Default Protocol Header:
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
YARA rule to detect Godzilla Webshell:
rule Godzilla_webshell {
meta:
description = "Detects Godzilla Webshell JSP Code"
strings:
$s1 = "String xc=" ascii wide
$s2 = "String pass=" ascii wide
$s3 = "String md5=md5(pass+xc)" ascii wide
$s4 = "payload" ascii wide
$s5 = "X(ClassLoader z)" ascii wide
condition:
all of them
}
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.