Detection rules › Sigma

Suspicious Environment Variable Has Been Registered

Status
test
Severity
high
Log source
product windows, category registry_set
Author
Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects the creation of user-specific or system-wide environment variables via the registry. Which contains suspicious commands and strings

MITRE ATT&CK coverage

TacticTechniques
PersistenceNo specific technique
StealthNo specific technique

Event coverage

ProviderEventTitle
SysmonEvent ID 13RegistryEvent (Value Set)

Rule body yaml

title: Suspicious Environment Variable Has Been Registered
id: 966315ef-c5e1-4767-ba25-fce9c8de3660
status: test
description: Detects the creation of user-specific or system-wide environment variables via the registry. Which contains suspicious commands and strings
references:
    - https://infosec.exchange/@sbousseaden/109542254124022664
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-12-20
modified: 2023-08-17
tags:
    - attack.persistence
    - attack.stealth
logsource:
    product: windows
    category: registry_set
detection:
    selection_main:
        TargetObject|contains: '\Environment\'
    selection_details:
        - Details:
              - 'powershell'
              - 'pwsh'
        - Details|contains:
              # Add more suspicious strings in env variables below
              - '\AppData\Local\Temp\'
              - 'C:\Users\Public\'
              # Base64 MZ Header
              - 'TVqQAAMAAAAEAAAA' # MZ..........
              - 'TVpQAAIAAAAEAA8A'
              - 'TVqAAAEAAAAEABAA'
              - 'TVoAAAAAAAAAAAAA'
              - 'TVpTAQEAAAAEAAAA'
              # Base64 Invoke- (UTF-8)
              - 'SW52b2tlL'
              - 'ludm9rZS'
              - 'JbnZva2Ut'
              # Base64 Invoke- (UTF-16LE)
              - 'SQBuAHYAbwBrAGUALQ'
              - 'kAbgB2AG8AawBlAC0A'
              - 'JAG4AdgBvAGsAZQAtA'
        - Details|startswith:  # https://gist.github.com/Neo23x0/6af876ee72b51676c82a2db8d2cd3639
              - 'SUVY'
              - 'SQBFAF'
              - 'SQBuAH'
              - 'cwBhA'
              - 'aWV4'
              - 'aQBlA'
              - 'R2V0'
              - 'dmFy'
              - 'dgBhA'
              - 'dXNpbm'
              - 'H4sIA'
              - 'Y21k'
              - 'cABhAH'
              - 'Qzpc'
              - 'Yzpc'
    condition: all of selection_*
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_main

selection_main:
    TargetObject|contains: '\Environment\'

Stage 2: selection_details

selection_details:
    - Details:
          - 'powershell'
          - 'pwsh'
    - Details|contains:
          - '\AppData\Local\Temp\'
          - 'C:\Users\Public\'
          - 'TVqQAAMAAAAEAAAA'
          - 'TVpQAAIAAAAEAA8A'
          - 'TVqAAAEAAAAEABAA'
          - 'TVoAAAAAAAAAAAAA'
          - 'TVpTAQEAAAAEAAAA'
          - 'SW52b2tlL'
          - 'ludm9rZS'
          - 'JbnZva2Ut'
          - 'SQBuAHYAbwBrAGUALQ'
          - 'kAbgB2AG8AawBlAC0A'
          - 'JAG4AdgBvAGsAZQAtA'
    - Details|startswith:
          - 'SUVY'
          - 'SQBFAF'
          - 'SQBuAH'
          - 'cwBhA'
          - 'aWV4'
          - 'aQBlA'
          - 'R2V0'
          - 'dmFy'
          - 'dgBhA'
          - 'dXNpbm'
          - 'H4sIA'
          - 'Y21k'
          - 'cABhAH'
          - 'Qzpc'
          - 'Yzpc'

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Detailseq
  • powershell
  • pwsh
Detailsmatch
  • C:\Users\Public\
  • JAG4AdgBvAGsAZQAtA
  • JbnZva2Ut
  • SQBuAHYAbwBrAGUALQ
  • SW52b2tlL
  • TVoAAAAAAAAAAAAA
  • TVpQAAIAAAAEAA8A
  • TVpTAQEAAAAEAAAA
  • TVqAAAEAAAAEABAA
  • TVqQAAMAAAAEAAAA
  • \AppData\Local\Temp\ corpus 8 (sigma 8)
  • kAbgB2AG8AawBlAC0A
  • ludm9rZS
Detailsstarts_with
  • H4sIA
  • Qzpc
  • R2V0
  • SQBFAF
  • SQBuAH
  • SUVY
  • Y21k
  • Yzpc
  • aQBlA
  • aWV4
  • cABhAH
  • cwBhA
  • dXNpbm
  • dgBhA
  • dmFy
TargetObjectmatch
  • \Environment\