Startup Persistence by a Suspicious Processedit

Identifies files written to or modified in the startup folder by commonly abused processes. Adversaries may use this technique to maintain persistence.

Rule type: eql

Rule indices:

  • winlogbeat-*
  • logs-endpoint.events.*
  • logs-windows.*

Severity: medium

Risk score: 47

Runs every: 5 minutes

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100

Tags:

  • Elastic
  • Host
  • Windows
  • Threat Detection
  • Persistence

Version: 4 (version history)

Added (Elastic Stack release): 7.11.0

Last modified (Elastic Stack release): 8.2.0

Rule authors: Elastic

Rule license: Elastic License v2

Investigation guideedit

## Triage and analysis

### Investigating Startup Persistence by a Suspicious Process

The Windows Startup folder is a special folder in Windows. Programs added to this folder are executed during account
logon, without user interaction, providing an excellent way for attackers to maintain persistence.

This rule monitors for commonly abused processes writing to the Startup folder locations.

#### Possible investigation steps

- Investigate the process execution chain (parent process tree).
- Investigate other alerts related to the user/host in the last 48 hours.
- Validate the activity is not related to planned patches, updates, network administrator activity, or legitimate
software installations.
- Determine if activity is unique by validating if other machines in the organization have similar entries.
- Retrieve the file:
  - Use a sandboxed malware analysis system to perform analysis.
    - Observe attempts to contact external domains and addresses.
  - Use the PowerShell Get-FileHash cmdlet to get the SHA-256 hash value of the file.
    - Search for the existence and reputation of this file in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.

### False positive analysis

- Administrators may add programs to this mechanism via command-line shells. Before the further investigation,
verify that this activity is not benign.

### Related rules

- Suspicious Startup Shell Folder Modification - c8b150f0-0164-475b-a75e-74b47800a9ff
- Persistent Scripts in the Startup Directory - f7c4dc5a-a58d-491d-9f14-9b66507121c0

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
  - Implement any temporary network rules, procedures, and segmentation required to contain the malware.
  - Immediately block the identified indicators of compromise (IoCs).
- Remove malicious artifacts identified on the triage.
- Reset passwords for the user account and other potentially compromised accounts (email, services, CRMs, etc.).

## Config

If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define `event.ingested` and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate `event.ingested` to @timestamp for this rule to work.

Rule queryedit

file where event.type != "deletion" and user.domain != "NT
AUTHORITY" and file.path :
("C:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start
Menu\\Programs\\Startup\\*",
"C:\\ProgramData\\Microsoft\\Windows\\Start
Menu\\Programs\\StartUp\\*") and process.name : ("cmd.exe",
"powershell.exe", "wmic.exe",
"mshta.exe", "pwsh.exe",
"cscript.exe", "wscript.exe",
"regsvr32.exe", "RegAsm.exe",
"rundll32.exe", "EQNEDT32.EXE",
"WINWORD.EXE", "EXCEL.EXE",
"POWERPNT.EXE", "MSPUB.EXE",
"MSACCESS.EXE", "iexplore.exe",
"InstallUtil.exe")

Threat mappingedit

Framework: MITRE ATT&CKTM

Rule version historyedit

Version 4 (8.2.0 release)
  • Rule name changed from: Shortcut File Written or Modified for Persistence
Version 3 (7.12.0 release)
  • Formatting only
Version 2 (7.11.2 release)
  • Formatting only