CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. 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

A Wild Exploit Kit Appears... Meet RedKit

During our research we have recently encountered a new private exploit kit. The developers behind this private kit decided to promote it with a standard banner. After clicking on this banner, you get to a page with a form asking for your jabber username. This way after you leave your details, they contact you and not the other way around. The page with this form was hosted on a compromised site of some unsuspecting Christian church. What today's economics drive people to do...

After signing up with your jabber account the authors behind this new project contact you and provide you with a demo account for their software. The author doesn't provide any "official" name for this kit so we'll refer to it as the RedKit, simply because they used a red coloring scheme. Logging to the admin panel presents you with options which are typically used by other exploit kits.

098b5ff2-655e-4e5e-96fa-c1cf21bbf5f3

The panel allows you to check the statistics for incoming traffic, upload a payload executable and even scan this payload with no less than 37(!) different AV's.

dd7da899-f803-40ef-88c9-3d796ab2be12

 

Any aspiring cybercriminal who's looking to distribute some malware, will usually face a quest of acquiring three different resources for a successful botnet:

  1. Exploit kit services
  2. Traffic of unsuspecting victims
  3. A payload exe - the file which will launch on the victim side upon successful exploitation.

Our promising cybercriminal will set up the traffic sources to redirect users to a malicious exploit kit page. Within a few hours, the number of infected clients will climb up on the admin panel for that attack and our ill-intended friend will fantasize about sipping ice cold beer on some sunny island with the expenses covered by his brilliant scheme. It will be a real blow for him when the these numbers stop climbing after 24-48 hours as the malicious URL is now recognized and blocked by most security vendors. The poor lad will have to go through the irritating process of contacting the exploit kit provider for using an updated malicious URL. Getting online with a helpdesk clerk is never a pleasant experience, surely not in this underground world.

Luckily, the authors of RedKit have solved this issue by providing an API which will produce a fresh URL every hour. How convenient! Any customer of this exploit kit can now set up an automated process for updating the traffic sources every hour or so to point to the new URL.
This basically means that people behind this project have invested considerable amount of resources and reserved a big batch of domains to use over a period of time. Just like in any other business, one has to put some money in order to generate more money and the profit is proportional to the initial investment.

b8efb5f5-88a6-4140-8fe0-f5ecd06a6dcf

 

The link circled in blue is the currently used malicious URL. The green one is a constant API URL which produces a fresh URL one every hour or so.

A Terms Of Service page is also supplied. The rules for business seem to be the same everywhere, even when the judge is not a person with 7 years of college and 20 more of law practicing, but just a guy that runs the forum where the business took place. Here is a translation of some key points:

cc64a00c-5ce8-4896-b4ac-47589dfb3459

 

The next step was to analyze and take apart the exploits it serves. The RedKit is armed with two of the most popular exploits but the authors probably will add more exploits soon in order to catch up with the "industry leaders" such as BlackHole and Phoenix exploit kits. The first exploit is a fairly obfuscated PDF file that exploits the LibTIFF vulnerability (CVE-2010-0188). An analysis of the PDF file, by the excellent wepawet service, can be found here.

This time we'll focus on the second exploit. We're talking about the latest Java exploit, dealing with the AtomicReferenceArray vulnerability (CVE-2012-0507). It is interesting to examine this Java attack, but not due to the vulnerability it exploits but due to the obfuscation used on the bytecode.

0d3ef7cf-87a8-40b5-b50f-c02a63b05bad

Until not long ago, Java exploits were much less common. The analysis of such samples was easy as well. As you probably know, Java is compiled to bytecode, which can be decompiled back to original source with tools such as JAD and JD. Yet, in the past year or so the bad guys started paying much more attention to Java exploits. Java is a very appealing target, since it can be found on your home desktop, on your mobile and even on many embedded devices. But even a sweeter treat are the vulnerabilities like AtomicReferenceArray that can be exploited with a shell-bytecode (bytecode that acts as the shellcode, but for the JVM), meaning exploitation will be successful regardless of the operating system! As evidence to this, you all saw Flashback hitting OS X in the past weeks with exactly the same vulnerability.

The fact that bytecode can be easily decompiled was less than comfortable for exploit kit developers, as it made detection logic as straight forward as searching for specific strings in the decompiled source. But the bad guys don't let go that easily and bytecode obfuscators become increasingly popular among java attacks.

Let's go back and take a look at the main loading page, serving obfuscated JavaScript – which is a standard for at least a few years by now.

7abe1965-53f1-47fa-887c-5dc2a3769015

 

After quick deobfuscation, we get to the code loading the PDF and JAR exploits. Notice the JAR is loading prior to the plugin detection code and without any version checks . Sloppy and unprofessional – I wouldn't pay for this product :)

13802638-899a-45ee-9cfc-7cf1082fb12a

 

The JAR contains several classes with meaningless names, such as the main class "tyu.class" (as seen in the figure above). The attempt to decompile tyu.class using JAD produces unreadable code:

34ad4ea4-d980-4e0b-837a-34700617ce56

 

Time for some creative analysis! First of all, I noticed that throughout the code there's a repeated use of a function named ALLATORI_DEMO. A quick Google search reveals that this is a commercial Java bytecode obfuscator. I sent the vendor a query about whether they have a deobfuscator for the good guys, but haven't received a response yet. No worries – we can manage without that response.

ff08f3d8-90e5-49f7-abb7-fb07de09d5e5

 

What you see in the screen shot above is a typical example of what happens during the self deobfuscation stage. Weird looking strings are passed as arguments to functions from a limited set of functions, including the mentioned ALLATORI_DEMO function, which return a String object. Now wouldn't it be great to just execute this function specifically for this input and see the result?? This is exactly what I did. Java supports loading compiled classes at runtime. There are two methods to do this, ClassLoader and Reflection. In this case reflection is the suitable method. An example with much more info on how to use Reflection can be found here.

At first sight, the resulting "decoded" strings still didn't make much sense. But after some further analysis of the bytecode, there was a piece of code that stood out. It looked like a loop which was intentionally obfuscated, and that loop dealt with some of the previously decoded strings. Unfortunately due to obfuscation, the loop wasn't stored as a single callable function and thus reflection won't be much of a help in this case. The bytecode of the loop:

e5fb2b1a-5ec8-488c-a5a6-0a424d1c7249

 

After tracing this code for a couple of times, it was easy to reconstruct the original loop source. The loop takes the decoded strings, one of which is passed using the "param" HTML tag, and recovers the original string that the authors wish to hide. Here is the reversed loop in JavaScript syntax:

c903c967-d924-49a6-bf73-48f93c8ee98c

 

'key3' and 'key4' are two of those strings mentioned earlier which were decoded by the ALLATORI_DEMO function. 'paramStr' is the parameter passed from the parent HTML and decoded by an auxiliary function (such as ALLATORI_DEMO). This exhibits a key-lock relation between the parent HTML page and the JAR file, as the java applet won't execute properly without the decoding key.

The final resulting string is a URL of the payload executable file. A further analysis of the bytecode clearly shows the use of AtomicReferenceArray vulnerability in order to run shell-bytecode that downloads the exe file from this URL and executes it on the victim's machine.

During the last several weeks we witness a disturbing rise of campaigns based on the RedKit in the wild. Fortunately, all customers of our Secure Web Gateway are protected by default from these attacks.

Latest SpiderLabs Blogs

EDR – The Multi-Tool of Security Defenses

This is Part 8 in my ongoing project to cover 30 cybersecurity topics in 30 weekly blog posts. The full series can be found here.

Read More

The Invisible Battleground: Essentials of EASM

Know your enemy – inside and out. External Attack Surface Management tools are an effective way to understand externally facing threats and help plan cyber defenses accordingly. Let’s discuss what...

Read More

Fake Dialog Boxes to Make Malware More Convincing

Let’s explore how SpiderLabs created and incorporated user prompts, specifically Windows dialog boxes into its malware loader to make it more convincing to phishing targets during a Red Team...

Read More