Detection rules › Sigma

Potential Initial Access via DLL Search Order Hijacking

Status
test
Severity
medium
Log source
product windows, category file_event
Author
Tim Rauch (rule), Elastic (idea)
Source
github.com/SigmaHQ/sigma

Detects attempts to create a DLL file to a known desktop application dependencies folder such as Slack, Teams or OneDrive and by an unusual process. This may indicate an attempt to load a malicious module via DLL search order hijacking.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 11FileCreate

Rule body yaml

title: Potential Initial Access via DLL Search Order Hijacking
id: dbbd9f66-2ed3-4ca2-98a4-6ea985dd1a1c
status: test
description: Detects attempts to create a DLL file to a known desktop application dependencies folder such as Slack, Teams or OneDrive and by an unusual process. This may indicate an attempt to load a malicious module via DLL search order hijacking.
references:
    - https://github.com/elastic/protections-artifacts/commit/746086721fd385d9f5c6647cada1788db4aea95f#diff-5d46dd4ac6866b4337ec126be8cee0e115467b3e8703794ba6f6df6432c806bc
    - https://posts.specterops.io/automating-dll-hijack-discovery-81c4295904b0
author: Tim Rauch (rule), Elastic (idea)
date: 2022-10-21
tags:
    - attack.privilege-escalation
    - attack.persistence
    - attack.execution
    - attack.stealth
    - attack.t1566
    - attack.t1566.001
    - attack.initial-access
    - attack.t1574
    - attack.t1574.001
logsource:
    product: windows
    category: file_event
detection:
    selection:
        Image|endswith:
            # add more processes when you find them
            - '\winword.exe'
            - '\excel.exe'
            - '\powerpnt.exe'
            - '\MSACCESS.EXE'
            - '\MSPUB.EXE'
            - '\fltldr.exe'
            - '\cmd.exe'
            - '\certutil.exe'
            - '\mshta.exe'
            - '\cscript.exe'
            - '\wscript.exe'
            - '\curl.exe'
            - '\powershell.exe'
            - '\pwsh.exe'
        TargetFilename|endswith: '.dll'
        TargetFilename|contains|all:
            - '\Users\'
            - '\AppData\'
        TargetFilename|contains:
            # add more suspicious paths when you find them
            - '\Microsoft\OneDrive\'
            - '\Microsoft OneDrive\'
            - '\Microsoft\Teams\'
            - '\Local\slack\app-'
            - '\Local\Programs\Microsoft VS Code\'
    filter:
        Image|endswith: '\cmd.exe'
        TargetFilename|contains|all:
            - '\Users\'
            - '\AppData\'
            - '\Microsoft\OneDrive\'
            - '\api-ms-win-core-'
    condition: selection and not filter
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

selection and not filter

Stage 1: selection

selection:
    Image|endswith:
        - '\winword.exe'
        - '\excel.exe'
        - '\powerpnt.exe'
        - '\MSACCESS.EXE'
        - '\MSPUB.EXE'
        - '\fltldr.exe'
        - '\cmd.exe'
        - '\certutil.exe'
        - '\mshta.exe'
        - '\cscript.exe'
        - '\wscript.exe'
        - '\curl.exe'
        - '\powershell.exe'
        - '\pwsh.exe'
    TargetFilename|endswith: '.dll'
    TargetFilename|contains|all:
        - '\Users\'
        - '\AppData\'
    TargetFilename|contains:
        - '\Microsoft\OneDrive\'
        - '\Microsoft OneDrive\'
        - '\Microsoft\Teams\'
        - '\Local\slack\app-'
        - '\Local\Programs\Microsoft VS Code\'

Stage 2: not filter

filter:
    Image|endswith: '\cmd.exe'
    TargetFilename|contains|all:
        - '\Users\'
        - '\AppData\'
        - '\Microsoft\OneDrive\'
        - '\api-ms-win-core-'

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
Imageends_with\cmd.exe
TargetFilenamematch\AppData\
TargetFilenamematch\Microsoft\OneDrive\
TargetFilenamematch\Users\
TargetFilenamematch\api-ms-win-core-

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
Imageends_with
  • \MSACCESS.EXE corpus 4 (sigma 4)
  • \MSPUB.EXE corpus 10 (sigma 10)
  • \certutil.exe corpus 43 (sigma 43)
  • \cmd.exe corpus 130 (sigma 130)
  • \cscript.exe corpus 73 (sigma 73)
  • \curl.exe corpus 30 (sigma 30)
  • \excel.exe corpus 18 (sigma 18)
  • \fltldr.exe
  • \mshta.exe corpus 67 (sigma 67)
  • \powerpnt.exe corpus 15 (sigma 15)
  • \powershell.exe corpus 182 (sigma 182)
  • \pwsh.exe corpus 168 (sigma 168)
  • \winword.exe corpus 20 (sigma 20)
  • \wscript.exe corpus 75 (sigma 75)
TargetFilenameends_with
  • .dll corpus 23 (sigma 23)
TargetFilenamematch
  • \AppData\ corpus 4 (sigma 4)
  • \Local\Programs\Microsoft VS Code\
  • \Local\slack\app-
  • \Microsoft OneDrive\
  • \Microsoft\OneDrive\
  • \Microsoft\Teams\
  • \Users\ corpus 2 (sigma 2)