Remcos RAT Malware: Secure Your PowerShell Against Fileless Attacks

Featured Image: Prevent Remcos RAT virus from affecting Windows devices.

Windows users should be on high alert for the Remcos Remote Access Trojan (RAT). This malware deploys an incredibly stealthy payload through phishing, with no downloads required. One careless click on a malicious ZIP link, and the RAT springs into action, executing HTML applications through PowerShell. From there, it can capture screenshots, log keystrokes, and take full control of your system.

Here’s how to protect your PowerShell from Remcos RAT and any other fileless attacks.

How Remcos RAT Hijacks PowerShell to Take Over Your System

Security firm Qualys revealed the simplicity of the Remcos RAT attack. Victims receive a ZIP containing a deceptive LNK file, a Windows shortcut disguised as a real document. As of May 2025, attackers are using tax themed phishing emails, but future variants could use anything that tricks you into clicking links.

Once you open the LNK file, it activates a Windows application called mshta.exe (Microsoft HTML Application Host). Next, a PowerShell script, such as “24.ps1” launches a shellcode loader to execute the Remcos RAT payload in real time. The attack does not store any files on disk but operates entirely in memory.

Also, Microsoft Defender antivirus is unable to step into action while attackers create a remote TLS connection. They are currently linking to a command server called “ReadyRestaurants DOT com.” It’s flagged as “not secure” by Google Chrome. But this might change in the future.

"ReadyRestaurants", an infected site which serves as command center for Remcos RAT malware.

Important: Windows PowerShell has become a favorite tool for cybercriminals to carry out stealthy attacks that go undetected. Just last month, we saw it with Neptune RAT malware, which needed you to download a file first.

Prevent Remcos RAT from Executing in PowerShell

First, launch PowerShell in administrator mode. After this, check whether it is in unrestricted or restricted mode.

Get-ExecutionPolicy

If your device is set to restricted (which is usually the default), move on to the next step. Otherwise, first switch from unrestricted back to restricted. Click A when it asks you to confirm this change.

Set-ExecutionPolicy Restricted
Changing "Unrestricted" execution policy in PowerShell to "Restricted" ensuring for all users.

After implementing the above change, follow Qualys’ recommendations and set PowerShell to Constrained Language Mode. It blocks access to sensitive .NET methods and COM objects, which Remcos RAT and similar malware often exploit.

$ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage"

For best effect, ensure this setting applies to all users, including non-admin users, even if you’re the only one using the PC.

Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Restricted -Force
Setting "Constrained Language Mode" in PowerShell.

Qualys also recommends blocking suspicious PowerShell command-line arguments. This prevents precursor hidden scripts, like the HTA file in Remcos RAT attacks, from executing in the user’s PowerShell window.

Since Remcos RAT leverages PowerShell shellcode, there is a way to spot these commands. Unless it is already available on your PC, you may need to manually create a missing registry path for “PowerShell” and “ScriptBlockLogging.”

New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell" -Force
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" -Name "EnableScriptBlockLogging" -Value 1
Creating a missing registry path for "PowerShell" and "ScriptBlockLogging" in PowerShell.

Now, enable the “ScriptBlockLogging” command and set its value to 1. This prevents Remcos RAT and other malware from running shellcode loaders in PowerShell.

Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" -Name "EnableScriptBlockLogging" -Value 1
"ScriptBlockLogging" value set to 1 in PowerShell. This blocks unwanted scripts.

There is another related command to block suspicious command-line arguments using hidden scripts.

New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell" -Name "CommandLineFiltering" -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\CommandLineFiltering" -Name "EnableCommandLineFiltering" -Value 1
"Command Line Filtering" enabled in PowerShell

Good to know: the recent rise of AI-generated scripts in PowerShell has been a big factor in malware authors easily being able to create new scripts to target systems.

Note: some websites suggest disabling PowerShell for non-Admin users. We will not go to that extreme because using a non-Admin Windows account has many advantages. For one, it shields you from cyber threats that steal login credentials, such as NT LAN Manager (NTLM).

Disable MSHTA.exe to Prevent Remcos RAT from Executing

Remcos RAT uses a common system application on your Windows PC called “mshta.exe”. It is located in “C:\Windows\System32.”

Nowadays, disabling mshta.exe is perfectly fine. It is very rarely used, except in legacy applications such as Internet Explorer, or Office macro files. From Windows 11 version 24H2 onward, it has been completely deprecated.

mshta.exe Application file viewable in System32 folder.

Since mshta.exe operates HTML application (HTA) files, it is used to run VBScript or JavaScript outside browsers with full system privileges.

In Windows 11 Pro, type gpedit.msc in the Run command to go to Local Group Policy Editor. Go down this path: Computer Configuration -> Windows Settings -> Security Settings -> Software Restriction Policies.

Viewing "Software Restrictions Policies" under Local Group Policy Editor in Win 11 Pro.

If no policies exist, right-click to create a new security policy by selecting New Software Restriction Policies. Once it is created, under Additional Rules, right-click and select New Path Rule.

Right-click to add "New Path rule" to "Additional Rules" in Group Policy Security Settings.

Rename this path to C:\Windows\System32\mshta.exe. Set security level to Disallowed and click Apply -> OK.

On Windows 11/10 Home devices, which lack Group Policy Editor, there is another way. Launch Windows Security, and go to App & Browser Control -> Exploit Protection -> Exploit Protection Settings -> Program Settings. Here, click Add program to customize.

Click "Add program to customize" under Exploit Protection in Windows 11 Home.

The above will show two options. Click Choose exact file path. It will open your file explorer window. Navigate to the mshta.exe file location, and it will open in another pop-up window.

Now, you just have to toggle off all the mshta.exe policies which override the system precautions. If these have already been toggled off, you don’t have to do anything.

Toggling off all mshta.exe policies in Windows Security.

Related: solve the problem if Windows Security is not working on your device.

Other Methods to Prevent Remote Exploits in PowerShell

Here are some other things you can do to prevent Remcos RAT and other remote exploits from executing in PowerShell.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sayak Boral Avatar