Modification of AmsiEnable Registry Key

Identifies modifications of the AmsiEnable registry key to 0, which disables the Antimalware Scan Interface (AMSI). An adversary can modify this key to disable AMSI protections.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2021/06/01"
  3integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel"]
  4maturity = "production"
  5updated_date = "2024/10/15"
  6min_stack_version = "8.14.0"
  7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Identifies modifications of the AmsiEnable registry key to 0, which disables the Antimalware Scan Interface (AMSI). An
 13adversary can modify this key to disable AMSI protections.
 14"""
 15from = "now-9m"
 16index = ["winlogbeat-*", "logs-endpoint.events.registry-*", "logs-windows.sysmon_operational-*", "endgame-*", "logs-m365_defender.event-*", "logs-sentinel_one_cloud_funnel.*"]
 17language = "eql"
 18license = "Elastic License v2"
 19name = "Modification of AmsiEnable Registry Key"
 20note = """## Triage and analysis
 21
 22### Investigating Modification of AmsiEnable Registry Key
 23
 24The Windows Antimalware Scan Interface (AMSI) is a versatile interface standard that allows your applications and services to integrate with any antimalware product on a machine. AMSI integrates with multiple Windows components, ranging from User Account Control (UAC) to VBA macros and PowerShell.
 25
 26Since AMSI is widely used across security products for increased visibility, attackers can disable it to evade detections that rely on it.
 27
 28This rule monitors the modifications to the Software\\Microsoft\\Windows Script\\Settings\\AmsiEnable registry key.
 29
 30#### Possible investigation steps
 31
 32- Identify the user account that performed the action and whether it should perform this kind of action.
 33- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 34- Investigate other alerts associated with the user/host during the past 48 hours.
 35- Investigate the execution of scripts and macros after the registry modification.
 36- Retrieve scripts or Microsoft Office files and determine if they are malicious:
 37  - Use a private sandboxed malware analysis system to perform analysis.
 38    - Observe and collect information about the following activities:
 39      - Attempts to contact external domains and addresses.
 40      - File and registry access, modification, and creation activities.
 41      - Service creation and launch activities.
 42      - Scheduled task creation.
 43  - Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
 44    - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 45- Use process name, command line, and file hash to search for occurrences on other hosts.
 46
 47### False positive analysis
 48
 49- This modification should not happen legitimately. Any potential benign true positive (B-TP) should be mapped and monitored by the security team as these modifications expose the host to malware infections.
 50
 51### Related rules
 52
 53- Microsoft Windows Defender Tampering - fe794edd-487f-4a90-b285-3ee54f2af2d3
 54
 55### Response and remediation
 56
 57- Initiate the incident response process based on the outcome of the triage.
 58- Isolate the involved hosts to prevent further post-compromise behavior.
 59- If the triage identified malware, search the environment for additional compromised hosts.
 60  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 61  - Stop suspicious processes.
 62  - Immediately block the identified indicators of compromise (IoCs).
 63  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 64- Remove and block malicious artifacts identified during triage.
 65- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 66- Delete or set the key to its default value.
 67- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 68- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
 69"""
 70references = [
 71    "https://hackinparis.com/data/slides/2019/talks/HIP2019-Dominic_Chell-Cracking_The_Perimeter_With_Sharpshooter.pdf",
 72    "https://docs.microsoft.com/en-us/windows/win32/amsi/antimalware-scan-interface-portal",
 73]
 74risk_score = 73
 75rule_id = "f874315d-5188-4b4a-8521-d1c73093a7e4"
 76severity = "high"
 77tags = [
 78    "Domain: Endpoint",
 79    "OS: Windows",
 80    "Use Case: Threat Detection",
 81    "Tactic: Defense Evasion",
 82    "Resources: Investigation Guide",
 83    "Data Source: Elastic Endgame",
 84    "Data Source: Elastic Defend",
 85    "Data Source: Sysmon",
 86    "Data Source: Microsoft Defender for Endpoint",
 87    "Data Source: SentinelOne",
 88]
 89timestamp_override = "event.ingested"
 90type = "eql"
 91
 92query = '''
 93registry where host.os.type == "windows" and event.type == "change" and
 94  registry.value : "AmsiEnable" and registry.data.strings: ("0", "0x00000000")
 95
 96  /*
 97    Full registry key path omitted due to data source variations:
 98    HKEY_USERS\\*\\Software\\Microsoft\\Windows Script\\Settings\\AmsiEnable"
 99  */
100'''
101
102
103[[rule.threat]]
104framework = "MITRE ATT&CK"
105[[rule.threat.technique]]
106id = "T1112"
107name = "Modify Registry"
108reference = "https://attack.mitre.org/techniques/T1112/"
109
110[[rule.threat.technique]]
111id = "T1562"
112name = "Impair Defenses"
113reference = "https://attack.mitre.org/techniques/T1562/"
114[[rule.threat.technique.subtechnique]]
115id = "T1562.001"
116name = "Disable or Modify Tools"
117reference = "https://attack.mitre.org/techniques/T1562/001/"
118
119
120
121[rule.threat.tactic]
122id = "TA0005"
123name = "Defense Evasion"
124reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Modification of AmsiEnable Registry Key

The Windows Antimalware Scan Interface (AMSI) is a versatile interface standard that allows your applications and services to integrate with any antimalware product on a machine. AMSI integrates with multiple Windows components, ranging from User Account Control (UAC) to VBA macros and PowerShell.

Since AMSI is widely used across security products for increased visibility, attackers can disable it to evade detections that rely on it.

This rule monitors the modifications to the Software\Microsoft\Windows Script\Settings\AmsiEnable registry key.

Possible investigation steps

  • Identify the user account that performed the action and whether it should perform this kind of action.
  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Investigate the execution of scripts and macros after the registry modification.
  • Retrieve scripts or Microsoft Office files and determine if they are malicious:
    • Use a private sandboxed malware analysis system to perform analysis.
      • Observe and collect information about the following activities:
        • Attempts to contact external domains and addresses.
        • File and registry access, modification, and creation activities.
        • Service creation and launch activities.
        • Scheduled task creation.
    • Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
      • Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
  • Use process name, command line, and file hash to search for occurrences on other hosts.

False positive analysis

  • This modification should not happen legitimately. Any potential benign true positive (B-TP) should be mapped and monitored by the security team as these modifications expose the host to malware infections.
  • Microsoft Windows Defender Tampering - fe794edd-487f-4a90-b285-3ee54f2af2d3

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved hosts to prevent further post-compromise behavior.
  • If the triage identified malware, search the environment for additional compromised hosts.
    • Implement temporary network rules, procedures, and segmentation to contain the malware.
    • Stop suspicious processes.
    • Immediately block the identified indicators of compromise (IoCs).
    • Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
  • Remove and block malicious artifacts identified during triage.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Delete or set the key to its default value.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

References

Related rules

to-top