Detection rules › Sigma

Conhost Spawned By Uncommon Parent Process

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

Detects when the Console Window Host (conhost.exe) process is spawned by an uncommon parent process, which could be indicative of potential code injection activity.

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: Conhost Spawned By Uncommon Parent Process
id: cbb9e3d1-2386-4e59-912e-62f1484f7a89
status: test
description: Detects when the Console Window Host (conhost.exe) process is spawned by an uncommon parent process, which could be indicative of potential code injection activity.
references:
    - https://www.elastic.co/guide/en/security/current/conhost-spawned-by-suspicious-parent-process.html
author: Tim Rauch, Elastic (idea)
date: 2022-09-28
modified: 2025-03-06
tags:
    - attack.execution
    - attack.t1059
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        Image|endswith: '\conhost.exe'
        ParentImage|endswith:
            - '\explorer.exe'
            # - '\csrss.exe'  # Legitimate parent as seen in EchoTrail https://www.echotrail.io/insights/search/csrss.exe
            # - '\ctfmon.exe'  # Seen several times in a testing environment
            # - '\dllhost.exe'  # FP on clean system from grandparent 'svchost.exe -k DcomLaunch -p'
            - '\lsass.exe'
            - '\regsvr32.exe'
            - '\rundll32.exe'
            - '\services.exe'
            - '\smss.exe'
            - '\spoolsv.exe'
            - '\svchost.exe'
            - '\userinit.exe'
            # - '\wermgr.exe'  # Legitimate parent as seen in EchoTrail https://www.echotrail.io/insights/search/wermgr.exe
            - '\wininit.exe'
            - '\winlogon.exe'
    filter_main_svchost:
        ParentCommandLine|contains:
            - '-k apphost -s AppHostSvc'
            - '-k imgsvc'
            - '-k localService -p -s RemoteRegistry'
            - '-k LocalSystemNetworkRestricted -p -s NgcSvc'
            - '-k NetSvcs -p -s NcaSvc'
            - '-k netsvcs -p -s NetSetupSvc'
            - '-k netsvcs -p -s wlidsvc'
            - '-k NetworkService -p -s DoSvc'
            - '-k wsappx -p -s AppXSvc'
            - '-k wsappx -p -s ClipSVC'
            - '-k wusvcs -p -s WaaSMedicSvc'
    filter_optional_dropbox:
        ParentCommandLine|contains:
            - 'C:\Program Files (x86)\Dropbox\Client\'
            - 'C:\Program Files\Dropbox\Client\'
    condition: selection and not 1 of filter_main_* and not 1 of filter_optional_*
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

selection and not 1 of filter_main_* and not 1 of filter_optional_*

Stage 1: selection

selection:
    Image|endswith: '\conhost.exe'
    ParentImage|endswith:
        - '\explorer.exe'
        - '\lsass.exe'
        - '\regsvr32.exe'
        - '\rundll32.exe'
        - '\services.exe'
        - '\smss.exe'
        - '\spoolsv.exe'
        - '\svchost.exe'
        - '\userinit.exe'
        - '\wininit.exe'
        - '\winlogon.exe'

Stage 2: not filter_main_svchost

filter_main_svchost:
    ParentCommandLine|contains:
        - '-k apphost -s AppHostSvc'
        - '-k imgsvc'
        - '-k localService -p -s RemoteRegistry'
        - '-k LocalSystemNetworkRestricted -p -s NgcSvc'
        - '-k NetSvcs -p -s NcaSvc'
        - '-k netsvcs -p -s NetSetupSvc'
        - '-k netsvcs -p -s wlidsvc'
        - '-k NetworkService -p -s DoSvc'
        - '-k wsappx -p -s AppXSvc'
        - '-k wsappx -p -s ClipSVC'
        - '-k wusvcs -p -s WaaSMedicSvc'

Stage 3: not filter_optional_dropbox

filter_optional_dropbox:
    ParentCommandLine|contains:
        - 'C:\Program Files (x86)\Dropbox\Client\'
        - 'C:\Program Files\Dropbox\Client\'

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
ParentCommandLinematch-k LocalSystemNetworkRestricted -p -s NgcSvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k LocalSystemNetworkRestricted -p -s NgcSvc"
ParentCommandLinematch-k NetSvcs -p -s NcaSvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k NetSvcs -p -s NcaSvc"
ParentCommandLinematch-k NetworkService -p -s DoSvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k NetworkService -p -s DoSvc"
ParentCommandLinematch-k apphost -s AppHostSvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k apphost -s AppHostSvc"
ParentCommandLinematch-k imgsvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k imgsvc"
ParentCommandLinematch-k localService -p -s RemoteRegistryexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k localService -p -s RemoteRegistry"
ParentCommandLinematch-k netsvcs -p -s NetSetupSvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k netsvcs -p -s NetSetupSvc"
ParentCommandLinematch-k netsvcs -p -s wlidsvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k netsvcs -p -s wlidsvc"
ParentCommandLinematch-k wsappx -p -s AppXSvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k wsappx -p -s AppXSvc"
ParentCommandLinematch-k wsappx -p -s ClipSVCexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k wsappx -p -s ClipSVC"
ParentCommandLinematch-k wusvcs -p -s WaaSMedicSvcexcludes:ParentCommandLine field:"ParentCommandLine" value:"-k wusvcs -p -s WaaSMedicSvc"
ParentCommandLinematchC:\Program Files (x86)\Dropbox\Client\excludes:ParentCommandLine field:"ParentCommandLine" value:"C:\Program Files (x86)\Dropbox\Client\"
ParentCommandLinematchC:\Program Files\Dropbox\Client\excludes:ParentCommandLine field:"ParentCommandLine" value:"C:\Program Files\Dropbox\Client\"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
Imageends_with
  • \conhost.exe corpus 4 (sigma 4)
field:"Image" kind:ends_with value:"\conhost.exe"
ParentImageends_with
  • \explorer.exe corpus 13 (sigma 13)
  • \lsass.exe corpus 3 (sigma 3)
  • \regsvr32.exe corpus 11 (sigma 11)
  • \rundll32.exe corpus 15 (sigma 15)
  • \services.exe corpus 8 (sigma 8)
  • \smss.exe corpus 2 (sigma 2)
  • \spoolsv.exe corpus 5 (sigma 5)
  • \svchost.exe corpus 15 (sigma 14, kusto 1)
  • \userinit.exe corpus 3 (sigma 3)
  • \wininit.exe corpus 2 (sigma 2)
  • \winlogon.exe corpus 5 (sigma 5)
field:"ParentImage" kind:ends_with