Suspicious Rundll32 Setupapi.dll Activity

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.

Sigma rule (View on GitHub)

 1title: Suspicious Rundll32 Setupapi.dll Activity
 2id: 285b85b1-a555-4095-8652-a8a4106af63f
 3status: test
 4description: 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.
 5references:
 6    - https://lolbas-project.github.io/lolbas/Libraries/Setupapi/
 7    - https://gist.githubusercontent.com/bohops/0cc6586f205f3691e04a1ebf1806aabd/raw/baf7b29891bb91e76198e30889fbf7d6642e8974/calc_exe.inf
 8    - https://raw.githubusercontent.com/huntresslabs/evading-autoruns/master/shady.inf
 9    - https://twitter.com/Z3Jpa29z/status/1313742350292746241?s=20
10author: Konstantin Grishchenko, oscd.community
11date: 2020/10/07
12modified: 2021/11/27
13tags:
14    - attack.defense_evasion
15    - attack.t1218.011
16logsource:
17    category: process_creation
18    product: windows
19detection:
20    selection:
21        Image|endswith: '\runonce.exe'
22        ParentImage|endswith: '\rundll32.exe'
23        ParentCommandLine|contains|all:
24            - 'setupapi.dll'
25            - 'InstallHinfSection'
26    condition: selection
27fields:
28    - ComputerName
29    - User
30    - CommandLine
31    - ParentCommandLine
32falsepositives:
33    - Scripts and administrative tools that use INF files for driver installation with setupapi.dll
34level: medium

References

Related rules

to-top