标题 简介 类型 公开时间
关联规则 关联知识 关联工具 关联文档 关联抓包
参考1(官网)
参考2
参考3
详情
[SAFE-ID: JIWO-2025-2349]   作者: ecawen 发表于: [2019-04-07]

本文共 [499] 位读者顶过

近日一家公司遭到勒索软件Dridex攻击,其模块为IEncrypt变种。攻击始于一封网络钓鱼邮件,其附带Office文件,启用恶意宏后将触发勒索软件安装,然后进行横向移动,最后以该公司内数百个Windows站点被勒索软件加密告终。该勒索软件功能包括加载DLL文件和获取所需进程地址,使用AES对文件加密,使用RSA对密钥加密,加密密钥存储在一个名为._readme的相邻文件中。研究人员还发布了免费IEncrypt解密工具。

Recently, Guardicore was asked to assist a company whose network was heavily damaged by ransomware. The attack started with a phishing email, proceeded with lateral movement and ended with hundreds of Windows stations within the organization encrypted by ransomware. The attack is attributed to the Dridex family and the ransomware module was the IEncrypt variant.

The attacked company made a decision to pay the attacker in exchange for obtaining a decryption software. However, even with the decryptor at hand, the company wanted to guarantee that the purchased file included no malicious functionality.

This post will describe what we know of the attack timeline and the parts of our investigation that we can publish. We will provide a close look into the technical details of IEncrypt and our own implementation of the IEncrypt decryptor.

[出自:jiwo.org]

Timeline

The attack started in mid March with a phishing email sent to a company employee. Eleven hours later, the employee opened a malicious Office file attached to the email. Opening the file triggered malware installation, providing the attackers with initial network foothold. Within eight days, the attackers managed to gain control of the company’s network and encrypt files on over 200 endpoints and 30 servers belonging to the organization. The activation of the ransomware occurred on a Thursday night after 1AM, when no one was available to notice the extremely irregular network behavior.

Timeline of the IEncrypt ransomware attack. Describing how hundreds of Windows stations were encrypted within eight days of opening the infected email and the steps taken to restore the network, receiving the decryptor and analyzing it and conclude the investigation

The Attack Timeline

At this point, our partner Ideal Integrations was called in to assist the victim company. Ideal helped the victim make two decisions. The first was to rebuild their entire infrastructure from scratch over the weekend. The second was to pay the ransom in order to allow the company to continue operation.

After working throughout the weekend reconstructing their network, Ideal called Guardicore Labs to assist with the incident response investigation. Our initial task was to build a timeline of the attack and analysing the decryptor provided by the attackers. As part of the analysis, we wrote our own safe-decryptor tool to bypass the attackers’ executable.


The Triggering Email

The malicious email appeared to be a reply to a message initially sent by the employee. It contained a protected ZIP file and the password to open it. The email was signed by a person allegedly working for a company located in the same state as the victim company. The employee opened the attachment, which included a macro enabled Word document. Once executed, the macro downloaded additional malware. In any modern version of Office software, the user would have to explicitly confirm running the macro, but as experience shows, this is not a good way to block execution.

Investigating the malicious document, we discovered the following orphaned strings hidden inside the file. However, we should be careful in reaching any conclusions based on the strings.

The document contains many orphaned strings. Their source is unknown.

The document contains many orphaned strings. Their source is unknown

An antivirus software installed in the organization’s network detected malicious activity and alerted on malicious files originating from the employee’s machine, the antivirus software identified the files as belonging to Dridex. However, this alert was not followed up and the attackers continue to work their way into the rest of the network. Once inside the network, the attackers started reconnaissance and lateral movement actions.


Under Attack

With control over the network, they initiated the last phase of their attack – encrypting every file they could find OS system files were left out of encryption scope. This allowed the machines to run while the access to users’ data was blocked. A combination of proper encryption methods, along with control over most of the network, including the backup servers, meant that the attackers shut down operations in the network.

IEncrypt Ransom Note

IEncrypt Ransom Note

Based on publications and a recent report on a ransomware attack against Arizona Beverages, Guardicore Labs team believes the attacking ransomware was an IEncrypt sample. Evidence to support this assumption includes:

  • The ransom note format (“Your network was hacked and encrypted”) – this is the exact same wording used for the ransom note displayed on Arizona Beverages’ computers.
  • The encrypted files’ extension contained the company’s name – a known characteristic of the IEncrypt ransomware.

With the majority of their data encrypted, the customer had no other choice but to pay the ransom. After some BitCoins exchanged hands the decryptor was provided by the attackers.


IEncrypt Decryptor Analysis

We decided to reverse engineer the decryptor in the hope of better understanding its capabilities. Our goal was to make sure the executable performed decryption, and decryption only.

A basic observation of the decryptor disassembly did not prove to be helpful; there were few strings and only one imported Windows API function – MessageBox.

The immediate conclusion was that like many other malware samples in the wild, the malware author implemented their own functions for:

  • Loading DLL files (equivalent to Windows APIs LoadLibrary); and
  • Fetching the required processes’ addresses (equivalent to Windows APIs GetProcAddress).

In such implementations, the names of libraries and functions are not hard-coded in plaintext. Instead, each string is represented by a hashed value.
For the sake of simplicity, we will refer to these implementations as MyLoadLibrary and MyGetProcAddress.

To short-circuit a long process, we want to know which DLLs and functions were being used. To do that, we could have figured out the hashing algorithm, run it on a large number of system functions and search for hashes residing in the decryptor binary. However, we chose a quick-and-dirty way this time. We used windbg to put two breakpoints: one on the entry point of MyLoadLibrary function and the other on the following call to the address returned by MyLoadLibrary. This allowed us to monitor module-loading and Windows API calls in runtime.

windbg commands to print out the names of imported functions

windbg commands to print out the names of imported functions

At this point we had a list of the functions imported by the decryptor module. The attacker relied exclusively on Windows API calls for the decryption process – mainly from crypt32.dll and advapi32.dll – which made it fairly easy to collect all relevant information without even reading the code. For example, to extract the attackers private key, we observed calls to CryptStringToBinaryA and the subsequent call to CryptImportKey.

windbg output providing us the decryption key

windbg output providing us the decryption key

Like most ransomware today, IEncrypt uses a combination of both symmetric and asymmetric encryption. The IEncrypt process works as follows for each file:

  1. Each file is encrypted using an AES symmetric key. This key is generated by the ransomware per file.
  2. This key is then encrypted using an RSA public key which is baked into the malware.
  3. The encrypted key is stored in an adjacent file, named:  [._readme]
The end result of the ransomware process on specific files

The end result of the ransomware process on specific files


Recreating the Decryptor

According to our analysis, the RSA private key used for decryption cannot be obtained without the attacker’s decryptor, leaving the victim with only one option to recover their files. However, even after paying the ransom and receiving the decryptor program, the victim was still wary.
How can the victim make sure the decryptor program doesn’t have additional functionality, such as leaving backdoors or adding malicious payloads to the decrypted files?

For these reasons, we chose to create our own safe IEncrypt decryptor program and provide it to the targeted company. In addition, we decided to publish this tool, named pasta, since we believe it will be of value to others. You can download it here, free of charge. Our tool is written in plain Win32 C and recreates the attackers decryptor routine.

To run the tool, you must provide the decryption key and the file extension appended to the encrypted file as command line arguments. At time of writing, to recover the decryption key, some manual reverse engineering is required.

pasta -e <.extext> -k  [-f] 
    -e  encrypted file extension (starting with '.' character
    -k  path to private key to use for decryption
    -f  force overwrite of existing decrypted file
    -h  show this help

Prevention

To prevent the initial breach, employees should be trained to not click on links or download attachments in emails that look suspicious in any way. Alternatively, companies can use cloud mail providers with such protection integrated.

However, breaches are inevitable and mistakes will most likely exist somewhere in the network. Consider applying micro-segmentation policies anywhere your applications run. This will reduce the attack surface and prevent lateral movement.

In addition, apply multiple backup layers, both online and offline. Online backups were not enough in this case, the attackers reached the backup servers as well. In addition, practice recovering backup files in different disaster scenarios.

Finally, do not assume the attack is over once the ransom is paid and files are decrypted. Run a thorough investigation to understand the attack vector and scope and the consequences that enabled it. Before running a binary file sent by the same people who just created mayhem for your organization, make sure the code is safe to run.


Conclusion

Ransomware is still a serious threat to organisations around the world, as attackers constantly evolve. The IEncrypt ransomware attack seems to be related to a recent spate of attacks on different companies connected to the Bitpaymer ransomware.

Ransomware is typically part of a larger attack. As recent publications show, ransomware is used to cover the attackers tracks, hiding data breaches or other parts of the infection.

When in need, don’t hesitate to reach out to Guardicore Labs for assistance. If your company operates in the area of Pittsburgh, Ideal Integrations are definitely your go-to guys.

评论

暂无
发表评论
 返回顶部 
热度(499)
 关注微信