T1037.003 Google Chronicle · YARA-L

Detect Network Logon Script in Google Chronicle

Adversaries may use network logon scripts automatically executed at logon initialization to establish persistence. Network logon scripts can be assigned using Active Directory or Group Policy Objects. These logon scripts run with the privileges of the user they are assigned to. Depending on the systems within the network, initializing one of these scripts could apply to more than one or potentially all systems. Adversaries may use these scripts to maintain persistence on a network. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary.

MITRE ATT&CK

Tactic
Persistence Privilege Escalation
Technique
T1037 Boot or Logon Initialization Scripts
Sub-technique
T1037.003 Network Logon Script
Canonical reference
https://attack.mitre.org/techniques/T1037/003/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule t1037_003_network_logon_script {
  meta:
    author = "Argus Detection Engineering"
    description = "Detects T1037.003 Network Logon Script persistence via script file creation in NETLOGON/SYSVOL, suspicious interpreter processes spawned at logon, and registry modifications to logon script keys."
    mitre_attack_tactic = "Persistence"
    mitre_attack_technique = "T1037.003"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1037/003/"
    severity = "HIGH"
    confidence = "HIGH"
    reference = "https://attack.mitre.org/techniques/T1037/003/"
    version = "1.0"
    created = "2026-04-16"

  events:
    // Detection variant A: Script file creation in NETLOGON/SYSVOL
    (
      $e1.metadata.event_type = "FILE_CREATION"
      and (
        re.regex($e1.target.file.full_path, `(?i)\\(NETLOGON|SYSVOL|scripts)\\`) nocase
      )
      and (
        re.regex($e1.target.file.full_path, `(?i)\.(bat|cmd|ps1|vbs|js|wsf|hta)$`) nocase
      )
    )
    or
    // Detection variant B: Suspicious process spawned from logon script host referencing NETLOGON/SYSVOL
    (
      $e1.metadata.event_type = "PROCESS_LAUNCH"
      and (
        re.regex($e1.principal.process.file.full_path, `(?i)\\(userinit|explorer)\.exe$`) nocase
      )
      and (
        re.regex($e1.target.process.file.full_path, `(?i)\\(cmd|powershell|pwsh|wscript|cscript|mshta|regsvr32|rundll32)\.exe$`) nocase
      )
      and (
        re.regex($e1.target.process.command_line, `(?i)(NETLOGON|SYSVOL|\\scripts\\)`) nocase
        or re.regex($e1.principal.process.command_line, `(?i)(NETLOGON|SYSVOL|\\scripts\\)`) nocase
      )
    )
    or
    // Detection variant C: Logon script registry key modified
    (
      $e1.metadata.event_type = "REGISTRY_MODIFICATION"
      and (
        re.regex($e1.target.registry.registry_key, `(?i)SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon`) nocase
        or re.regex($e1.target.registry.registry_key, `(?i)SOFTWARE\\Policies\\Microsoft\\Windows\\System`) nocase
        or re.regex($e1.target.registry.registry_key, `(?i)\\Environment`) nocase
      )
      and (
        re.regex($e1.target.registry.registry_value_name, `(?i)(UserInitMprLogonScript|Userinit|Scripts)`) nocase
      )
    )
    or
    // Detection variant D: AD scriptPath attribute modification (via Windows Security Event 5136)
    (
      $e1.metadata.event_type = "USER_CHANGE"
      and $e1.metadata.product_event_type = "5136"
      and re.regex($e1.additional.fields["AttributeLDAPDisplayName"], `(?i)scriptPath`) nocase
    )

  condition:
    $e1
}
high severity high confidence

YARA-L 2.0 rule detecting T1037.003 Network Logon Script persistence through four UDM event patterns: FILE_CREATION events in NETLOGON/SYSVOL paths with script extensions, PROCESS_LAUNCH events where userinit.exe or explorer.exe spawns interpreter processes with command lines referencing NETLOGON or SYSVOL paths, REGISTRY_MODIFICATION events targeting Winlogon or Environment registry keys for UserInitMprLogonScript or Userinit values, and USER_CHANGE events (Windows Security Event 5136) capturing Active Directory scriptPath attribute modifications. The rule uses YARA-L's nocase regex matching for robust coverage.

Data Sources

Google Chronicle UDM Events (FILE_CREATION, PROCESS_LAUNCH, REGISTRY_MODIFICATION, USER_CHANGE)Windows Endpoint telemetry via Chronicle forwarder or Microsoft Defender for Endpoint connectorActive Directory / Microsoft Entra ID audit logs via Chronicle ingestion

Required Tables

udm_events (FILE_CREATION)udm_events (PROCESS_LAUNCH)udm_events (REGISTRY_MODIFICATION)udm_events (USER_CHANGE)

False Positives & Tuning

  • Legitimate domain administrators modifying user scriptPath attributes via Active Directory Users and Computers or PowerShell AD cmdlets during user provisioning.
  • Group Policy management operations that update scripts in NETLOGON/SYSVOL shares as part of routine policy deployment or refresh, generating FILE_CREATION events on domain controllers.
  • Enterprise endpoint management software (SCCM, Intune) modifying Winlogon registry keys during agent installation or configuration pushes.
  • SYSVOL DFS replication that propagates legitimate script updates to replica domain controllers, creating FILE_CREATION UDM events across multiple hosts simultaneously.
Download portable Sigma rule (.yml)

Other platforms for T1037.003


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Set AD User ScriptPath Attribute via PowerShell

    Expected signal: Security Event ID 5136 on Domain Controller: Directory Service Object Modification with AttributeLDAPDisplayName=scriptPath and the new AttributeValue. AuditLogs (Azure AD) OperationName='Update user' with modifiedProperties containing scriptPath. PowerShell ScriptBlock Log Event ID 4104 with Set-ADUser command.

  2. Test 2Create Malicious Script in NETLOGON Share

    Expected signal: Sysmon Event ID 11 (File Create) on the domain controller: TargetFilename containing \NETLOGON\test_logon_script.bat, Image=powershell.exe. Security Event ID 4663 (if file auditing enabled on NETLOGON share): Object Access with ObjectName=\NETLOGON\test_logon_script.bat.

  3. Test 3Set UserInitMprLogonScript Registry Value for Persistence

    Expected signal: Sysmon Event ID 13 (Registry Value Set): TargetObject=HKCU\Environment\UserInitMprLogonScript, Details=C:\Windows\Temp\test_logon.bat, Image=powershell.exe. Sysmon Event ID 11 (File Create) for the test_logon.bat script file creation. On next logon: Sysmon Event ID 1 process creation for cmd.exe executing the .bat file via userinit.exe.

  4. Test 4Simulate Logon Script Execution via userinit.exe Command Chain

    Expected signal: Sysmon Event ID 1 (Process Create): Image=cmd.exe, CommandLine containing NETLOGON path reference, ParentImage=powershell.exe (or cmd.exe in nested execution). Security Event ID 4688 (if command line auditing enabled): NewProcessName=cmd.exe with CommandLine containing NETLOGON. Sysmon Event ID 11: file creation for test output files.

Unlock Pro Content

Get the full detection package for T1037.003 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections