In December 2014 we discovered a very interesting vulnerability in the Darwin kernel, which is an open source part of Apple's two operating systems: OS X and iOS. As a result, OS X 10.10 and iOS 8 are also at risk. This vulnerability is connected with the processing of an IP packet that has a specific size and invalid IP options. As a result, remote attackers can cause DoS (denial of service) of a device with OS X 10.10 or iOS 8 installed. It means that attackers can send just one incorrect network packet to the victim and the victim's system will crash.
OS X 10.10 crash after invalid network packet processing
Using vulnerability in the Darwin kernel attackers can cause DoS of a device with OS X 10.10 or iOS 8 installedTweet
While analyzing this vulnerability we've discovered that the following devices with 64-bit processors and iOS 8 installed are affected by this threat:
- iPhone 5s and later models
- iPad Air and later models
- iPad mini 2 and later models
To understand the nature of this bug let's look at a crash dump:
Kernel stack trace
You can see from this trace that something went wrong in the icmp_error() function and it calls the panic function. This function tries to construct a new ICMP error message and resend it. This screenshot shows that the icmp_error was called after parsing packet options. The problem lies in this piece of code:
The cause of the problem
When the conditions laid down in the code are met, the panic function is engaged and the system is shut down in emergency mode. This happens because the internal kernel structures have been changed and the new buffer size is insufficient to store a newly-generated ICMP packet. To cause this, the IP packet must satisfy the following criteria:
- The size of the IP header should be 60 bytes.
- The size of the IP payload should be at least 65 bytes
- There should be errors in the IP options (invalid size of option, class, etc.)
Example of packet that cause a crash
At first glance it is not obvious how this bug could be exploited effectively. However, a true professional can easily use it to break down a user's device or even interrupt the work of a corporate network. Usually this kind of incorrect packet would be dropped by routers or firewalls but we discovered several combinations of incorrect IP options that can pass through the Internet routers.
This vulnerability no longer exists in OS X 10.10.3 and iOS 8.3. In addition, users of Kaspersky Lab's products are secured against this vulnerability in OS X 10.10 by the Network Attack Blocker feature. Starting from Kaspersky Internet Security for Mac 15.0, this threat is detected as DoS.OSX.Yosemite.ICMP.Error.exploit.
In the summer of 2014, the company Trend Micro announced the detection of a new threat - the banking Trojan Emotet. The description indicated that the malware could steal bank account details by intercepting traffic. We call this modification version 1.
In the autumn of that year a new version of Emotet was found. It caught our attention for the following reasons:
- The developers of this Trojan had begun to use technology that stole money automatically from victims' bank accounts - so called "Automatic Transfer System (ATS)".
- The Trojan had a modular structure: it contained its own installation module, a banking module, a spam bot module, a module for stealing address books from MS Outlook and a module for organizing DDoS attacks (Nitol DDoS bot).
- The creators made a significant effort to remain unnoticed: they didn't attack users in the RU zone but targeted the clients of a small number of German and Austrian banks (other well-known banking Trojans are less discerning in their choice of target),and the domain name of the ATS server changed frequently (once or several times a day).
We are going to refer to this modification as Emotet version 2. The bot contains and transfers the numbers one and seven to the command and control center (C&C), which suggests that the Trojan's authors considers this variant to be version 1.7.
Both versions of the Trojan attacked clients of German and Austrian banks.
#Trojan #Emotet targeted the clients of a small number of German, Austrian and Swiss banksTweet
We closely monitored Emotet version 2. In December 2014 it ceased activity and the command servers stopped responding to infected computers. We recorded the last command sent from the command centers on 10/12/2014, at 11:33:43 Moscow time.
However, the thoroughness with which the authors had approached the development of this Trojan and the high level of automation in its operation, left little doubt that this was not the end of the story. And so it turned out - after a short break in January 2015, Emotet reappeared! We are calling this modification version 3 (the bot contains and transfers the numbers one and 16 to the C&C, which we assume means that the authors consider this variant to be version 1.16).
In essence, Emotet version 3 is not that different to version 2 - the main differences are designed to make the Trojan less visible. Of the changes we noted, we would like to highlight the following:
- The Trojan has a new built-in public RSA key and, although the communication protocols with the command center are identical for Emotet versions 2 and 3, if the old key is used the bot does not receive the correct answer from the command center.
- The ATS scripts are partially cleaned of debugging information and comments.
- New targets! Emotet is now also targeting clients of Swiss banks.
- There has been a slight change in the technology used to inject code into the address space of explorer.exe. Version 2 used a classic model for code injection: OpenProcess+WriteProcessMemeory+CreateRemoteThread. Version 3 uses only two stages of the previous model:OpenProcess+WriteProcessMemory; and the injected code is initiated with the help of modified code of the ZwClose function in the address space of the explorer.exe process, which is also achieved using WriteProcessMemory.
- Emotet version 3 resists investigation: if the Trojan detects that it has been started in a virtual machine it functions as usual but uses a different address list for the command centers. However, all these addresses are false and are used only to mislead investigators.
- The Trojan contains very few lines of text: all lines that could warn investigators are encrypted using RC4 and are decrypted in allocated memory directly before use and deleted after use.
On the whole, we formed the impression that the main techniques used in version 3 of the banking Trojan were developed "in the field" using version 2 as a basis, and with the addition of improved stealth techniques.
Kaspersky Lab products detect all versions of this Trojan as Trojan-Banker.Win32.Emotet. We also detect the following modulesof Emotet:
- Module for modifying HTTP(S) traffic - Trojan-Banker.Win32.Emotet.
- Spam module - Trojan.Win32.Emospam.
- Module for the collection of email addresses - Trojan.Win32.Emograbber.
- Module for stealing email account data - Trojan-PSW.Win32.Emostealer.
- Module designed for organising DDoS attacks — Trojan.Win32.ServStart.
We have seen the last module used with other malware and assume that it was added to Emotet by a cryptor. It is quite possible that Emotet's authors are totally unaware of the presence of this module in their malware. Whatever the case may be, the command centers of this module do not respond and the module has not been updated (its compilation date is 19 October 2014).Infection
We currently know of only one method of distribution for the Emotet banking Trojan: distribution of spam mailings that include malicious attachments or links.
The attached files are usually ZIP archives containing the Emotet loader. The files in the archives have long names, e.g. rechnung_november_2014_11_0029302375471_03_44_0039938289.exe. This is done on purpose: a user opening the archive in a standard Windows panel might not see the extension .exe, as the end of the file name might not be displayed. Sometimes there is no attachment and the text in the main body of the email contains a link to a malicious executable file or archive.
#Emotet banking #Trojan is distributed of spam mailings that include malicious attachments or linksTweet
Examples of emails used to spread Emotet are given below.
Version 2 (link to malware):
Version 2 (attached archive):
Version 3 (link to malware):
The emails we found are almost identical to ones from well-known companies – for example Deutsche Telekom AG and DHL International GmbH. Even the images contained in the messages are loaded from the official servers telekom.de and dhl.com, respectively.
When the email contains a link to malware, it downloads it from the addresses of compromised legitimate sites:
hxxp://*******/82nBRaLiv (for version 2)
or from the addresses
hxxp://*******/dhl_paket_de_DE and hxxp://*******/dhl_paket_de_DE (for version 3).
In Emotet version 3, when addresses are contacted with the form hxxp://*/dhl_paket_de_DE, the user receives a ZIP archive of the following form hxxp://*/dhl_paket_de_DE_26401756290104624513.zip.
The archive contains an exe-file with a long name (to hide the extension) and a PDF document icon.Loading the Trojan
The Trojan file is packed by a cryptor, the main purpose of which is to avoid detection by anti-virus programs. After being started and processed by the cryptor, control is passed to the main Emotet module - the loader. This has to embed itself in the system, link with the command server, download additional modules and then run them.
Consolidation in the system is fairly standard — Emotet version 2 saves itself in %APPDATA%\Identities with a random name of eight characters (for example — wlyqvago.exe); adds itself to the autoloader (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run) and then deletes its source file with the help of a launched bat-file that is created in %APPDATA% with the name "ms[7_random_numbers].bat.
Emotet version 3 saves itself in %APPDATA%\Microsoft\ with a name in the format msdb%x.exe" (for example – C:\Documents and Settings\Administrator\Application Data\Microsoft\msdbfe1b033.exe); adds itself to the autoloader (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run) and then deletes itself with the help of a launched bat-file (which is created in %APPDATA%\del%x.bat).
After consolidating itself in the system, Emotet obtains a list of the names of all processes running and calculates a hash from the name of every function, comparing the resulting value with the hardcoded 0xB316A779 (this hash corresponds to the process explorer.exe). In this way, Emotet locates the process into which to inject itself. Further, the Trojan unpacks its main code and injects it into the process explorer.exe.Communication with the command center
The main module of the Trojan, the loader, communicates with the C&C using RC4 encryption.
The port used by the loader is hardcoded into it - 8080.Command center addresses
The IP addresses of Emotet's command-and-control servers are hardcoded into the bot. There are several of these – one of the version 2 samples that we analyzed included 30 (note that 3 addresses on the list below belong to well-known legitimate resources):
In the sample of version 3 we investigated there were 19 command centers:
Emotet version 3 contains another list of "command center" addresses, as given below:
The Trojan tries to contact these addresses if it detects that it is being run in a virtual machine. But none of the addresses correspond to the bot's command centers, and the bot is therefore unsuccessful in trying to establish contact with them. This is probably done to confuse any investigators and give them the impression that the Trojan command centers are dead. A similar approach was used previously in the high-profile banking Trojan, Citadel.
#Trojan #Emotet tries to contact the wrong addresses of the C&C if it is being run in a virtual machineTweet
The detection of a virtual machine is organized quite simply — by the names of processes that are usual for various virtual machines. The following algorithm is used to calculate a hash value from the name of every process in the system:
Algorithm for calculation of a hash value from a process name
The resulting hash value is then compared with a list of values hardcoded into the Trojan:
Hashes from the names of processes used for the detection of virtual machines
We derived the names of the processes for several hashes. For example, hash 0xBCF398B5 corresponds to the process vboxservice.exe, hash 0x2C967737 to the process vmacthlp.exe, hash 0xE3EBFE44 to the process vmtoolsd.exe, and 0x61F15513 to the process vboxtray.exe.Data transferred
A request to the command center appears in the traffic as follows (the example given is from version 2, but a version 3 request looks the same):
Dialogue between the Emotet bot and its command center
The URL-path that the bot communicates with appears as follows: /722ffc5e/355c7a0a/, where 722ffc5e is a number calculated on the basis of information from the access marker of the user, and 0x355c7a0a = 0x722ffc5e xor 0x47738654 (the value 0x47738654 is hardcoded into the bot).
The data sent by the bot and the command center are encrypted using RC4 and the answers received from the command center are signed with a digital signature. Probably this is done to make it difficult to seize control over the botnet: in order for the bot to accept a packet it must be signed and for that it is necessary to know the secret key.
There is a public RSA key in the body of the bot. In PEM format for version 2 it appears as follows:
PEM representation of the open RSA key coded into the bot in version 2
As noted above, in version 3 the key changed. In PEM format it looks like this:
PEM representation of the open RSA key coded into the bot in version 3
A packet sent to the server is made up as follows:
- A request is generated containing the identifier of the infected computer, a value presumably indicating the version of the bot; information about the system (OS version, service pack version, product type); a hardcoded dword (value in the investigated sample — seven); control sums for the banker module; and information about the web-injects. Information about the web-injects contains: a page address (with jokers), into which the injection is needed; data coming before the injected data; data coming after injected data; and injected data.
- An SHA1 hash is calculated from the generated request.
- The request is encrypted with a randomly generated 128 bit RC4 key.
- The generated RC4 key is encrypted using the public RSA key.
- The total packet is the concatenation of the results obtained at steps 4, 2 and 3.
The request packet can be represented by the following diagram:
Structure of a request from the bot to the server
In response the server sends a packet with the following structure:
Structure of the server's answer to the bot
The answer can contain information about the Emotet web-injects, Emotet modules and links for loading external modules (for example a spam bot or an updated loader).Modules
Like most modern banking Trojans, Emotet has a modular structure. To date we have detected the following modules:Name Description Method of delivery to infected system loader loader In spam emails or by downloading via a link from a compromised site (for updates). nitol-like-ddos-module DDoS-bot mss Spam module Downloaded from compromised sites by the loader module. email_accounts_grabber Email account grabber, uses Mail PassView – a legitimate program designed for recovering forgotten passwords and mail accounts Received by the loader module in the answer packet from the command center. banker Module for modifying HTTP(S)-traffic Received by the loader module in the answer packet from the command center. outlook_grabber Outlook address book grabber Received by the loader module in the answer packet from the command center.
Several modules can work independently of the loader module, as they don't need to import anything from it.
The whole arrangement of the bot is evidence of a high level of automation: new email addresses are collected automatically from the victims' address books, spam with the Emotet loader is sent automatically, and money is transferred automatically from the user. Operator participation is kept to a minimum.
As an example, here is the report of the outlook_grabber module sent to the attacker (from Emotet version 2) with a stolen Outlook address book:
A stolen Outlook address book, transferred to the criminals' server
One positive note is that when trying to contact one of the attackers' servers an answer is obtained containing "X-Sinkhole: Malware sinkhole", meaning that the stolen data will not reach the criminals — this domain, which is used by Emotet version 2, is no longer controlled by the authors of the Trojan.
However, for version 3 things are different. This is how the report of the email_accounts_grabber module appears for Emotet version 3:
Report containing data about the user's email accounts
It is clear that the server answers "200 OK". This means that the criminals have successfully received the data.Stand and Deliver!
Information about the data for injection into the page that is received by Emotet after unpacking appears as follows:
Decrypted data on the web-injects of Emotet version 2
Decrypted data in the web-injects of Emotet version 3
The significant difference in data on injects between the two versions is as follows: Emotet version 3 is aimed at the clients of Swiss credit organizations. To date we have not seen scripts for the automatic stealing of money from clients' accounts in these credit organizations but we are certain that such scripts will be written soon.
Although individual fragments of HTML code in the decrypted packet can be read easily, understanding the rules for use of the web-injects from the deciphered data is difficult. Below, in JSON format, several web-inject rules are given for one target — the site of a German bank (Emotet version 2).
The web-inject rules for the site of a German bank (Emotet version 2)
The use of this web-inject leads to the creation of a new element of type 'div', which will have the size of the whole visible page, and to the addition of a new script in the HTML document. In the example given the script is loaded from the address hxxps://*******.eu/birten/luck.php?lnk=js&id=44.
And an analogous view of several inject rules for a new target — the site of a large Austrian bank (Emotet version 3).
The web-inject rules for the site of an Austrian bank (Emotet version 3)
It is clear that the configuration file with the web-injects has a classic structure, using fields conventionally called data_before, data_after and data_inject.
It should be noted that the address of the host on which the file luck.php (for version 2) and a_00.php (for version 3) is located is changed frequently. The rest of the address of the script is constant.
If the investigator tries the script directly, only an error message is received. However, in a real attack when the line
is added to the real bank page, the script loads successfully.
This happens because the criminals' server checks the "Referer" field of the header of the HTTP request and sends the script only if the request came from a page of one of the banks attacked by Emotet.
Having supplied the necessary Referrer one can easily obtain the script code.
At Kaspersky Lab we obtained scripts designed for injection into the pages of the attacked banks.
Table 1. Targets of Emotet version 2, types of attacks and the identification numbers of scripts loaded for carrying out these attacks.
Table 2. Targets of Emotet version 3, types of attacks and the identification numbers of scripts loaded for carrying out these attacks.
In one of the scripts of Emotet version 2 that was used to attack a German bank the comments contain the following line:
Artifact from the script for an attack on a German bank (Emotet version 2)
Clearly the script developers speak Russian.Getting round two-factor authentication
The main purpose of the scripts looked at above is to carry out the illicit transfer of money from the user's account. However the bot cannot independently get round the system of two-factor authentication (Chip TAN or SMS TAN), it needs the user's help. To mislead the potential victim, social engineering techniques are used: the message injected into the webpage using the script informs the user that the site is introducing a new security system and normal operations cannot be continued until the user has tested it in the demo-regime.
False message about new security system
This is followed by a request to enter real data from the Chip TAN or SMS TAN to carry out a "test transfer":
And finally - congratulations that the task has been completed successfully:
In fact, instead of a test transfer the malicious script carries out a real transfer of money from the victim's account to the account of a nominated person — the so-called "drop", and the user themselves confirms this transfer using the Chip TAN or SMS TAN.
Details of the accounts for the transfer of the stolen money are not initially indicated in the script, but are received from the command server of the criminals using a special request. In reply the command server returns a line with information about the "drop" for each specific transaction. In the comments in one script we found the following line:
Clearly the criminals tested this script with a transfer of 1500.9 EUR to a test account.
In addition, this script contained the following information about the drop:
In the corresponding script in Emotet version 3, designed to attack the same bank, we also found information on the drop, but this time another one:
Let's compare the fields JSON __DropParam and the fields in the legitimate form from a demo-access to the online system of the attacked bank.
Online banking form for transfer of money within Germany or in the SEPA zone
Table 3. Relationship between the drop data and the fields in the form for transfer of money and explanations of these fieldsName of fields in the __DropParam JSON Name of corresponding field in the form Translation Field contents name Empfängername Name of recipient Real name of drop who will receive the stolen money ibanorkonto IBAN/Konto-Nr. International bank account number/ account number Account number, international or local, to which money will be transferred bicorblz BIC/BLZ BIC or BLZ code International bank identification code or identification code used by German and Austrian banks (Bankleitzahl) description Verwendungszweck Purpose Purpose of payment amount Betrag Amount Transferred amount
The JSON __DropParam fields correspond to the fields in the form.
In this way the bot receives all the necessary information about the drop from its server and draws up a transfer to it, and the misled user confirms the transfer using the Chip TAN or SMS TAN and waves goodbye to their money.Conclusion
The Emotet Trojan is a highly automated and developing, territorially-targeted bank threat. Its small size, the dispersal methods used and the modular architecture, all make Emotet a very effective weapon for the cyber-criminal.
The #Emotet #Trojan is a highly automated and developing, territorially-targeted bank threatTweet
However this banking Trojan doesn't incorporate conceptually new technology and so the use of a modern anti-virus program can provide an effective defense against the threat.
Furthermore, the Trojan cannot function effectively without the participation of the user — the Emotet creators have actively used social engineering techniques to achieve their criminal ends.
And so the alertness and technical awareness of the user, together with the use of a modern anti-virus program can provide reliable protection against not only Emotet but other` new banking threats working in a similar way.Some MD5 hashes
Emotet version 2:
Emotet version 3:
The author would like to express his thanks to Vladimir Kuskov, Oleg Kupreev and Yury Namestnikov for their assistance in the preparation of this article.
In the middle of last year, my colleagues published a blogpost about a new generation of ransomware programs based on encryptor Trojans, and used the example of the Onion family (also known as CTB-Locker) to analyze how these programs work.
Last autumn, we discovered the first sample of an interesting new encryptor, TorLocker (this is the original name given by the creator); later on, TorLocker was used to launch an attack on Japanese users. When it was discovered on 24 October, 2014, the proactive components in Kaspersky Lab's products already detected this piece of malware; later on, it was assigned the verdict 'Trojan-Ransom.Win32.Scraper'.
Trojan-Ransom.Win32.Scraper encrypts the victim's documents and demands a ransom ($300 or greater) to decrypt themTweet
All the TorLocker samples that we have obtained belong to one of two versions: 1.0.1 (in English) or 2.0 (in English and Japanese.) There are only slight differences between them: 1) in the method employed to obfuscate code, and 2) in the sources used for additional modules: in the first version, the additional modules are extracted from the data section, while in the second version, they are downloaded from the Internet (from file hosting services or from compromised sites). Also in the second version, some strings were relocated from the data section into the code section, and dangling (redundant, not used) bytes emerged. The file encryption algorithm is the same in both versions.Common features and peculiarities of this malware family
Our analysis has shown that Trojan-Ransom.Win32.Scraper was presumably written in assembler, which is unusual for this type of malware. The Trojan uses the Tor network to contact its "owners" – something that is apparently becoming a norm for the new generation of ransomware – and the proxy server polipo. This piece of malware often lands on users' computers via the Andromeda botnet.
Trojan-Ransom.Win32.Scraper encrypts the victim's documents and demands a ransom ($300 or greater) to decrypt them. If the malware gets deleted by a security product after the files are encrypted, the Trojan installs bright red wallpaper on the Desktop, containing a link to its executable file. Thus, users have a chance to re-install the Trojan and report to its owners that they have paid the ransom: to do so, users need to enter payment details in a dedicated TorLocker window. This data will be sent to the C&C server which will either reply with a private RSA key or notify that there was no payment.
This typical representative of the Scraper family is packed with UPX. The data section is additionally encrypted with AES with a 256-bit key. In the code section, between the assembler instructions, there are a large number of redundant bytes that are not used in any way.
The redundant bytes in the encryptor's body
The method of submitting string arguments to functions is just as unusual. The strings are located directly in the code section; in order to submit a string as an argument to a function, the pointer to that string is placed into the stack by way of calling (using the 'call' instruction) the instruction following the string. As a result, the return address (which is identical to the pointer to the string) is placed into the stack:
Handling string constants as arguments to functionsOperating principles
Once launched, the Trojan starts by decrypting its data section with a 256-bit AES key. The first 4 bytes of this key are used as a sample ID, added to the end of the encrypted files. Then the Trojan is copied to a temporary folder, and a registry key for that copy's autorun is created in the following registry section:[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
Next the Trojan creates several threads to do the following:
- Search for and terminate the taskmgr.exe, regedit.exe, procexp.exe, procexp64.exe processes.
- Delete all system recovery points.
- Encrypt the user's office documents, video and audio files, images, archives, databases, backup copies, virtual machines encryption keys, certificates and other files on all hard and network drives, except files located in the folders %windir%, %temp%. The names and extensions of encrypted files remain unchanged.
Here is the complete list of file extensions that are encrypted:
.3gp .7z .accdb .ai .aiff .arw .avi .backup .bay .bin .blend .cdr .cer .cr2 .crt .crw .dat .dbf .dcr .der .dit .dng .doc .docm .docx .dwg .dxf .dxg .edb .eps .erf .flac .gif .hdd .indd .jpe .jpg .jpeg .kdc .kwm .log .m2ts .m4p .mdb .mdf .mef .mkv .mov .mp3 .mp4 .mpg .mpeg .mrw .ndf .nef .nrw .nvram .odb .odm .odp .ods .odt .ogg .orf .p12 .p7b .p7c .pdd .pdf .pef .pem .pfx .pif .png .ppt .pptm .pptx .psd .pst .ptx .pwm .qcow .qcow2 .qed .r3d .raf .rar .raw .rtf .rvt .rw2 .rwl .sav .sql .srf .srw .stm .txt .vbox .vdi .vhd .vhdx .vmdk .vmsd .vmx .vmxf .vob .wav .wb2 .wma .wmv .wpd .wps .xlk .xls .xlsb .xlsm .xlsx .zip
- Extract a BMP image, save it to a temporary folder and then set it as desktop wallpaper:
- Download tor.exe and polipo.exe, the files required to communicate with C&C servers, from the links specified in the Trojan's configuration (in the case of TorLocker 2.0) or extract them from the data section (in case of TorLocker 1.0). Then tor.exe is launched with the following arguments:
tor.exe -SOCKSPort 9150 -AvoidDiskWrites 1 -ExcludeSingleHopRelays 0 -FascistFirewall 1 -DirReqStatistics 0
polipo.exe is launched in the following configuration:127.0.0.1:57223 proxyPort = 57223 socksParentProxy = 127.0.0.1:9150 socksProxyType = socks5
- Create a GUI window demanding that the victim pays the creators of Trojan-Ransom.Win32.Scraper and display the window in the top left corner of the screen. It supports payment via BitCoin, UKash and PaySafeCard.
To encourage the user to pay the ransom to the Trojan's owners faster, the Trojan threatens to delete the private key required to decrypt the files if the user fails to send the money within a certain time period. In reality, the RSA keys are not deleted. They are associated with the malware sample rather than with a specific user, so the same RSA key is used for several users at the same time.
- The IP address of the victim computer is determined using www.iplocation.net, www.seuip.com.br, whatismyipaddress.com, or checkip.dyndns.org.
- Establish a connection to the C&C server in the onion domain via the proxy server polipo 127.0.0.1:57223. If the victim user has paid the ransom to the extorters, then, after contacting the C&C server and sending the information about the client (the selected RSA key, the number of encrypted files, the client's IP address and ID, the selected method of payment and the number of the bank card), the Trojan then receives the private RSA key with which to decrypt the files – in this case, a file decryption thread is created. Otherwise, a message is sent that the payment has not been effected yet. In each sample of Trojan-Ransom.Win32.Scraper?, a few dozens C&C domain names are hardcoded; they are not updated and may lead to the same C&C server.
When launching, Trojan-Ransom.Win32.Scraper chooses one of the 128 public RSA keys hardcoded in it, depending on the victim computer's name and the serial number of the logical drive. The number (n) of the public RSA key is calculated as following:n = (VolumeSerialNumber * strlen(ComputerName)) mod 128,
where strlen(ComputerName) is the length of the computer's name, and VolumeSerialNumber is the serial number of the logical drive on which Winsow is installed.
Each sample contains its own set of public keys.
The user's files are encrypted with AES-256 with a randomly generated one-time key; an individual encryption key is created for each file. Then, a 512-byte service section is added to the end of each file, which consists of 32 bytes of padding, 4 bytes of the Trojan's identifier, and 476 bytes of the employed AES key encrypted with RSA-2048.
If the file size is greater than 512 MB + 1 byte, then of the first 512 MB of the file get encrypted. The encrypted data is written on top of the original, non-encrypted data; no new file is created, and the old file is not deleted.
The Structure of an encrypted file
The Trojan does not need Internet access to encrypt the files.Packing
In order to obstruct the analysis, some of the detected samples of Trojan-Ransom.Win32.Scraper were additionally packed with the KazyLoader and KazyRootkit protectors along with UPX.
KazyLoader is a two-stage protector of executable files, written in .NET Framework. The protected executable is encrypted with AES, and then placed into the protector's assets section as a color palette of a BMP image.
The image decryption module is encrypted by XORing with one byte, then divided into parts and also placed into the protector assets section in the form of strings LOADER0, LOADER1, … LOADER272.
The KazyRootkit protector is also written in .NET Framework and has a feature that can conceal processes in the Task Manager (taskmgr.exe) and conceal registry keys in the Registry Editor (regedit.exe) by deleting strings from ListView GUI elements with the help of WinAPI. Depending on its configuration, the protector may shut down without unpacking the file embedded in it, if it detects any of Sandboxie, Wireshark, WPE PRO or a code emulator.
Although Scraper (TorLocker) encrypts all files with AES-256 + RSA-2048, in 70%+ cases they can be decryptedTweet
The file to be protected is encrypted by XORing with a certain key, and then injected into the protector's process. A large array of random bytes is stored in the protector's overlay.Partnership program
Trojan-Ransom.Win32.Scraper's builder (i.e. the program with which to create new samples of the Trojan with specified configuration) is distributed via a partnership program and sold for a few bitcoins. We found two posts about selling the builder for TorLocker 2.0 in the 'Evolution' (now taken down) underground online store:
The published screenshot of the builder suggests that the cybercriminal can change some of the encryptor's settings, as follows:
- Allow or block the launch of Task Manager or Process Explorer after infection;
- Allow or block the use of payment systems like BitCoin, PaySafeCard and Ukash to pay the ransom;
- Allow or block the removal of Windows recovery points;
- Modify the links from which to download tor.exe and polipo.exe; modify the names of these files after they are downloaded.
A screenshot of the builder's window
On the underground e-store's website, there are 11 reviews of the vendor of the Trojan-Ransom.Win32.Scraper builder, posted between 8 May 2014 and 17 January 2015.
By way of advertisement, news links are published about successful attacks performed using Trojan-Ransom.Win32.Scraper.
A brief description of TorLocker's operating principles and a comparison with CryptoLocker is also provided.Decryption
At the decryption stage, when the ransom payment is received, Trojan-Ransom.Win32.Scraper contacts the cybercriminals' C&C servers via the Tor network and the polipo proxy server, to receive a private RSA key. With this key, the Trojan decrypts the AES key for each encrypted file, and then decrypts the files.
Although Trojan-Ransom.Win32.Scraper encrypts all files with AES-256 + RSA-2048, in 70%+ cases they can be decrypted because of the errors made during the implementation of cryptography algorithms. To restore the original files, Kaspersky Lab has developed the ScraperDecryptor utility, which can be downloaded from Kaspersky Lab's technical support website.
Kaspersky Lab and INTERPOL recently presented research on how blockchain-based cryptocurrencies could be abused through the pollution of public decentralized databases with arbitrary data. During our presentation at the BlackHat Asia conference in Singapore, we demonstrated the proof-of-concept using the Bitcoin network, but it's important to understand that any cryptocurrency that relies on blockchain technology can be abused in this way.
Blockchain-based cryptocurrencies could be abused through the pollution of p2p databases with arbitrary dataTweet
Some believe that security researchers, especially those from the anti-malware industry, generally only publish threat reports after the discovery of a threat in the wild. However, this is not always true. Our current research focuses on potential future threats that could be prevented before cryptocurrencies are fully adopted and standardized. While we generally support the idea of blockchain-based innovations, we think that, as part of the security community, it is our duty to help developers make such technologies fit-for-purpose and sustainable.
Blockchainware, short for blockchain-based software, stores some of its executable code in the decentralized databases of cryptocurrency transactions. It is based on the idea of establishing a connection to the P2P networks of cryptocurrency enthusiasts, fetching information from transaction records and running it as code. Depending on the payload fetched from the network, it can be either benign or malicious.
The proof-of-concept code we demonstrated was a benign piece of softwareTweet
To ensure the accurate interpretation of our research, we would like to point out that in the anti-malware industry, there is a clear definition of what constitutes malware, and there are extremely strict policies in place that forbid any attempts to create or distribute malware. The proof-of-concept code we demonstrated was a benign piece of software that opened the Notepad application after getting a confirmation from the user.
So, what exactly did we demonstrate at BlackHat Asia? See for yourself at: https://www.youtube.com/watch?v=FNsqXHbeMco
As we pointed out during our presentation, possible solutions can be introduced at different layers. From the perspective of a company developing endpoint security solutions, we don't believe it's too much trouble to blacklist applications that load unpredictable external payload from a P2P network.
We believe that the value of solution development lies in its neutrality and decentralized decision-makingTweet
However, from the perspective of the cryptocurrency network, it's still an open question. We are not the experts in this field, and are therefore not best placed to propose effective solutions. We also don't want to promote any specific solution as we believe that the value of solution development (as in the case of Bitcoin) lies in its neutrality and decentralized decision-making.
That's why we suggest this is a project for the cryptocurrency community.
We don't promote any specific solution. We suggest this is a project for the cryptocurrency communityTweet
As a starting point for opening a discussion in the community, we suggest looking for an opportunity to implement a network consensus/negotiation algorithm that will sustain the clean state of the blockchain.
I would like to credit my co-speaker, Christian Karam (@ck4r4m), Cyber Threat Researcher from Interpol for coming up with idea for this research and going all the way to the stage at Blackhat and beyond.