Ondata di Attacchi Contro Aziende Italiane (Ursnif)

Proto: N020919.

Con la presente Yoroi desidera informarLa riguardo al rilevamento di una pericolosa campagna di attacco in corso ai danni di utenti ed Aziende italiane. I messaggi di posta inviati dai cyber criminali contengono riferimenti a ipotetici documenti e fatture fittizie, ed invitano la vittima ad aprire un foglio Excel in grado di infettare la macchina con un impianto malware della famiglia Ursnif (TH-124), minaccia in grado di intercettare digitazioni da tastiera, trafugare le password salvate ed alterare la navigazione web utente.

Figura. Esempio documento malevolo

Di seguito si riportano gli indicatori di compromissione estratti durante le analisi condotte:

Yoroi consiglia infine di mantenere alto il livello di consapevolezza degli utenti, avvisandoli periodicamente delle minacce in corso e di utilizzare un team di esperti per salvaguardare la sicurezza del perimetro "cyber". Per avere un indice di minaccia in tempo reale si consiglia di visitare il seguente link: Yoroi Cyber Security Index

JSWorm: The 4th Version of the Infamous Ransomware


The ransomware attacks have no end. These cyber weapons are supported by a dedicated staff that constantly update and improve the malware in order to make harder detection and decryption. As the popular GandCrab, which was carried on up to version 5 until its shutdown, also other ransomware are continuously supported with the purpose of creating revenues for cyber criminals. One of them is JSWorm, which has been updated to version 4. 

Despite the name could reminds to JavaScript language and a possible “worm” logic, the malware does not include either of the two characteristics.

Technical Analysis

Brief DescriptionJSWorm 4.0.2

Table 1: Information about JSWorm 4.0.2 version

JSWorm encrypts all the user files appending a new extension to their name. Unlike other ransomware, the extension is composed by many fields, reporting the information the user needs to move on the ransom payment phase. These fields are the same shown in the ransom note, that are: "Filename.originalExtension.[Infection_ID][Attacker_email].JSWRM"

Figure 1: Infection ID and Contact E-mail 

Moreover, in the ransom note there is also a backup email, “[email protected], to ensure availability in case of blacklisting. During the encryption phase, the ransomware creates an HTML Application “JSWRM-DECRYPT.hta” in each folder it encounters. The HTA file corresponds to the ransom window shown in Figure 1.

To ensure the correct machine functionalities, the ransomware excludes from the encryption phase several system directories (Windows, Perflogs) and junction points like Document and Settings, $RECYCLE.BIN, System Volume Information, MSOCache. Also, for each encountered file, the malware compares it with the excluded paths and if they match, a conditional jump is taken.

Figure 2: Excluded paths

Unlike most ransomware, JSWorm does not embed a list of file extensions to encrypt, but uses a set of extensions to exclude during the cipher step. The malware encrypts all the files whose extension is not present in the list.

Figure 3: Extensions excluded from encryption

Figure 4: Content of “key” file contained in “C:\ProgramData”

During the encryption phase, JSWorm writes a suspicious file named “key.Infection_ID.JSWRM” in “C:\ProgramData”. It contains the AES key used to encrypt the files. Unfortunately, the key is processed with an additional RSA encryption step before its storing. The following figure shows an example of the encrypted key. 

Moreover, to maximize the impact of the encryption phase, the ransomware:

The commands invoked by JSWorm to perform the above mentioned actions are:

vssadmin.exe delete shadows /all /quietDelete the Shadow Volume Copies
bcdedit /set {default} bootstatuspolicy ignoreallfailures -yDisable Windows Error Recovery on startup
bcdedit /set {default} recoveryenabled No -yDisable Automatic Startup Repair
wbadmin delete catalog -quietDelete the backup catalog
wmic shadowcopy delete -yAnother attempt to delete the Shadow Volume Copies
/c reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "zapiska" /d "C:\ProgramData\JSWRM-DECRYPT.txt" -ySet persistence on startup
/c taskkill.exe taskkill /f /im store.exeKill “store.exe” process (related to MS Exchange)
/c taskkill.exe taskkill /f /im sqlserver.exeKill “sqlserver.exe” process
/c taskkill.exe taskkill /f /im dns.exeKill “dns.exe” process
/c taskkill.exe taskkill /f /im sqlwriter.exeKill “sqlwriter.exe” process

Table 2: Commands executed by the malware

An example of how the malware invokes the commands using the “ShellExecuteA” API is shown in the following figure.

Figure 5: Disassembled routine for shadow copies deleting

The Encryption Scheme

The AES key the malware encrypt is generated starting from an embedded Base64 seed “MI2i6BWRFhcswznItBEl33UaIoDOwqI=”, which is converted into a byte array through CryptStringToBinaryA API before proceeding with low-level manipulation.

Figure 6: Embedded initial string used to generate AES key

The fixed string is combined with a random one to make the derived AES key different for each infection. Not even the malware writer knows the final AES key to decrypt the files, so when the user asks to recover his files, he must send the key file stored in “C:\ProgramData”. On the other side, the attacker will receive the file, then he will decrypt the content using his private RSA key and will proceed to extract the AES key useful to decrypt the user files.

To encrypt the AES key, JSWorm uses an RSA public key embedded into it in Base64 form, as shown in the following figure.

Figure 7: RSA-1 public key in Base 64 encoding (on the left) and in binary encoding (on the right)

The control flow used to encrypt the AES key is based on Windows Cryptography API, as visible in the following figure.

Figure 8: Entire control flow to encrypt the AES key

After decoding of RSA public key and the initialization of a new PROV_RSA_FULL cryptographic service provider (CSP) through the “CryptAcquireContextA” function, the ransomware import the decoded RSA key using the “CryptImportKey” API. 

Figure 9: Imported RSA key through “CryptImportKey” API

The last step is the encryption routine, which is done using the “CryptEncrypt” function, as shown in the following figure.

Figure 10: Parameters for the “CryptEncrypt” function

A funny piece of the malware code is the Russian string used to instantiate a new mutex, “kto prochtet tot sdohnet =)” which means “who reads will die =)”.

Figure 11: Mutex creation


The analyzed case has features in common with most ransomware like encryption scheme, the deletion of shadow copy and persistence. About the encryption scheme, the ransomware uses an AES key generated starting from an embedded Base64 seed which is converted into a byte array through CryptStringToBinaryA API. It is very common to find Ransomware relying on this library (CryptoAPI) for cryptographic task mainly for reliability and for reducing time for development.

Another interesting element is the presence of a mutex containing the string “kto prochtet tot sdohnet =)” in Russian language. This leads us to think that the authors could have Russian hands. Obviously, this could also be a false flag, but the Russian underground have a long tradition in such kind of cyber-crime activities: in fact, according to an Anton Ivanov research, senior malware analyst at Kaspersky Lab, even back in 2016 the Russian underground gave birth to about the 75% of the new crypto-ransomware tracked in that year, evidence of a consolidated malware writing capability.

Indicator of Compromise

Yara Rule

rule JSWorm_4.0.2_July_2019 {
      description = "Yara rule for JSWorm 4.0.2"
      author = "Yoroi - ZLab"
      last_updated = "2019-08-27"
      tlp = "white"
   	 category = "informational"
   	 $a1 = "Total size of files must be less than 5MB"
   	 $a2 = "BORw0KGgoAAAANSU"
   	 $a3 = {FA 39 2E 3A 3A 3A 41 3A 68}
   	 $a4 = {19 38 12 39 2E 39 26 3A}
   	 $a5 = {32 DC 32 F0 32 0C 33}
   	 $a6 = "vssadmin.exe"
   	 $a7 = "wmic shadowcopy"
   	 $a8 = "MI2i6BWRFhcs"
   	 $a9 = {4D CC 2B C1 83 F8}
   	 $a10 = {FF 83 C8 FF 5D C3 8B 40}
   	 4 of ($a*)

This blog post was authored by Antonio Farina, Davide Testa and Antonio Pirozzi.