Detection rules › Sigma

Suspicious Rundll32 Setupapi.dll Activity

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
Konstantin Grishchenko, oscd.community
Source
github.com/SigmaHQ/sigma

setupapi.dll library provide InstallHinfSection function for processing INF files. INF file may contain instructions allowing to create values in the registry, modify files and install drivers. This technique could be used to obtain persistence via modifying one of Run or RunOnce registry keys, run process or use other DLLs chain calls (see references) InstallHinfSection function in setupapi.dll calls runonce.exe executable regardless of actual content of INF file.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Suspicious Rundll32 Setupapi.dll Activity
id: 285b85b1-a555-4095-8652-a8a4106af63f
status: test
description: setupapi.dll library provide InstallHinfSection function for processing INF files. INF file may contain instructions allowing to create values in the registry, modify files and install drivers. This technique could be used to obtain persistence via modifying one of Run or RunOnce registry keys, run process or use other DLLs chain calls (see references) InstallHinfSection function in setupapi.dll calls runonce.exe executable regardless of actual content of INF file.
references:
    - https://lolbas-project.github.io/lolbas/Libraries/Setupapi/
    - https://gist.githubusercontent.com/bohops/0cc6586f205f3691e04a1ebf1806aabd/raw/baf7b29891bb91e76198e30889fbf7d6642e8974/calc_exe.inf
    - https://raw.githubusercontent.com/huntresslabs/evading-autoruns/master/shady.inf
    - https://twitter.com/Z3Jpa29z/status/1313742350292746241?s=20
author: Konstantin Grishchenko, oscd.community
date: 2020-10-07
modified: 2021-11-27
tags:
    - attack.stealth
    - attack.t1218.011
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        Image|endswith: '\runonce.exe'
        ParentImage|endswith: '\rundll32.exe'
        ParentCommandLine|contains|all:
            - 'setupapi.dll'
            - 'InstallHinfSection'
    condition: selection
falsepositives:
    - Scripts and administrative tools that use INF files for driver installation with setupapi.dll
level: medium

Stages and Predicates

Stage 0: condition

selection

Stage 1: selection

selection:
    Image|endswith: '\runonce.exe'
    ParentImage|endswith: '\rundll32.exe'
    ParentCommandLine|contains|all:
        - 'setupapi.dll'
        - 'InstallHinfSection'

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
  • \runonce.exe corpus 4 (sigma 4)
ParentCommandLinematch
  • InstallHinfSection
  • setupapi.dll
ParentImageends_with
  • \rundll32.exe corpus 15 (sigma 15)