Windows.Sysinternals.Autoruns.Filtered
Windows.Sysinternals.Autoruns.Filtered
Collects Windows autostart entries with Sysinternals Autoruns. By default, it scans all categories and verifies digital signatures.
The artifact filters out disabled entries, entries marked File not found,
and entries matching the IG-Labs Autoruns GoldenDB or the path and publisher
rules in PathRules. Enable CollectAll to return every entry from the
selected categories without loading GoldenDB.
name: Windows.Sysinternals.Autoruns.Filtered
author: Matt Green - @mgreen27
description: |
Collects Windows autostart entries with Sysinternals Autoruns.
By default, it scans all categories and verifies digital signatures.
The artifact filters out disabled entries, entries marked `File not found`,
and entries matching the IG-Labs Autoruns GoldenDB or the path and publisher
rules in `PathRules`. Enable `CollectAll` to return every entry from the
selected categories without loading GoldenDB.
type: CLIENT
resources:
timeout: 3600
tools:
- name: Autorun_386
url: https://live.sysinternals.com/tools/autorunsc.exe
serve_locally: true
- name: Autorun_amd64
url: https://live.sysinternals.com/tools/autorunsc64.exe
serve_locally: true
- name: Autoruns.GoldenDB
version: current
url: https://github.com/ig-labs/velociraptor-skills/raw/a0360765021034e2c8d9489073b0407ef8ad2b14/src/vraptor/resources/golden/autoruns-golden.sqlite
expected_hash: 8b30e4cb9fc4509f0c3931ab01dfabe599d9167ef86fe3c7a40cbfcb60f12088
serve_locally: true
precondition: SELECT OS FROM info() WHERE OS = "windows"
implied_permissions:
- EXECVE
parameters:
- name: All
type: bool
default: Y
- name: Boot execute
type: bool
- name: Codecs
type: bool
- name: Appinit DLLs
type: bool
- name: Explorer addons
type: bool
- name: Sidebar gadgets (Vista and higher)
type: bool
- name: Image hijacks
type: bool
- name: Internet Explorer addons
type: bool
- name: Known DLLs
type: bool
- name: Logon startups (this is the default)
type: bool
- name: WMI entries
type: bool
- name: Winsock protocol and network providers
type: bool
- name: Office addins
type: bool
- name: Printer monitor DLLs
type: bool
- name: LSA security providers
type: bool
- name: Autostart services and non-disabled drivers
type: bool
- name: Scheduled tasks
type: bool
- name: Winlogon entries
type: bool
- name: Verify digital signatures
type: bool
default: Y
- name: ToolInfo
type: hidden
- name: CollectAll
type: bool
default: N
description: Return all selected Autoruns rows unchanged; bypass GoldenDB, eligibility and PathRules.
- name: PathRules
type: csv
description: Directory/publisher rules. Enabled=1 and Verified=1 are required. ImagePathRegex is automatically
anchored; VendorRegex matches the verified publisher without its prefix. Empty table disables only this matching
route. Notes describes each rule and does not affect matching. All rules require an exact launch match
without arguments; optional surrounding quotes are allowed and names without an extension are EXE-only.
default: |
ImagePathRegex,Verified,VendorRegex,Enabled,Notes
c:\\windows\\[^\\]+\.(?:exe|dll),1,^Microsoft,1,Windows root only; EXE/DLL; verified Microsoft; no subfolders.
c:\\windows\\system32\\(?:[^\\]+\\)*[^\\]+\.(?:exe|dll|cpl|sys),1,^(?:Microsoft|Intel),1,System32 and all subfolders; EXE/DLL/CPL/SYS; verified Microsoft or Intel.
c:\\windows\\ccm\\(?:[^\\]+\\)*[^\\]+\.exe,1,^Microsoft,1,CCM and all subfolders; EXE only; verified Microsoft.
c:\\program files(?: \(x86\))?\\(?:[^\\]+\\)*[^\\]+\.(?:exe|dll),1,^(?:Microsoft|Intel|Broadcom Inc\z|NVIDIA Corporation\z),1,Program Files and Program Files (x86) including all subfolders; EXE/DLL; verified Microsoft or Intel prefixes or exact Broadcom Inc or NVIDIA Corporation publishers.
sources:
- query: |
LET NormalizeText(Value) = regex_transform(
source= Value || "", key="autoruns-ascii-v4",
map=dict(
`(?-i)A`='a', `(?-i)B`='b', `(?-i)C`='c',
`(?-i)D`='d', `(?-i)E`='e', `(?-i)F`='f',
`(?-i)G`='g', `(?-i)H`='h', `(?-i)I`='i',
`(?-i)J`='j', `(?-i)K`='k', `(?-i)L`='l',
`(?-i)M`='m', `(?-i)N`='n', `(?-i)O`='o',
`(?-i)P`='p', `(?-i)Q`='q', `(?-i)R`='r',
`(?-i)S`='s', `(?-i)T`='t', `(?-i)U`='u',
`(?-i)V`='v', `(?-i)W`='w', `(?-i)X`='x',
`(?-i)Y`='y', `(?-i)Z`='z'))
LET NormalizePath(Value) = NormalizeText(Value=regex_transform(
source=Value || "",
map=dict(
`(?-i)%[lL][oO][cC][aA][lL][aA][pP][pP][dD][aA][tT][aA]%`="c:\\users\\USER\\appdata\\local",
`(?-i)%[aA][pP][pP][dD][aA][tT][aA]%`="c:\\users\\USER\\appdata\\roaming",
`(?-i)%[uU][sS][eE][rR][pP][rR][oO][fF][iI][lL][eE]%`="c:\\users\\USER",
`(?-i)[cC]:\\\\[uU][sS][eE][rR][sS]\\\\[^\\\\]+`="c:\\users\\USER",
`(?-i)[cC]:\\\\[dD][oO][cC][uU][mM][eE][nN][tT][sS]\\ [aA][nN][dD]\\ [sS][eE][tT][tT][iI][nN][gG][sS]\\\\[^\\\\]+`="c:\\users\\USER",
`(?-i)[sS]\\-1\\-5\\-21\\-(?:[0-9]+-){3}[0-9]+`="SID",
`(?-i)%[sS][yY][sS][tT][eE][mM][rR][oO][oO][tT]%`="c:\\windows",
`(?-i)%[wW][iI][nN][dD][iI][rR]%`="c:\\windows",
`(?-i)^\\\\[sS][yY][sS][tT][eE][mM][rR][oO][oO][tT]\\\\`="c:\\windows\\"),
key="autoruns-path-v4"))
LET Collected = SELECT * FROM Artifact.Windows.Sysinternals.Autoruns(
All=All,
`Boot execute`=`Boot execute`,
Codecs=Codecs,
`Appinit DLLs`=`Appinit DLLs`,
`Explorer addons`=`Explorer addons`,
`Sidebar gadgets (Vista and higher)`=`Sidebar gadgets (Vista and higher)`,
`Image hijacks`=`Image hijacks`,
`Internet Explorer addons`=`Internet Explorer addons`,
`Known DLLs`=`Known DLLs`,
`Logon startups (this is the default)`=`Logon startups (this is the default)`,
`WMI entries`=`WMI entries`,
`Winsock protocol and network providers`=`Winsock protocol and network providers`,
`Office addins`=`Office addins`,
`Printer monitor DLLs`=`Printer monitor DLLs`,
`LSA security providers`=`LSA security providers`,
`Autostart services and non-disabled drivers`=`Autostart services and non-disabled drivers`,
`Scheduled tasks`=`Scheduled tasks`,
`Winlogon entries`=`Winlogon entries`,
`Verify digital signatures`=`Verify digital signatures`,
ToolInfo=ToolInfo)
LET Database <= SELECT * FROM if(condition=NOT CollectAll, then={
SELECT OSPath FROM Artifact.Generic.Utils.FetchBinary(
ToolName="Autoruns.GoldenDB", IsExecutable=FALSE)
})
LET Metadata <= to_dict(item={
SELECT * FROM if(condition=Database, then={
SELECT key AS _key, value AS _value FROM sqlite(file=Database[0].OSPath, query="SELECT key,value FROM metadata WHERE key = 'rule_count'")
})
})
LET GoldenRules <= SELECT * FROM if(condition=Database, then={
SELECT Category,ImagePath,LaunchString,Signer FROM sqlite(file=Database[0].OSPath,
query="SELECT Category,ImagePath,LaunchString,Signer FROM GoldenRules")
})
LET Ready <= CollectAll OR (
len(list=Database) > 0
AND len(list=GoldenRules) > 0
AND len(list=GoldenRules) = int(int=Metadata.rule_count))
LET Checked <= if(condition=NOT Ready, then=log(level="ERROR",message="GoldenDB unavailable or incompatible. Use CollectAll to collect without filtering."))
LET ActivePathRules <= SELECT
format(format='''\A(?:%s)\z''', args=ImagePathRegex) AS ImagePathRegex,
VendorRegex
FROM foreach(row=PathRules)
WHERE NOT CollectAll AND str(str=Verified) = "1" AND str(str=Enabled) = "1"
AND ImagePathRegex AND VendorRegex
LET Unquote(Value) = if(condition=Value =~ '''\A"[^"]+"\z''',
then=regex_replace(source=Value, re='^"|"$', replace=''), else=Value)
-- Exact candidates only. Extensionless DLL/CPL/SYS launches are not accepted.
LET LaunchEqualsImage(Image, Launch) = any(
items=[
Image,
basename(path=Image, path_type="windows"),
if(condition=Image =~ '''\.exe\z''',
then=regex_replace(
source=basename(path=Image, path_type="windows"),
re='''\.exe\z''', replace=''),
else="")
],
filter="candidate=>candidate AND Launch = candidate")
LET VerifiedPublisher(Signer) = regex_replace(
source=Signer, re='''(?-i)^\(verified\) ''', replace='')
LET PathMatch(Image, Launch, Signer) =
Signer =~ '''(?-i)^\(verified\) .+'''
AND Image =~ '''^[a-z]:\\(?:[^\\/:*?"<>|\x00-\x1f\x7f]+\\)*[^\\/:*?"<>|\x00-\x1f\x7f]+\.(?:exe|dll|cpl|sys)\z'''
AND NOT Image =~ '''\\\.\.?\\'''
AND LaunchEqualsImage(Image=Image, Launch=Launch)
AND any(items=ActivePathRules,
filter="rule=>Image =~ rule.ImagePathRegex AND VerifiedPublisher(Signer=Signer) =~ rule.VendorRegex")
LET IsPathKnown(ImageValue, LaunchValue, SignerValue) =
len(list=ActivePathRules) > 0
AND PathMatch(
Image=Unquote(Value=NormalizeText(Value=ImageValue)),
Launch=Unquote(Value=NormalizeText(Value=LaunchValue)),
Signer=NormalizeText(Value=SignerValue))
LET Eligible = SELECT * FROM Collected
WHERE Enabled = "enabled"
AND (`Image Path` OR `Launch String`)
AND NOT `Image Path` =~ '^File not found:'
LET IsKnown(CategoryValue, ImageValue, LaunchValue, SignerValue) =
any(items=GoldenRules,
filter="rule=>CategoryValue =~ rule.Category AND ImageValue =~ rule.ImagePath AND LaunchValue =~ rule.LaunchString AND SignerValue =~ rule.Signer")
SELECT * FROM if(condition=CollectAll,
then={ SELECT * FROM Collected },
else={
SELECT * FROM if(condition=Ready, then={
SELECT * FROM Eligible
WHERE NOT IsPathKnown(
ImageValue=`Image Path`,
LaunchValue=`Launch String`,
SignerValue=Signer)
AND NOT IsKnown(
CategoryValue=NormalizeText(Value=Category),
ImageValue=NormalizePath(Value=`Image Path`),
LaunchValue=NormalizePath(Value=`Launch String`),
SignerValue=NormalizeText(Value=Signer))
})
})