Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More

Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. 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

Magnitude Exploit Kit Backend Infrastructure Insight - Part I

In our recently released Trustwave Global Security Report Online and previous Magnitude blog post, A Peek Into the Lion's Den – The Magnitude [aka PopAds] Exploit Kit, we detailed our discovery of one of the more prevalent exploit kits seen these days, showed an inside look at the control panel and analyzed the kit's activity over one month.

The back-end infrastructure of Magnitude has revealed itself to be even more exciting than the front-end. With this post we'll provide more technical details about how the kit avoids detection.

Magnitude provides its customers with a good foundation for creating attacks with low detection rates. The most popular technique for making an attack undetectable is simply recreating everything from scratch and fast. The following scripts run in a cronjob and are responsible for different parts of the attack.

Exploit Obfuscation

The Magnitude author abuses the static analysis technology of Anti-Virus vendors by having a tool that re-creates its exploits periodically by randomizing every constant variable / function name.

Below is an example of the exploit outline, every part in the code surrounded by "%" will be replaced with a randomized string.

10276_80f0a87b-29d5-4d26-8829-fc3d0e1ece96

The PHP script uses a "preg_replace" function to replace the content, which is used almost in every part of the code.

9849_6eb8c232-9c26-4e39-8be2-87a1fdb09c76

After replacing the strings, the new content is written into a file and the exploit is ready for massive distribution.

Another script is responsible for re-generating the Java exploit, which is created on a different server and uploaded manually (for now) to the infection server. The process of creating the Java exploit is similar to other HTML based exploits - it loads an outline Java source file filled with patterns to be replaced.

11423_b80fef1a-c5c4-4083-85a9-a0f7f0ad6966

The PHP script loads the files and uses regular expression to replace those occurrences.

10188_7d42caae-15df-4c85-8199-a3cc66f08086

Finally, after creating the Java files with the randomized strings, the script compiles the source code and wraps it to a Jar file:

9069_48b34537-6066-4b2f-b100-dbd2ea2d8aa7

Since the commands are clearly written for Windows rather than Linux, the Java exploit creation process probably takes place on a different, Windows based machine.

Domain Detection Rate

Just like security products, the Magnitude exploit kit operates on several layers. Most security products use the domain/URL as part of their detection logic, and so Magnitude provides its customers with the ability to load a set of domains that are constantly checked. Magnitude uses the Scan4you anti-virus detection service to scan IP/domains as well as files to make sure commercial anti-virus products cannot detect it. Once security vendors mark a domain as malware, the system updates the information in the database and quickly replaces the domain with a new one that is not yet detected by security vendors, which makes URL Filtering less effective.

10618_91f76efe-b4bf-49f5-baea-7763423face0

According to the code above, the script also manually checks the domain with Google by using "http://google.com/safebrowsing/diagnostic"

"Used" Domains Removal

Rotating domains every several minutes is effective but may be expensive. Making the website look legit and hosting the malicious content on a subdomain can keep the domain undetectable for a longer period of time. Knowing this, Magnitude creates a list of subdomains for every "main" domain and deletes it from the queue after a short period of time. This helps Magnitude overcome URL listing filtering engines.

11151_ab333d91-37b9-428e-bbff-34964f922844

Redirect Traffic

Apparently, the road to infection involves many obstacles. The Magnitude exploit kit checks several conditions before trying to exploit the target machine. An attacker that is using Magnitude can define a URL to which a target machine is redirected in case the infection conditions are not met. The URL is also controlled remotely and the system ensures it's up-to-date as shown below:

11608_c165bdbb-6ae2-4e20-9961-5684b12e7ac1

The system queries the pre-defined redirection URL, which provides the system the information where to redirect the victim, this way the URL can be generated dynamically.

Payload Detection Rate

Testing the detection of payloads by AV products is a very important practice for exploit kits and is commonly used because these products quickly add detection for these payloads. The Magnitude author also uses the Scan4you for testing the payload detection rate:

9838_6e5d1fcb-0b0d-4dbd-a695-63080439d541

The second part of the script contains predefined payloads that may be owned by the author itself, these are also constantly updated from a remote server.

11281_b1851905-4fff-49f9-a936-57ba289cb5ec

Backend Control Panel

On top of the exploit kit infrastructure the author created a control panel for administrators, which allows him to view and modify the configurations of their customers. The administrative control panel, unlike the customer control panel, is accessible only by specific IP addresses that are "hard coded" as part of the control panel. These IP addresses probably are ones used by the authors thus this restriction excludes access from anyone else.

10971_a1ddbd2a-a5de-42f8-95d0-245192a464ff

As mentioned in the previous blog post, the customer's control panel is located on a different server. The infection server has to download the payloads from the customer's control panel server. A script was written specifically for this and can only be accessed from this server:

12342_e62ec817-1414-4c26-93e7-53d7df0be097

It is evident that the script communicates with the customer's control panel server, downloads the new payload and removes the old one.

The author has definitely learned from the mistakes of other exploit kit authors. The Magnitude exploit kit has been operating for more than a year in the shadows with no information on how it works behind the scenes. Most of the internal scripts can be accessed only from specific IP addresses and are password protected.

We will reveal additional technical information regarding the Magnitude exploit kit backend infrastructure in the next blog post.

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