Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Apache ActiveMQ Vulnerability Leads to Stealthy Godzilla Webshell

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.

 

ActiveMQ Vulnerability

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.

 

Dropped Payload

Recently, our Global Threat Operations team identified a suspicious JSP file within a client’s server hosting a vulnerable instance of Apache ActiveMQ.

Apache_Pic1

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.

 

Apache_Pic2

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.

 

Apache_Pic3

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.

 

Apache_Pic4

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.

 

Godzilla Webshell

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.

Apache_Pic5

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:

  • Viewing network details
  • Conducting port scans
  • Executing Mimikatz commands
  • Running Meterpreter commands
  • Executing shell commands
  • Remotely managing SQL databases
  • Injecting shellcode into processes
  • Handling file management tasks

 

Affected Apache ActiveMQ Versions

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:

  • 5e6993bba5e8e72a4899d6ddfb167972
  • f257b2669b15ca2792625d0bce00d907
  • 5b4871092491a51477a13af5030c76b7

 

SHA256:

  • 233adf5d3c754ead3f304a4891d367884dd615d74d9983119546bebb346b7bf7
  • 5da5796d407a0099aa624b1ea73a877a5197b3b31529d94f2467dce19fe3a74a
  • f97c6c820694a059c7b0b2f3abe1f614b925dd4ab233d11472b062325ffb67be

 

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

}

Latest SpiderLabs Blogs

Welcome to Adventures in Cybersecurity: The Defender Series

I’m happy to say I’m done chasing Microsoft certifications (AZ104/AZ500/SC100), and as a result, I’ve had the time to put some effort into a blog series that hopefully will entertain and inform you...

Read More

Trustwave SpiderLabs: Insights and Solutions to Defend Educational Institutions Against Cyber Threats

Security teams responsible for defending educational institutions at higher education and primary school levels often find themselves facing harsh lessons from threat actors who exploit the numerous...

Read More

Breakdown of Tycoon Phishing-as-a-Service System

Just weeks after Trustwave SpiderLabs reported on the Greatness phishing-as-a-service (PaaS) framework, SpiderLabs’ Email Security team is tracking another PaaS called Tycoon Group.

Read More