{"id":117287,"date":"2022-07-05T09:00:00","date_gmt":"2022-07-05T16:00:00","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/?p=117287"},"modified":"2023-10-13T07:31:57","modified_gmt":"2023-10-13T14:31:57","slug":"hive-ransomware-gets-upgrades-in-rust","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/07\/05\/hive-ransomware-gets-upgrades-in-rust\/","title":{"rendered":"Hive ransomware gets upgrades in Rust"},"content":{"rendered":"\n
\nApril 2023 update<\/strong> \u2013 Microsoft Threat Intelligence has shifted to a new threat actor naming taxonomy aligned around the theme of weather. DEV-0237 <\/strong>is now tracked as Pistachio Tempest<\/strong>.<\/p>\n\n\n\n
To learn about how the new taxonomy represents the origin, unique traits, and impact of threat actors, and to get a complete mapping of threat actor names, read this blog: Microsoft shifts to a new threat actor naming taxonomy<\/strong><\/a>.<\/p>\n<\/blockquote>\n\n\n\n
Hive ransomware is only about one year old, having been first observed in June 2021, but it has grown into one of the most prevalent ransomware payloads in the ransomware as a service (RaaS)<\/a> ecosystem. With its latest variant carrying several major upgrades, Hive also proves it\u2019s one of the fastest evolving ransomware families, exemplifying the continuously changing ransomware ecosystem.<\/p>\n\n\n\n
The upgrades in the latest variant are effectively an overhaul: the most notable changes include a full code migration to another programming language and the use of a more complex encryption method. The impact of these updates is far-reaching, considering that Hive is a RaaS payload that Microsoft has observed in attacks against organizations in the healthcare and software industries by large ransomware affiliates like DEV-0237<\/a>.<\/p>\n\n\n\n
Microsoft Threat Intelligence Center (MSTIC) discovered the new variant while analyzing detected Hive ransomware techniques for dropping .key<\/em> files. We know that Hive drops its encryption keys file, which contains encrypted keys used to decrypt encrypted files, and uses a consistent naming pattern:<\/p>\n\n\n\n
[KEY_NAME].key.[VICTIM_IDENTIFIER] \n(e.g., BiKtPupMjgyESaene0Ge5d0231uiKq1PFMFUEBNhAYv_.key.ab123)<\/pre>\n\n\n\nThe said .key<\/em> files were missing the [VICTIM_IDENTIFIER] part of the file name, prompting deeper analysis of the Hive ransomware that dropped them. This analysis led to the discovery of the new Hive variant and its multiple versions, which exhibit slightly different available parameters in the command line and the executed processes.<\/p>\n\n\n\n
Analyzing these patterns in samples of the new variants, we discovered even more samples, all with a low detection rate and none being correctly identified as Hive. In this blog we will share our in-depth analysis of the new Hive variant, including its main features and upgrades, with the aim of equipping analysts and defenders with information to better identify and protect organizations against malware attacks relying on Hive.<\/p>\n\n\n\n
Analysis and key findings<\/h2>\n\n\n\n
The switch from GoLang to Rust<\/h3>\n\n\n\n
The main difference between the new Hive variant and old ones is the programming language used. The old variants were written in Go (also referred to as GoLang), while the new Hive variant is written in Rust.<\/p>\n\n\n\n
Hive isn\u2019t the first ransomware written in Rust\u2014BlackCat, another prevalent ransomware, was the first. By switching the underlying code to Rust, Hive benefits from the following advantages that Rust has over other programming languages:<\/p>\n\n\n\n
\n
- It offers memory, data type, and thread safety<\/li>\n\n\n\n
- It has deep control over low-level resources<\/li>\n\n\n\n
- It has a user-friendly syntax<\/li>\n\n\n\n
- It has several mechanisms for concurrency and parallelism, thus enabling fast and safe file encryption<\/li>\n\n\n\n
- It has a good variety of cryptographic libraries<\/li>\n\n\n\n
- It\u2019s relatively more difficult to reverse-engineer<\/li>\n<\/ul>\n\n\n\n
String encryption<\/h3>\n\n\n\n
The new Hive variant uses string encryption that can make it more evasive. Strings reside in the .rdata<\/em> section and are decrypted during runtime by XORing with constants. The constants that are used to decrypt the same string sometimes differ across samples, making them an unreliable basis for detection.<\/p>\n\n\n\n
For example, let\u2019s look at the section where part of the string \u201c!error no flag -u <login>:<password> provided\u201d<\/em> is decrypted. In one sample (SHA-256: f4a39820dbff47fa1b68f83f575bc98ed33858b02341c5c0464a49be4e6c76d3), the constants are 0x9F2E3F1F and 0x95C9:<\/p>\n\n\n\n
Figure 1 \u2013 String decryption using constants 0x9F2E3F1F and 0x95C9<\/figcaption><\/figure>\n\n\n\n In another sample (SHA-256: 6e5d49f604730ef4c05cfe3f64a7790242e71b4ecf1dc5109d32e811acf0b053), the constants are 0x3ECF7CC4 and 0x198F: <\/p>\n\n\n\n
Figure 2 \u2013 String decryption using constants 0x3ECF7CC4 and 0x198F<\/figcaption><\/figure>\n\n\n\n Some samples do share constants when decrypting the same string. For example, let\u2019s look where the parameter string \u201c-da\u201d<\/em> is decrypted. In one sample (SHA-256: 88b1d8a85bf9101bc336b01b9af4345ed91d3ec761554d167fe59f73af73f037), the constants are 0x71B4 and 2:<\/p>\n\n\n\n
Figure 3 \u2013 String decryption using constants 0x71B4 and 2<\/figcaption><\/figure>\n\n\n\n In another sample (SHA-256: 33744c420884adf582c46a4b74cbd9c145f2e15a036bb1e557e89d6fd428e724), the constants are the same:<\/p>\n\n\n\n
Figure 4 \u2013 String decryption in a different sample also using constants 0x71B4 and 2<\/figcaption><\/figure>\n\n\n\n Command-line parameters<\/h3>\n\n\n\n
In old Hive variants, the username and the password used to access the Hive ransom payment website are embedded in the samples. In the new variant, these credentials must be supplied in the command line under the \u201c-u\u201d<\/em> parameter, which means that they can\u2019t be obtained by analysts from the sample itself.<\/p>\n\n\n\n
Figure 5 – Without a username and a password, the sample won\u2019t continue its execution<\/figcaption><\/figure>\n\n\n\n Like most modern ransomware, Hive introduces command-line parameters, which allow attackers flexibility when running the payload by adding or removing functionality. For example, an attacker can choose to encrypt files on remote shares or local files only or select the minimum file size for encryption. In the new Hive variant, we found the following parameters across different samples:<\/p>\n\n\n\n