Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. 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
Offensive Security
Solutions to maximize your security ROI
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

Digging Into the New Apache Injection Module

I recently got a chance to dig into a couple variants of the new Apache injection module that Sucuri recently discovered (check out their nice write-up here). Unfortunately this thing still doesn't have a cool whiz-bang name like most of the other malware out there. This is likely due to the fact that very few (if any) Anti-virus companies have provided detections for the malware at this time. While it's still very early in my progress reversing the samples thus far, I wanted to share what information I had in the meantime in order to help other analysts, or perhaps any individuals looking for ways of identifying the malware.

During this post I'll dig into the encryption discovered within the Apache modules, and provide some YARA signatures I've created for detection purposes (Sucuri provided on method of detection, however, I simply wanted to complement it with another technique).

While I was analyzing the Apache modules, it quickly became apparent that some form of encryption was being utilized in order to decrypt the 'juicy' bits of this malware. Specifically, I found the following function was called when the module was initialized:

8303_21bff81a-e9af-41c7-a679-e42c8550e95b

After a bit of confusion, I determined that XTEA—or some form of it, was being used by the authors. XTEA is a newer variant of the Tiny Encryption Algorithm (TEA), and it's a perfect candidate for malware authors who are looking to hide some data without some of the overhead other encryption algorithms provide.

Going through the assembly, I was able to reproduce the function in (my personal favorite language) Ruby. I should note that I somewhat cheated by simply modifying some other code I discovered on a GitHub Gist. You can see my results, along with a few notes on why their implementation was non-standard, below:

11575_bfc89e74-2abf-402d-b775-9e34e3a198a1

Using this algorithm, I can take the encrypted blob of data within the Apache module, and decrypt it using the supplied key. I've included an example of this below (not all data displayed due to length):

10523_8dbd072b-6998-4397-8dff-5087419163b4

I haven't discovered how all of this data is used at this time, however, some things should be easily identifiable, such as the injected iframe string. Additionally, you can see some blacklisted User-Agent strings (google, bing, yandex). I've also identified the 'admin' string to be a blacklisted URL (paths with this string look to be ignored).

What's great about this encryption implementation is the fact that it's used throughout all of the Apache modules I looked at. Because it's non-standard, it provides a perfect unique characteristic that can be used for detection. That being said, I've created a YARA signature that will hit on either the encryption implementation, or the individual keys that were found in the samples. You can grab the signature from our Github:

https://github.com/SpiderLabs/Malware_Analysis/blob/master/Yara/Apache_Injection_Module/apacheInjection.yara

Latest SpiderLabs Blogs

Fare Thee Well ModSecurity: End-of-Life and Last Commercial Rules Update for June 2024

A Fourteen-Year Journey Comes to an End In June 2010, Trustwave acquired Breach Security, which brought with it the popular Open-Source Web Application Firewall ModSecurity for Apache. At that time,...

Read More

Secure Access Service Edge: Another Multi-Tool for the SOC

Over the years, several security defense architectures have merged into a single solution. Endpoint detection tools can perform sophisticated detections and correlations that used to require a...

Read More

Search & Spoof: Abuse of Windows Search to Redirect to Malware

Trustwave SpiderLabs has detected a sophisticated malware campaign that leverages the Windows search functionality embedded in HTML code to deploy malware. We found the threat actors utilizing a...

Read More