Select your language

Analysis of a Trojan in JAVA

These days it has begun to reproduce a Trojan that reaches the user through an email in Portuguese (very common in South America to receive news of this type from Brazil). This is the email you may receive:

Igual eu te falei aquele dia e voce nao quis acreditar. Friend to people counts not finger!
Veja só o que seu amiguinho andou aprontando nessas fotos.
DSC02421.jpg (568.3 KB)
DSC02521.jpg (603.4 KB)

Obviously those "images" with links to the corresponding executables... that they are the same, although it seems that they are of different size, they are to mislead. Executables point in this direction: http://ads.sapo.[ REMOVED]/event.ng/Type=click&FlightID=90951&AdID=169189&TargetID=6167&ASeg=&AMod=&Segments=8,69,154,526,527,688,1343,2130,2884,3325,3747,4552,4663,4778,4932,4963,4971,5065,5081,5088,5117,5152,5165,5169,5200,5295,5301,5508,5549,5557&Targets=246,5389,704,6167&Values= 31,43,51,60,72,84,90,91,100,110,150,193,204,209,376,978,1036,1097,1100,1399,1436,1459,1478,1488,1489,1733,1754,1819,1863,1922,1941,2020,2174,2230,2863,2869,2956,2993,3322,3533,3576&RawValues=&Redirect=http://www.givinbeauty.com/UserFiles/File/photos.php?0.19325211365355321

That link leads to an executable file: http://www.givin[DELETED].com/UserFiles/File/photos.php?0.19325211365355321.

Análisis de un troyano en JAVAWe will see below that this site has a login option and if they hacked it, it was there, they uploaded the executable and forwarded it by mail. In addition, as we will see, they used another website to redirect in this case to http://ads.sapo.[ REMOVED]/event.ng/.

When you download the Trojan and observe it with Peid you will find that it is packaged with UPX. If we open the EXE we will see a string like this:

.rdata:00414BA8 0000000B C WINRAR. SFX
.rdata:00414BCC 00000039 C d:\\Projects\\WinRAR\\SFX\\build\\sfxrar32\\Release\\sfxrar.pdb

These lines mean that they are self-extracting executables of WinRAR. Do we need to decompress them with Olly? No, with WinRAR we can unzip it in a folder and it will leave a file called: loader.jar, a JAVA application and we have already taken some layers out of the onion.
Análisis de un troyano en JAVA
We can make use of WinRAR once again to decompress the JAVA JAR, as these are compressed with ZIP. So we right-click and extract to a folder. It will return the folders that you see in the image.

Now let's go to the best, decompile the . CLASS, the compiled JAVA files (the famous . OBJ). These files are interpreted by the JAVA classloader and are executed as one more application. There are many JAVA CLASS file decompilers and one of the best known is the JAVA Decompiler DJ.

- Publicidad -

We will see the Imports, some interesting and others not so much.

import b.d;
import by.squareroot.injector.lib.MyKernel32;
import by.squareroot.injector.struct.Context;
import by.squareroot.injector.struct.MemoryBasicInformation;
import by.squareroot.injector.struct.ProcessInformation;
import by.squareroot.injector.struct.StartupInfoA;
import by.squareroot.injector.struct.TotalProcInfo;
import by.squareroot.injector.struct.WoW64Context;
import by.squareroot.injector.struct.pe.MZHeader;
import by.squareroot.injector.struct.pe.PEInfo;
import by.squareroot.injector.struct.pe.PE_ExtHeader;
import by.squareroot.injector.struct.pe.PE_Header;
import by.squareroot.injector.struct.pe.SectionHeader;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Advapi32Util;
import com.sun.jna.platform.win32.WinReg;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.Properties;
The first are the most interesting obviously, we will see that they are classes made with the help of a friend of our creator called squareroot. If we look a little for the name of the class, the nickname of the creator and the word Class, we find a Russian site that offered to download: build___00002469.jar that apparently contained this same content.

We must not give up there (we must learn to look as the great Fravia, QEPD taught us) we will look a little further we will find a reference in this stitio that seems to be from another reverser analyzing jaZEUS.

If we read that article a little and then continue with it we can conclude two things:

  1. The creator of this virus used the same technique and resources as the jaZEUS virus to infect its victims.
  2. It is a variant of JAZeus or the original version.
I opt for the first option since the dropper (executable that decompresses and leaves the virus in one place to run it later) is different from the jaZEUS version analyzed by our friend Donato Ferrante (ratsoul). The structure of our variant is very similar to that of jaZEUS, we can see it in the image of the article:
Análisis de un troyano en JAVA
We will see that the Launcher class is not found in our Injectorpackage and neither is the crypt package. But if we will find the same thing in the data package.

In JAZeus apparently the two .EXE are encrypted, in our variant, only app.exe is encrypted and dummy.exe not, we can see it simply by opening the EXE and seeing its header. If we debug dummy.exe we will see that it is another dropper made in C++ that will seek to decrypt app.exe, looking for the encryption method in the method file and then using that parameter to decrypt and execute it.

Apparently the method of unpacking this virus is the same as JAZeus does, with the variant that the launcher does not have. From what I see the launcher is unified in a.class since it runs app.exe after decrypting it from there inside. The injector package takes care of the assembly and in-memory injection of the executable for the execution of the actual virus. In the method "a" of the class "a", we will see that it is put at the beginning to start when our OS starts:

s = a("data/app.exe");
b.a a1 = a();
try
{
ifnull)
{
String s1;
if((s1 = ((Properties) (obj)).getProperty("hklmnull)
{
String s2 = a();
Advapi32Util.registrySetStringValue(WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\", s1, s2);
}
String s3;
if((s3 = ((Properties) (obj)).getProperty("hklunull)
{
obj = a();
Advapi32Util.registrySetStringValue(WinReg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run\\", s3, ((String) (obj)));
}
}
}
As we can see we will find other interesting pieces of code, to find our virus we will have to decrypt app.exe. Not having the launcher becomes a little difficult but the most important thing is that we find how it works, to stop it at least we must take out that registration key.

If it becomes a JAZeus we will have some more security problems, we can also find the 3DES encryption method as a string in the others. CLASS, in addition to a possible key, phrase widely used as a demo of blog post, etc.

Spark by Disidents

- Publicidad -

See original.

No comments

• If you're already registered, please log in first. Your email will not be published.

Comments are closed

The comments for this content are closed.

Security becomes a technological platform

Security becomes a technological platform

Mexico. Security is moving from a set of standalone systems to an integrated technology platform that combines artificial intelligence, video analytics, sensors, access control, and data platforms....

Security industry in Mexico and Latin America continues its expansion and professionalization

Security industry in Mexico and Latin America continues its expansion and professionalization

International. The security industry in Mexico and Latin America maintains a growth trend driven by digital transformation, the increase in physical and cyber risks, as well as the need to protect...

Veeam Introduces Agent Commander to Address AI Agent Risks in Enterprise Environments

Veeam Introduces Agent Commander to Address AI Agent Risks in Enterprise Environments

United States. Veeam Software today announced the launch of Agent Commander, a solution aimed at helping organizations detect risks associated with artificial intelligence, protect AI-based systems...

Key and asset management, the key to optimizing operations in logistics, distribution and construction companies

Key and asset management, the key to optimizing operations in logistics, distribution and construction companies

In industries where every minute counts, efficient asset and resource management has become a strategic factor to ensure operational continuity, safety, and productivity. By: Héctor Meléndez,...

Genesis Security Reduces False Alarms by 62% Through Milestone Integration and Actuate AI Analytics

Genesis Security Reduces False Alarms by 62% Through Milestone Integration and Actuate AI Analytics

Puerto Rico. A centralized monitoring operation developed by Genesis Security was able to significantly reduce the volume of false alarms in its security systems, thanks to the integration of...

Case study: Solar cameras and thermal intelligence optimize the safety of aquaculture farms

Case study: Solar cameras and thermal intelligence optimize the safety of aquaculture farms

Türkiye. An open-ocean fish farming farm in Turkey implemented a smart surveillance system based on Dahua solar cameras, thermal monitoring, and wireless data transmission to improve safety and...

 The Hidden Security Gap in Data Centers

The Hidden Security Gap in Data Centers

Imagine the journey of an authorized technician inside a data center. When he arrives, he presents his credential and enters the premises, and before entering the server corridor he needs a key to...

Digital fraud increased at Christmas

Digital fraud increased at Christmas

Colombia. During the holiday season, as e-commerce and digital transactions intensified, online fraud attempts also increased. Fake promotions, impersonation of businesses and messages that...

Milestone XPerience Days arrived in Mexico City with innovations in intelligent video management

Milestone XPerience Days arrived in Mexico City with innovations in intelligent video management

Mexico. Milestone Systems, a leading provider of open platform video management software (VMS), hosted the Milestone XPerience Days Mexico 2025 event, a gathering that brought together industry...

Hikvision Mexico launches the third edition of

Hikvision Mexico launches the third edition of "Hikvision Women"

Mexico. Hikvision Mexico announced the launch of the third edition of its "Hikvision Women" program, an initiative aimed at strengthening the participation and professional development of women in...

Suscribase Gratis
Remember Me
SUBSCRIBE TO OUR ENGLISH NEWSLETTER
DO YOU NEED A SERVICE OR PRODUCT QUOTE?
LATEST INTERVIEWS
SITE SPONSORS










LATEST NEWSLETTER
Latest Newsletter