title: Boot or Logon Initialization Scripts (T1037)
id: df00tech-t1037
status: experimental
description: "Adversaries may use scripts automatically executed at boot or logon initialization to establish persistence. On Windows, logon scripts can be set via the UserInitMprLogonScript registry value under HKCU\\Environment, or via Group Policy. On Linux and macOS, adversaries target RC scripts (/etc/rc.d/, /etc/init.d/, /etc/rc.local), systemd unit files, login hooks, and startup items. These mechanisms execute with elevated privileges and survive reboots, making them effective persistence mechanisms. Threat groups including APT41, APT29, Rocke, and UNC3886 have all leveraged initialization script abuse, targeting both enterprise endpoints and network appliances."
references:
  - https://attack.mitre.org/techniques/T1037/
  - https://df00tech.com/detections/T1037
author: df00tech
date: 2026/04/16
tags:
  - attack.t1037
# NOTE: logsource is auto-derived and may need adjustment for your environment
logsource:
  category: process_creation
  product: windows
detection:
  # This detection logic could not be auto-translated; see the KQL/SPL query on df00tech.
  selection:
    EventID: '*'
  condition: selection
falsepositives:
  - Group Policy administrators deploying legitimate logon scripts via SYSVOL/NETLOGON shares during policy updates
  - "Configuration management tools (Ansible, Chef, Puppet, SCCM) writing startup scripts to managed endpoints as part of authorized deployments"
  - "Linux package managers (apt, yum, dnf, rpm) creating init.d service scripts when installing server software (nginx, apache, mysql)"
  - "System administrators manually configuring logon scripts for mapped drives, printer connections, or environment variable setup"
  - "macOS enterprise MDM solutions (Jamf, Mosyle) configuring LoginHooks for device enrollment or management tasks"
level: high
