Explore the resurgence of the Necro Trojan, its infiltration of Google Play, and how it uses advanced steganography & obfuscation to infect Android a
In recent years, the landscape of mobile malware has dramatically evolved, especially as users increasingly seek modified applications (mods) for popular services like [Spotify]( and WhatsApp. These mods often promise users enhanced functionality or ad-free experiences. Unfortunately, many of these unofficial modifications come with significant risks, including embedded malware that can compromise user data and device security.
One such threat that has resurfaced is the Necro Trojan, a multi-stage malware loader that has been found infiltrating popular apps both on unofficial sources and within Google Play itself. The Necro Trojan poses a significant risk due to its sophisticated evasion techniques, including obfuscation, steganography, and multi-stage payload deployment, making it challenging to detect and mitigate.
Necro is not just another run-of-the-mill malware. Its modular design allows it to execute a variety of malicious functions, such as:
In total, millions of devices have been affected by this malware, which demonstrates the wide-reaching consequences of using modded applications from unofficial sources. Necro’s reappearance on Google Play through infected apps signals the continuous efforts of cybercriminals to exploit both trusted and untrusted distribution channels, significantly increasing the scope of potential victims.
The Necro Trojan was first discovered in 2019 when it was embedded in the widely used document-scanning application CamScanner on Google Play. At the time, the app had over 100 million downloads. The malicious Necro loader was hidden within an innocuous-looking update, which, once installed, delivered the payload to the user’s device. Fast forward to 2024, and Necro has returned with even more complex evasion techniques and wider distribution.
Spotify mod
In late August 2024, security researchers identified the Necro Trojan once again, this time embedded in modded applications like Spotify Plus and WhatsApp mods, downloaded from unofficial sources. What made the discovery particularly concerning was that some infected apps were found within the Google Play Store, indicating that even vetted platforms are not immune to Necro's reach.
The primary infection vectors for the Necro Trojan include:
Wuta Camera App in Google Play
In Wuta Camera, a popular photo-editing app, the Necro loader was embedded in versions starting from v6.3.2.148. By the time the malicious activity was discovered, the app had been downloaded over 10 million times. After security researchers flagged the issue, the loader was removed in v6.3.7.138.
Necro Trojan’s operation hinges on its ability to modify legitimate apps without arousing suspicion. A typical infected app includes a custom Application subclass that initializes a malicious SDK, such as Coral SDK, during its execution. This SDK is responsible for integrating various advertising modules into the app, but more importantly, it communicates with a Command-and-Control (C2) server, transmitting data about the compromised device.
The C2 server then issues commands back to the Trojan, triggering specific malicious behaviors like:
Here is a sample of the JSON data transmitted by the Trojan to the C2 server:
{
"appId": "REDACTED",
"channelId": "com.spoti.plus",
"androidId": "REDACTED",
"isAdb": false,
"isProxy": false,
"isSimulator": false,
"isDebug": false,
"localShellVer": 0,
"sdkVer": 116,
"appVersion": "1020000005",
"appVersionName": "18.9.40.5"
}
One of the reasons Necro is so difficult to detect lies in its sophisticated use of obfuscation techniques. The malicious code is obfuscated using tools like OLLVM (Obfuscator-LLVM), which scrambles the code into a format that is extremely challenging to decompile or analyze.
Additionally, steganography is employed to hide payloads within seemingly innocuous files, such as PNG images. The Trojan downloads these images from the C2 server, extracts the hidden data using Android’s getPixel
method, and then reconstructs it into a Base64-encoded JAR file. Once decoded, this JAR file is executed by DexClassLoader, allowing the Trojan to execute the next stage of its payload without raising red flags.
The image contains the encoded payload in its least significant byte (LSB) values:
int pixelValue = bitmap.getPixel(x, y);
byte payloadByte = (byte) (pixelValue & 0xFF); // Extracts the blue channel data (LSB)
This payload extraction process highlights Necro’s advanced ability to hide in plain sight and execute code without triggering conventional antivirus software.
Wuta Camera is a widely used photo-editing app available on Google Play with over 10 million downloads. It was initially released as a legitimate app, but in version 6.3.2.148, the Necro Trojan was embedded within it. This infection allowed attackers to exploit a large user base, especially in regions like Russia, Brazil, and Vietnam. By the time the infected version was discovered, thousands of users had already been affected.
After being reported by security researchers, Google Play removed the malicious version, and Wuta Camera was forced to release a clean version in 6.3.7.138.
Max Browser was another popular app infected with the Necro Trojan. With over 1 million downloads, it represented a significant attack vector for the Trojan authors. Version 1.2.0 of Max Browser included the Necro loader, which used Firebase Remote Config to remotely update its payload. This version of the Trojan also utilized steganography to conceal malicious code in image files downloaded from the C2.
By the time researchers identified the infection, the Trojan had affected a large number of users, primarily in Southeast Asia. The infected version was promptly removed after being flagged.
The Necro Trojan is particularly notable for its use of advanced code obfuscation and payload delivery techniques. Here, we will explore some of the core technical elements of the malware, including code samples that highlight its behavior.
One of the Trojan’s most dangerous techniques is its use of DexClassLoader to load and execute malicious payloads from dynamically downloaded JAR files. This allows the malware to evade static analysis and deliver malicious code at runtime.
// Sample code from the Trojan showing how a Base64-encoded JAR is loaded and executed.
String encodedJar = "Base64 encoded JAR string here";
byte[] decodedJar = Base64.decode(encodedJar, Base64.DEFAULT);
// Write the decoded bytes to a temporary file.
File tempJar = new File(context.getCacheDir(), "temp.jar");
FileOutputStream fos = new FileOutputStream(tempJar);
fos.write(decodedJar);
fos.close();
// Use DexClassLoader to load and execute the JAR file.
DexClassLoader classLoader = new DexClassLoader(tempJar.getPath(),
context.getDir("dex", 0).getAbsolutePath(),
null,
context.getClassLoader());
Class loadedClass = classLoader.loadClass("com.malicious.EntryPoint");
Method runMethod = loadedClass.getMethod("run");
runMethod.invoke(null);
Explanation:
run()
method is invoked, which executes the next stage of the payload.Another highly advanced technique used by the Necro Trojan is steganography. The payload is hidden inside PNG images using a simple, yet effective, least significant bit (LSB) extraction technique. By embedding the payload in the image, the Trojan can bypass traditional antivirus scanning, which doesn’t typically scan images for malicious code.
// Extracting the payload hidden in the least significant byte (LSB) of each pixel.
Bitmap image = BitmapFactory.decodeStream(new FileInputStream("path/to/downloaded/image.png"));
ByteBuffer payloadBuffer = ByteBuffer.allocate(image.getWidth() * image.getHeight() * 4);
for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
int pixel = image.getPixel(x, y);
payloadBuffer.put((byte) (pixel & 0xFF)); // Store the least significant byte (blue channel)
}
}
// Reconstruct the payload from the extracted bytes
byte[] payload = new byte[payloadBuffer.position()];
payloadBuffer.rewind();
payloadBuffer.get(payload);
// Decode the payload and prepare it for execution
String base64Payload = new String(payload, StandardCharsets.UTF_8);
byte[] decodedPayload = Base64.decode(base64Payload, Base64.DEFAULT);
Explanation:
Infection Diagram
Given the sophisticated nature of the Necro Trojan, security measures need to go beyond traditional antivirus or basic app security. Here are super-tailored and targeted recommendations for users, developers, and enterprises:
The resurgence of the Necro Trojan illustrates the persistent and evolving threats that target mobile devices. Its ability to evade detection through multi-stage loading, obfuscation, and steganography poses a significant challenge to both users and security professionals. With millions of devices affected globally, the Necro Trojan demonstrates how even trusted platforms like Google Play can become a distribution vector for sophisticated malware.
To mitigate these risks, it is crucial for all stakeholders—users, developers, and enterprises—to remain vigilant. Users must exercise caution when downloading apps, developers need to ensure their applications are secure and uncompromised, and enterprises must deploy robust security measures to protect their devices and data from these evolving threats.
By staying informed, employing best security practices, and leveraging advanced security solutions, we can collectively reduce the threat posed by malware like Necro.