Senior threat researcher Sean Gallagher said in a detailed blog post that other methods included the use of obfuscation, encryption and steganography to avoid being outed.
But as Windows 10 and later versions of Windows Server had been increasingly put to use, the evasion of detection was being resorted to more and more.
AMSI, which was introduced in 2015, allows software to communicate with security products seeking scanning of files or memory, or streams of malicious payloads in a vendor-agnostic way, Gallagher explained.
"Windows third-party developers can leverage AMSI with their own applications as well, to allow anti-malware software to check for content passed to them that could turn their applications into 'LOLbins' (living off the land binaries) – applications abused for malicious purposes by malware or network intruders."
One way of avoiding an AMSI scan was to flip the flag on an attribute for PowerShell integration to "true", causing the process in question to stop requesting a scan. However, this was now being blocked as it was an old tactic.
"However, we did detect a recent use of the same bypass that connected to a remote server to obtain a PowerShell-based malware downloader," Gallagher noted. "This one appears to have been part of a Proxy Logon-based attack that attempted to load a Meterpreter backdoor DLL from a server in Russia."
He said about 98% of AMSI bypass attempts tampered with the code of the AMSI library. "In this attack, the malware locates the library AmsiScanBuffer in memory, and then overwrites the instructions at that address with new ones that redirect to an error message," Gallagher explained.
A third method that Gallagher detailed was fooling PowerShell into loading a counterfeit version of the amsi.dll file.
"Create an empty DLL named 'amsi.dll' in a target directory; copy PowerShell.exe to the same directory; launch evil PowerShell script, and AMSI scans attempted by the PowerShell.exe copy will fail because the fake DLL is loaded first," he explained.
"However, Microsoft has since made changes to PowerShell’s code that cause it to crash if the proper interfaces aren’t available in amsi.dll. In order for a DLL hijack of this type to work, the attacker now has to provide a counterfeit DLL with the required interfaces defined."
Finally, Gallagher said a fourth way of evading a scan by AMSI was to downgrade scripting engines to versions that were used before AMSI was available or else staying away from processes that interacted with AMSI altogether.
"Another way to evade AMSI is to bring along a scripting engine that doesn’t support it," he added. "While AMSI will detect anything leveraging the .NET framework, some malicious actors have brought along their own scripting host (such as a NodeJS engine), or have used compiled executables built from other scripting languages (such as Python).
"In extreme cases, we’ve seen attackers bring along entire virtual machines to conceal their scripts from detection. [Windows ransomware] Ragnar Locker, for example, deployed a VirtualBox virtual machine as part of a ransomware attack, concealing its processes from malware scanners entirely."