Skip to content
SIEMBench
100% Client-Side Tool • Inputs Never Sent to Our Servers

Event ID 7040

Event ID 7040: Service Start Type Changed

The start type of a service was changed

Log source
System
How to enable it
On by default. Written by the Service Control Manager to the System log
Category
Defense Evasion
Priority
High
Typical volume
Medium
MITRE ATT&CK
  • T1685 Disable or Modify Tools
  • T1685.001 Disable or Modify Tools: Disable or Modify Windows Event Log
  • T1489 Service Stop
  • T1543.003 Create or Modify System Process: Windows Service

T1685 replaces T1562, T1562.001, T1562.006, which older guides still use. T1685.001 replaces T1562.002, which older guides still use.

What Event ID 7040 means

7040 is logged when the start type of a service changes, for example from auto start to disabled. Like 7045 it is written to the System log without any audit policy.

Setting a service to disabled is how tampering survives a restart. Stopping an agent lasts until the next boot, while disabling it lasts until somebody notices. The services to watch are few: endpoint protection, Windows Event Log, firewall, backup, volume shadow copy and remote logging.

The event data has no friendly names. The four values are called param1 to param4, and the start types are written in the system's language, so a query for the word disabled misses a German or Spanish server. Match on the service name in param4, which is not translated.

Key fields to inspect

FieldMeaningSuspicious when
param1 Display name of the service, in the system's language. A security, backup or logging product.
param2 Previous start type. auto start.
param3 New start type. disabled, or demand start for a service that must always run.
param4 Internal service name. WinDefend, Sense, EventLog, mpssvc, VSS, wscsvc, or your EDR and backup agents.

Detection queries

Alert on start type changes for security, logging and recovery services. Adjust names and thresholds to your environment. About these queries.

Splunk SPL

index=windows source="XmlWinEventLog:System" EventCode=7040
param4 IN ("WinDefend", "Sense", "WdNisSvc", "EventLog", "mpssvc", "VSS", "wscsvc", "Sysmon", "Sysmon64", "wbengine", "SDRSVC")
| table _time Computer param1 param2 param3 param4

Microsoft Sentinel KQL

Event
| where EventLog == "System" and EventID == 7040
| extend DisplayName = extract(@'Name="param1">([^<]*)<', 1, EventData)
| extend OldStart = extract(@'Name="param2">([^<]*)<', 1, EventData)
| extend NewStart = extract(@'Name="param3">([^<]*)<', 1, EventData)
| extend ServiceName = extract(@'Name="param4">([^<]*)<', 1, EventData)
| where ServiceName in~ ("WinDefend", "Sense", "WdNisSvc", "EventLog", "mpssvc", "VSS", "wscsvc", "Sysmon", "Sysmon64", "wbengine", "SDRSVC")
| project TimeGenerated, Computer, UserName, DisplayName, OldStart, NewStart, ServiceName

PowerShell

Get-WinEvent -FilterHashtable @{ LogName = 'System'; Id = 7040; StartTime = (Get-Date).AddDays(-30) } |
  ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
  Where-Object { $_.param4 -notin 'BITS','TrustedInstaller' } |
  Select-Object Time, param1, param2, param3, param4 | Format-Table -AutoSize

Attack scenarios

Disabling protection before ransomware

A batch file runs sc config for dozens of services with start= disabled and then stops them. A burst of 7040 for backup, database and security services within a minute is among the clearest warnings that encryption is next.

Silencing the event log

Disabling the EventLog service takes effect at the next restart. From then on the host is blind, so this single event may be the last one it ever sends.

Enabling a service for access

Changing RemoteRegistry, WinRM or TermService from disabled to auto start opens a path for remote control and later discovery.

Investigation checklist

  1. Count how many services changed in the same minutes.
  2. Find the command in 4688, such as sc.exe config or Set-Service.
  3. Check the header's user SID for the account that made the change.
  4. Restore the start type, and confirm that the service is running.
  5. If protection or logging was disabled, treat it as an active intrusion.

Common benign causes

Event ID 7040 FAQ

Why do I see so many 7040 events for BITS?

The Background Intelligent Transfer Service changes between demand start and auto start by itself when it has work to do. It is normal and can be excluded by service name.

What do param1 to param4 mean in event 7040?

param1 is the display name, param2 the previous start type, param3 the new start type and param4 the internal service name. Use param4 in queries, because the others are translated.

Is event 7040 logged if the registry is edited directly?

No. The event is written when the change goes through the Service Control Manager. A direct change to the Start value in the registry needs registry auditing or Sysmon event 13 to detect.

Techniques follow MITRE ATT&CK® v20.1. © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation (license).