News: 1631916364

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Yes, of course there's now malware for Windows Subsystem for Linux

(2021/09/18)


Linux binaries have been found trying to take over Windows systems in what appears to be the first publicly identified malware to utilize Microsoft's Windows Subsystem for Linux (WSL) to install unwelcome payloads.

On Thursday, Black Lotus Labs, the threat research group at networking biz Lumen Technologies, said it had spotted several malicious Python files compiled in the Linux binary format ELF (Executable and Linkable Format) for Debian Linux.

"These files acted as loaders running a payload that was either embedded within the sample or retrieved from a remote server and was then injected into a running process using Windows API calls," Black Lotus Labs said in a [1]blog post .

[2]

In 2017, more than a year after the [3]introduction of WSL , Check Point researchers [4]proposed a proof-of-concept attack called Bashware that used WSL to run malicious ELF and EXE payloads. Because WSL wasn't enabled by default and Windows 10 didn't ship with any preinstalled Linux distro, Bashware wasn't considered a particularly realistic threat at the time.

[5]

[6]

Four years later, WSL-based malware has arrived. The files function as loaders for a payload that's either embedded – possibly created using open-source tools like MSFVenom or Meterpreter – or fetched from a remote command-and-control server and is then inserted into a running process via Windows API calls.

While the use of WSL is generally limited to power users, those users often have escalated privileges in an organization. This creates blind spots as the industry continues to remove barriers between operating systems

"Threat actors always look for new attack surfaces," said Mike Benjamin, Lumen vice president of product security and head of Black Lotus Labs, in [7]a statement .

"While the use of WSL is generally limited to power users, those users often have escalated privileges in an organization. This creates blind spots as the industry continues to remove barriers between operating systems."

If there's a bright side to this anticipated development, it's that this initial WSL attack isn't particularly sophisticated, according to Black Lotus Labs. Nonetheless, [8]the samples had a detection rate of one or zero in VirusTotal, indicating that the malicious ELFs would have been missed by most antivirus systems.

[9]

Black Lotus Labs said the files were written in Python 3 and turned into an ELF executable using [10]PyInstaller . The code invokes various Windows APIs to fetch a remote file and add it to a running process, thereby establishing access to the infected machine. Presumably a miscreant attacking a Windows system would need to get code execution within the WSL environment in the first place, somehow.

Two variants of the malware were identified. One was pure Python, the other was mostly Python but used the Python [11]ctypes library to connect to Windows APIs and run a PowerShell script. The Black Lotus Labs researchers theorize this second variant was still in development because it didn't run on its own.

One of the PowerShell samples had a kill_av() function that tries to disable suspected antivirus software using the Python os.popen() function in the subprocess module, for managing subprocesses. It also included a reverseshell() function that used a subprocess to run a Base64-encoded PowerShell script every 20 seconds within an infinite while True: loop to prevent other functions from running.

[12]

The one routable IP address (185.63.90[.]137) identified in the samples has been linked to targets in Ecuador and France that communicated with the malicious IP on ports 39000 through 48000 in late June and early July, the researchers said. They theorize that whoever is behind the malware was testing a VPN or proxy node.

Black Lotus Labs advises anyone who has enabled WSL to make sure logging is active to spot these sorts of incursions. ®

Get our [13]Tech Resources



[1] https://blog.lumen.com/no-longer-just-theory-black-lotus-labs-uncovers-linux-executables-deployed-as-stealth-windows-loaders/

[2] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2YUVkfWZqB14ZHw27iWwbzQAAAEg&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[3] https://www.theregister.com/2016/03/30/bash_shell_comes_to_windows_10/

[4] https://www.theregister.com/2017/09/12/microsoft_downplays_bashware_malware_threat/

[5] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44YUVkfWZqB14ZHw27iWwbzQAAAEg&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[6] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33YUVkfWZqB14ZHw27iWwbzQAAAEg&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[7] https://news.lumen.com/2021-09-16-Theory-confirmed-Lumen-Black-Lotus-Labs-discovers-Linux-executable-files-have-been-deployed-as-stealth-Windows-loaders

[8] https://github.com/blacklotuslabs/IOCs/blob/main/WSL%20samples.txt

[9] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44YUVkfWZqB14ZHw27iWwbzQAAAEg&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[10] https://www.pyinstaller.org/

[11] https://docs.python.org/3/library/ctypes.html

[12] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33YUVkfWZqB14ZHw27iWwbzQAAAEg&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[13] https://whitepapers.theregister.com/



So, let's summarise this..

Anonymous Coward

Microsoft's main "contribution" to Linux is to make it less safe, at least when used on Microsoft platforms.

Is this the "Extinguish" phase?

Re: So, let's summarise this..

jake

Re-read the FA.

Microsoft's new "contribution" to Windows security is to make it less safe by increasing the size of the attack surface with a subsystem (WSL) that they don't understand.

It's not the Linux side of things that's vulnerable, it's the Windows API that it has access to.

Re: So, let's summarise this..

Lorribot

Actually this is dumb arse developers developing in an insecure environment (Windows/Linux does not matter) it is their laptop that they use for all that other shit like web surfing that is the attack vector but feel free to blame Microsoft for your own inadequate security practices.

Re: So, let's summarise this..

bombastic bob

blame Microsoft for your own inadequate security practices.

like NOT using a non-Windows OS to surf the web or read e-mail?

(yes! I think that WOULD be Micros~'s fault at some level...)

Microsoft! Leave our Linux alone!!!

A random security guy

This MS; with its big bear hug. Maybe the Linux community should wake up and tell MS that they should not do this crazy stuff any more.

Re: Microsoft! Leave our Linux alone!!!

jake

Again, it's not Linux that is the issue. It's Windows API(s?) allowing the Linux subsystem to access it all willy-nilly which is the problem.

FIA

Does this work with WSL2?

The original attack used the pico processes of WSL1 (where linux binaries were run as windows processes), but most modern WSL distros will be using WSL2s virtual machine implementation.

Anyone surprised?

oiseau

Four years later, WSL-based malware has arrived.

Ahh ...

Is ANYONE bloody $#%&= surprised?

Like I posted just five months ago:

---

Pirate Dave wrote: ... trusting Microsoft in anything Linux-related just seems like a Bad Idea.

It does not seem like a Bad Idea: it is a Bad Idea.

But it's not old-skool thinking or old anything for that matter.

After all the crap the IT world has seen from MS in the past 30+ years?

It is nothing but good old common sense.

The kind that comes from having learnt from experience plus the wisdom accrued from years of IT work.

And I'll quote myself:

"Anything 'Windows for Linux' is nothing but a cancer out to get at the Linux ecosystem from inside out.

But the writing has been on the wall for ages, only that the (intellectually) blind refuse to see it and find it all so convenient .

One day it will be too late."

---

And as you can gather, too late is slowly creeping upon us.

There's no way any of this MS rubbish is going near my Linux boxes.

O.

Re: Anyone surprised?

matjaggard

That's really not true, WSL opens a lot of opportunities, I'd be surprised if this even affects WSL2 and privileged escalation is already an issue in other areas anyway.

And even if it was true, Linux just needs to get better on the desktop because currently it's horrible. Makes the two windows interfaces look almost consistent when you run a GTK next to a QT.

I've given up now after a decade of Linux desktop and gone to Mac (which also has irritating parts like missing keyboard shortcuts but it's faster than Windows and better than Linux)

Re: Anyone surprised?

bombastic bob

WSL opens a lot of opportunities

an officially blessed Win32 subsystem for Linux would open up even MORE...

(and if properly configured, NOT have those nagging windows-related vulnerabilities)

Lorribot

I watched a AWS presentation on Containerisation and the stand out slide was the one that said all development work started with the developer laptop.

You reap what you sow and if you open your door to everyone don't be surprised who walks in.

"I'd love to go out with you, but I have to stay home and see if I snore."