Reply to thread

Managing script false positive detections (antimalware, AMSI, ASR).


Defender can detect/block scripts by several different security layers, for example:

  1. Antimalware (pre-execution) detection.
  2. AMSI-paired machine models (pre-execution) detection.
  3. AMSI-paired machine models (post-execution) detection.
  4. ASR rules.

False detections from points 1, 2, and 3 can be separately excluded via Security Center. The false positive ASR blocks can be excluded by using PowerShell, GPO, or ConfigureDefender.


Please note:  Post-execution AMSI-based detections cannot be avoided by adding path exclusions for scripts via Add-MpPreference PowerShell cmdlet (or Defender Policy via GPO)!


AMSI-based detections are similar to other behavior-based detections. AMSI is used to supply machine learning models with code in clear text to avoid string obfuscation.

In the pre-execution case, the code is scanned and the script is blocked if recognized as malicious by behavior models.

In the post-execution case, the code execution is monitored at the runtime and analyzed by dynamic behavior models. The execution is interrupted when the suspicious actions exceed the detection threshold.


Malicious scripts blocked by AMSI-paired machine models are reported in Microsoft Defender Security Center as follows (one year old classification):

  • Trojan:JS/Mountsi.?!ml
  • Trojan:Script/Mountsi.?!ml
  • Trojan:O97M/Mountsi.?!ml
  • Trojan:VBS/Mountsi.?!ml
  • Trojan;PowerShell/Mountsi.?!ml

[URL unfurl="true"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=mountsi[/URL]


Some scripts can be blocked by more than one detection.


Microsoft uses many other interesting script detections, for example:

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=Script[/URL]

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=powershell[/URL]

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=amsi[/URL]

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=ams[/URL]

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=:js/[/URL]

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=:vbs/[/URL]

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=bat[/URL]


Detecting Office macros:

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=w97m[/URL]

[URL unfurl="false"]https://www.microsoft.com/en-us/wdsi/threats/threat-search?query=o97m[/URL]


Post updated.

The problems with whitelisting and exclusions of AMSI-based detections were finally solved by Microsoft:

[URL unfurl="false"]https://malwaretips.com/threads/how-to-prevent-efficiently-defender-from-considering-a-given-vbs-script-as-containing-a-threat.107234/post-935955[/URL]


About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top