Security Market Segment LS
Wednesday, 06 October 2021 09:56

Threat actors use Python script in swift ESXi ransomware attack

Threat actors use Python script in swift ESXi ransomware attack Image by Marcel Langthim from Pixabay

Attackers used a script written in Python during a recent ransomware attack which took just three hours, encrypting all the virtual disks on the target's virtual machine hypervisor.

Andrew Brandt, the principal researcher from global security company Sophos, said in a blog post that this resulted in taking all the organisation's VMs offline.

The ransom note was embedded in the script itself, he noted. The target was running VMware ESXi server.

ransom note sophos

The Python script embeds the text of the ransom note.

ESXi runs on bare metal unlike other VMware products and includes its own kernel. Initially, it included a Linux kernel, at which point it was known as ESX, but development was stopped at version 4.1, according to Wikipedia.

ESXi does not have a Linux kernel; its microkernel has three interfaces: hardware, guest systems and the service console.

Were ransomware to infect any VMs on an ESXi system, it could spread to Windows machines on the same network, as ESXi is often connected to Active Directory.

Brandt said the attackers had gained entry by logging into a TeamViewer account, which did not have MFA set up, on a PC where the user had Domain Admin credentials on the target network.

python script

The script embeds the file suffix it appends to encrypted files (ext), and email addresses (mail, mail2) to be used to contact the attacker for payment of the ransom as variables.

The login took place at half an hour after midnight and a tool called Advanced IP Scanner was downloaded 10 minutes later to identify other targets on the network.

By 2am, an SSH client called Bitvise was downloaded and used to log in to the VMware ESXi server. ESXi has a built-in SSH server called the ESXi Shell; this is disabled by default but in this case it had been enabled and not turned off.

The script used was just 6kb in size, and Brandt was impressed with what it could pack into that small space.

"Only 6kb long, the small size of the script belies its abilities," he wrote. "The script contains variables that the attacker can configure with multiple encryption keys, email addresses, and where they can customise the file suffix that gets appended to encrypted files."

Encryption keys are generated on the fly. "One thing that we noticed while walking through the code was the presence of multiple, hardcoded encryption keys, as well as a routine for generating even more encryption key pairs," Brandt noted.

esxi shell

ESXi management tools can enable or disable the ESXi Shell either from within the tool, or locally on the console connected to the server. The shell defaults to “Stopped.”

"Normally, an attacker would only need to embed the 'public key' that the attacker generated on their own machine and which would be used to encrypt files on the targeted computer(s). But this ransomware appears to create a unique key every time it is run."

In the case of this attack, there were three datastores, so three unique key pairs were generated.

Brandt pointed out that while malware that ran on a system like ESXi was rare, it was even more uncommon for detection tools to be installed on such endpoints.

"Hypervisors, in general, are often quite attractive targets for this kind of attack, since the VMs they host may run business-critical services or functions," he said.

Use of the ESXi Shell could be toggled on or off from either a physical console or through the normal management tools provided by VMware, Brandt said.

"Administrators should only allow the Shell to be active during use by staff, and should disable it as soon as maintenance (such as the installation of patches) is complete," he added.

Screenshots courtesy Sophos

Please join our community here and become a VIP.

Subscribe to ITWIRE UPDATE Newsletter here
JOIN our iTWireTV our YouTube Community here


It's all about Webinars.

Marketing budgets are now focused on Webinars combined with Lead Generation.

If you wish to promote a Webinar we recommend at least a 3 to 4 week campaign prior to your event.

The iTWire campaign will include extensive adverts on our News Site and prominent Newsletter promotion and Promotional News & Editorial. Plus a video interview of the key speaker on iTWire TV which will be used in Promotional Posts on the iTWire Home Page.

Now we are coming out of Lockdown iTWire will be focussed to assisting with your webinatrs and campaigns and assassistance via part payments and extended terms, a Webinar Business Booster Pack and other supportive programs. We can also create your adverts and written content plus coordinate your video interview.

We look forward to discussing your campaign goals with you. Please click the button below.



iTWire TV offers a unique value to the Tech Sector by providing a range of video interviews, news, views and reviews, and also provides the opportunity for vendors to promote your company and your marketing messages.

We work with you to develop the message and conduct the interview or product review in a safe and collaborative way. Unlike other Tech YouTube channels, we create a story around your message and post that on the homepage of ITWire, linking to your message.

In addition, your interview post message can be displayed in up to 7 different post displays on our the site to drive traffic and readers to your video content and downloads. This can be a significant Lead Generation opportunity for your business.

We also provide 3 videos in one recording/sitting if you require so that you have a series of videos to promote to your customers. Your sales team can add your emails to sales collateral and to the footer of their sales and marketing emails.

See the latest in Tech News, Views, Interviews, Reviews, Product Promos and Events. Plus funny videos from our readers and customers.


Sam Varghese

Sam Varghese has been writing for iTWire since 2006, a year after the site came into existence. For nearly a decade thereafter, he wrote mostly about free and open source software, based on his own use of this genre of software. Since May 2016, he has been writing across many areas of technology. He has been a journalist for nearly 40 years in India (Indian Express and Deccan Herald), the UAE (Khaleej Times) and Australia (Daily Commercial News (now defunct) and The Age). His personal blog is titled Irregular Expression.

Share News tips for the iTWire Journalists? Your tip will be anonymous