A new variant of the Hive ransomware written using the Rust programming language is more evasive and provides attackers with flexibility, courtesy of support for command-line parameters.
Initially observed in June 2021, Hive is a ransomware-as-a-service (RaaS) that quickly became a prevalent threat. In May 2022, the ransomware gang launched a cyberattack on a Costa Rican government agency.
Just as many other ransomware operators out there, the cybercriminals behind Hive have been stealing victim data in addition to encrypting it, threatening to publish it online unless the victims would pay a ransom.
In February 2022, however, academic researchers from the Kookmin University of Seoul published a research paper on how a vulnerability in Hive’s encryption algorithm allowed them to recover the master encryption key and restore data without paying the ransom.
Around the same time, a new variant of Hive that was submitted to VirusTotal revealed that the ransomware’s developers had switched from the Go programming language to Rust, and that several upgrades to the threat made it more evasive, according to researchers with Microsoft Threat Intelligence Center (MSTIC).
The Rust-coded Hive variant uses a string encryption where constants used for decryption sometimes differ across samples, preventing detection, and supports command-line parameters, which increases flexibility by allowing the attackers to easily add or remove 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,” MSTIC said in a research note.
In addition, while the older Hive samples had the credentials for accessing the ransom payment website embedded, the new variant requires for the username and password to be supplied in the command line. The new variant also lacks a “help” menu, requiring for the attacker to know the supported parameters.
The Hive ransomware targets specific processes for termination, specifically those associated with security tools and other solutions that might hinder its operation, including Microsoft Defender. It also deletes backups, to prevent victims from recovering their data without paying a ransom.
The main change in the new ransomware variant, aside from the switch to Rust, is the use of a new cryptographic mechanism, which relies on “Elliptic Curve Diffie-Hellman (ECDH) with Curve25519 and XChaCha20-Poly1305 (authenticated encryption with ChaCha20 symmetric cipher),” Microsoft said.
“The new Hive variant uses a unique approach to file encryption. Instead of embedding an encrypted key in each file that it encrypts, it generates two sets of keys in memory, uses them to encrypt files, and then encrypts and writes the sets to the root of the drive it encrypts, both with .key extension,” according to Redmond’s research team.
To mitigate the risks associated with Hive and other ransomware, organizations and users alike are advised to adopt good credential hygiene, keep applications updated, use multi-factor authentication, and enable passwordless authentication for all supporting accounts, and to disable legacy authentication.