Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Services
Managed Detection & Response

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

Co-Managed SOC (SIEM)

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

Advisory & Diagnostics

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

Penetration Testing

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

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

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

Digital Forensics & Incident Response

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

Firewall & Technology Management

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

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
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

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

ABOUT TRUSTWAVE

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.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo