Skip Navigation
BlackBerry Blog

ESXiArgs Ransomware: Knocking Out Unpatched VMware ESXi Linux Servers Worldwide

Summary

A new ransomware, ESXiArgs ransomware, is targeting unpatched VMware ESXi servers connected to the Internet. The attackers utilize a two-year-old unauthenticated RCE exploit, CVE-2021-21974, to cause a heap overflow in the OpenSLP service.

Vulnerable systems include any systems running the following:

  • ESXi versions 7.x prior to ESXi70U1c-17325551
  • ESXi versions 6.7.x prior to ESXi670-202102401-SG
  • ESXi versions 6.5.x prior to ESXi650-202102101-SG

The threat actor is targeting victims globally. At the time of writing, at least 1,062 systems are seen as compromised, according to these Shodan search results:

Figure 1 – Encrypted VMware ESXi servers (Source: Shodan)

Once compromised, a shell script is used to execute the encryptor and deliver the ransom note. The requested amount is for approximately $48,000 worth of BTC (2.092716 BTC) at today's trading price. 

Figure 2: Ransom note

The majority of infections occurred between Friday, February 3, and Monday, February 6.

Weaponization and Technical Overview

Weapons

Exploits, Shell script, ELF binaries

Attack Vector

Vulnerabilities exploitation

Network Infrastructure

TOX

Targets

Unpatched Internet-facing VMware ESXi servers


Technical Analysis

Context

CVE-2021-21974 is used to compromise victims and deliver files to the ESXi server.

Once compromised, a handful of files are placed in the /tmp folder on the server:

  • encrypted – ELF Encryptor
  • encrypted.sh – Shell script managing attack flow, including executing the encryptor
  • public.pem – Public RSA encryption key
  • motd – Ransomware note
  • index.html – Ransomware note

sha-256

md5

10c3b6b03a9bf105d264a8e7f30dcab0a6c59a414529b0af0a6bd9f1d2984459

d0d36f169f1458806053aae482af5010

File Name

encrypt.sh

File Size

3685 bytes

File Type

Shell script


Encrypted.sh has the following control flow:

1.      Change VMX config file names
2.      Kill running VMX processes
3.      Iterates over storage volumes and encrypts files with .vmxf, .vmx, .vmdk, .vmsd, and .nvram file extensions.
4.      Replaces index.html, copying the original to index1.html
5.      Replaces motd, copying the original to /etc/motd1
6.      Deletes all originals of encrypted files.

Figure 3 – encrypt.sh first lines

During the encryption loop, the script looks for files with the appropriate extensions, then creates a “$file_e.args” file containing the size step, “1”, and the file size, which are also used as arguments for the encrypt binary.

The encryptor takes several arguments:

encrypt <public_key> <file_to_encrypt> [<enc_step>] [<enc_size>] [<file_size>]

The encryptor assumes the public key, public.pem, is a public RSA key. A 32-bit random dword is generated and used as the encryption key in the secure cipher stream Sosemanuk. The key is then encrypted with the RSA key and appended to the end of the encrypted file. The Sosemanuk algorithm is an interesting choice, since it has only been used in ransomware derived from the Babuk source code leak.

During cleanup the script appears to remove a Python file at /store/packages/vmtools.py that has a similar file path to a custom backdoor used in a compromise that Juniper covered back in December 2022.

sha-256

md5

11b1b2375d9d840912cfd1f0d0d04d93ed0cddb0ae4ddb550a5b62cd044d6b66

87b010bc90cd7dd776fb42ea5b3f85d3

File Name

1.elf

File Size

48694 bytes

File Type

ELF x64


Targets

Based on the Shodan visibility, there are more than one thousand compromised servers worldwide, and it's growing. The highest number of compromised VMware ESXi servers are in the United States, France, and Germany.

Figure 4: Map showing compromised VMware ESXi servers (Source: Shodan)

Conclusions

VMware ESXi hypervisor servers are a special target for threat actors. Disruption causes escalating damage multiplying the initial impact by tens or hundreds. The recent ESXiArgs ransomware attack proves that no Linux® systems are safe from attack, especially if they are unpatched and connected to the Internet.

Prompt patching must become a standard procedure for all organizations worldwide. Effective threat modeling and actionable, anticipative, and contextual cyber threat intelligence may help significantly lessen the risks of becoming a target.

For similar articles and news delivered straight to your inbox, subscribe to the BlackBerry blog.

Remediation

A patch for the vulnerability, assigned CVE-2021-21974, was issued in February 2021. Government agencies and cybersecurity experts are urging administrators to update unpatched servers immediately.

APPENDIX 1 – Applied Countermeasures

Yara Rules

import "pe"

rule cybercrime_Ransom_ESXi_Attacks : ELF
{
    meta:
        description = "Rule to Detect ELF ESXi Ransomware Attacks"
        author = "The BlackBerry Research & Intelligence team"
        distribution = "TLP:White"
        version = "1.0"
        last_modified = "2023-02-06"
        md5 = "87b010bc90cd7dd776fb42ea5b3f85d3"
        sha256 = "11b1b2375d9d840912cfd1f0d0d04d93ed0cddb0ae4ddb550a5b62cd044d6b66"

     strings:

        $a1 = "file size in bytes (for sparse files)" fullword nocase wide ascii
        $a2 = "number of MB in encryption block" fullword nocase wide ascii
        $a3 = "number of MB to skip while encryption" fullword nocase wide ascii

    condition:
        uint32(0) == 0x464C457F and filesize < 500KB and all of ($a*)

}

import "pe"

rule cybercrime_Ransom_ESXi_Attacks_code : ELF
{
    meta:
        description = "Rule to Detect ELF ESXi Ransomware Attacks based on a unique piece of code"
        author = "The BlackBerry Research & Intelligence team"
        distribution = "TLP:White"
        version = "1.1"
        last_modified = "2023-02-06"
        md5 = "87b010bc90cd7dd776fb42ea5b3f85d3"
        sha256 = "11b1b2375d9d840912cfd1f0d0d04d93ed0cddb0ae4ddb550a5b62cd044d6b66"
    strings:
        $4226332_501 = { 8B ?? ?? ?? ?? ?? 89 ?? ?? ?? ?? ?? 8B ?? ?? 89 ?? ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 03 ?? ?? 89 ?? ?? 8B ?? ?? ?? ?? ?? 69 ?? ?? ?? ?? ?? 89 ?? ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? C1 ?? ?? 89 ?? ?? 8B ?? ?? 89 ?? ?? 8B ?? ?? 89 ?? C1 ?? ?? 8B ?? ?? C1 ?? ?? 89 ?? 8B ?? ?? ?? ?? ?? ?? 89 ?? 31 ?? 8B ?? ?? 89 ?? C1 ?? ?? 0F B6 ?? ?? 89 ?? 8B ?? ?? ?? ?? ?? ?? 31 ?? 31 ?? 33 ?? ?? 89 ?? ?? 8B ?? ?? 03 ?? ?? 33 ?? ?? 89 ?? ?? 8B ?? ?? 89 ?? ?? 8B ?? ?? 21 ?? ?? 8B ?? ?? 31 ?? ?? 8B ?? ?? 31 ?? ?? 8B ?? ?? 31 ?? ?? 8B ?? ?? 09 ?? ?? 8B ?? ?? 31 ?? ?? 8B ?? ?? 31 ?? ?? 8B ?? ?? 89 ?? ?? 8B ?? ?? 09 ?? ?? 8B ?? ?? 31 ?? ?? 8B ?? ?? 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? ?? 0F B6 ?? ?? 89 ?? 8B ?? ?? ?? ?? ?? ?? 31 ?? 31 ?? 33 ?? ?? 89 ?? ?? 8B ?? ?? 03 ?? ?? 33 ?? ?? 89 ?? ?? 8B ?? ?? 83 ?? ?? 84 ?? 74 }
        $4200033_119 = { 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? C7 ?? ?? ?? ?? ?? ?? ?? ?? ?? C7 ?? ?? ?? ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? 48 ?? ?? ?? 48 ?? ?? 48 ?? ?? ?? 48 ?? ?? 48 ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? 48 ?? ?? 48 ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? ?? 0F 85 }
        $4199927_43 = { 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? 0F 83 }
        $4227171_39 = { 5? 48 ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 8B ?? ?? ?? ?? ?? 83 ?? ?? 0F 87 }
        $4226905_35 = { 5? 48 ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 48 ?? ?? ?? 8B ?? ?? ?? ?? ?? 83 ?? ?? 0F 87 }
        $4200458_24 = { 48 ?? ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 0F 82 }

    condition:
        uint32(0) == 0x464C457F and filesize < 500KB and 8 of them
}

import "pe"

rule cybercrime_Ransom_ShellScript_ESXi_Attacks : SH
{
    meta:
        description = "Rule to Detect Shell Script in ESXi Ransomware Attacks"
        author = "The BlackBerry Research & Intelligence team"
        distribution = "TLP:White"
        version = "1.0"
        last_modified = "2023-02-06"
        md5 = "d0d36f169f1458806053aae482af5010"
        sha256 = "10c3b6b03a9bf105d264a8e7f30dcab0a6c59a414529b0af0a6bd9f1d2984459"

     strings:

        $a1 = "KILL VMX" fullword nocase
        $a2 = "START ENCRYPT:" fullword nocase
        $a3 = "/bin/grep encrypt | /bin/grep -v grep" fullword nocase

    condition:
       uint16(0) == 0x2123 and filesize < 50KB and all of ($a*)

}

 

Related Reading:

The BlackBerry Research & Intelligence Team

About The BlackBerry Research & Intelligence Team

The BlackBerry Research & Intelligence team examines emerging and persistent threats, providing intelligence analysis for the benefit of defenders and the organizations they serve.