Skip to content

Commit dc7a7fd

Browse files
authored
Started to import rules from RegRipper (Velocidex#13)
Also remove some rules that generate a lot of rows in favor of rules that combine multiple values into a Details dict
1 parent 2aebdb2 commit dc7a7fd

12 files changed

Lines changed: 273 additions & 146 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This project maintains a set of `Rules` which are YAML files following
1212
a simple format. This project implements a compiler which compiles
1313
these rules into a VQL artifact that may be consumed by Velociraptor.
1414

15-
The Rule file starts with the attibute Rules and contains a list of
15+
The Rule file starts with the attribute `Rules` and contains a list of
1616
rules:
1717

1818
```

RECmd_Batch/RegistryASEPs.reb

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,38 +1161,7 @@ Keys:
11611161
ValueName: DbgManagedDebugger
11621162
Recursive: false
11631163
Comment:
1164-
-
1165-
Description: Active Setup Installed Components
1166-
HiveType: Software
1167-
Category: ASEP
1168-
KeyPath: Microsoft\Active Setup\Installed Components\*
1169-
ValueName: (default)
1170-
Recursive: false
1171-
Comment:
1172-
-
1173-
Description: Active Setup Installed Components
1174-
HiveType: Software
1175-
Category: ASEP
1176-
KeyPath: Microsoft\Active Setup\Installed Components\*
1177-
ValueName: LocalizedName
1178-
Recursive: false
1179-
Comment:
1180-
-
1181-
Description: Active Setup Installed Components
1182-
HiveType: Software
1183-
Category: ASEP
1184-
KeyPath: Microsoft\Active Setup\Installed Components\*
1185-
ValueName: ShellComponent
1186-
Recursive: false
1187-
Comment:
1188-
-
1189-
Description: Active Setup Installed Components
1190-
HiveType: Software
1191-
Category: ASEP
1192-
KeyPath: Microsoft\Active Setup\Installed Components\*
1193-
ValueName: StubPath
1194-
Recursive: false
1195-
Comment:
1164+
11961165
-
11971166
Description: Command Processor
11981167
HiveType: Software
@@ -2050,30 +2019,6 @@ Keys:
20502019
ValueName: DbgManagedDebugger
20512020
Recursive: false
20522021
Comment:
2053-
-
2054-
Description: Wow6432 Active Setup Installed Components
2055-
HiveType: Software
2056-
Category: ASEP
2057-
KeyPath: Wow6432Node\Microsoft\Active Setup\Installed Components\*
2058-
ValueName: (default)
2059-
Recursive: true
2060-
Comment:
2061-
-
2062-
Description: Wow6432 Active Setup Installed Components
2063-
HiveType: Software
2064-
Category: ASEP
2065-
KeyPath: Wow6432Node\Microsoft\Active Setup\Installed Components\*
2066-
ValueName: ShellComponent
2067-
Recursive: true
2068-
Comment:
2069-
-
2070-
Description: Wow6432 Active Setup Installed Components
2071-
HiveType: Software
2072-
Category: ASEP
2073-
KeyPath: Wow6432Node\Microsoft\Active Setup\Installed Components\*
2074-
ValueName: StubPath
2075-
Recursive: true
2076-
Comment:
20772022
-
20782023
Description: WOW6432 Command Processor Autorun
20792024
HiveType: Software
@@ -2878,13 +2823,6 @@ Keys:
28782823
ValueName: path
28792824
Recursive: true
28802825
Comment:
2881-
-
2882-
Description: Active Setup
2883-
HiveType: ntuser
2884-
Category: ASEP
2885-
KeyPath: Software\Microsoft\Active Setup\Installed Components
2886-
Recursive: true
2887-
Comment:
28882826
-
28892827
Description: Command Processor
28902828
HiveType: ntuser
@@ -3425,13 +3363,6 @@ Keys:
34253363
KeyPath: Software\Policies\Microsoft\WindowsFirewall\StandardProfile\AuthorizedApplications
34263364
Recursive: true
34273365
Comment:
3428-
-
3429-
Description: Wow6432 Active Setup
3430-
HiveType: ntuser
3431-
Category: ASEP
3432-
KeyPath: Software\Wow6432Node\Microsoft\Active Setup\Installed Components
3433-
Recursive: true
3434-
Comment:
34353366
-
34363367
Description: Wow6432 Command Processor
34373368
HiveType: ntuser

Rules/RECmdBatch.yaml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,26 +2079,6 @@ Rules:
20792079
Category: ASEP
20802080
Glob: Microsoft\.NETFramework\DbgManagedDebugger
20812081
Root: HKEY_LOCAL_MACHINE\Software
2082-
- Author: Troy Larson
2083-
Description: Active Setup Installed Components
2084-
Category: ASEP
2085-
Glob: Microsoft\Active Setup\Installed Components\*\@
2086-
Root: HKEY_LOCAL_MACHINE\Software
2087-
- Author: Troy Larson
2088-
Description: Active Setup Installed Components
2089-
Category: ASEP
2090-
Glob: Microsoft\Active Setup\Installed Components\*\LocalizedName
2091-
Root: HKEY_LOCAL_MACHINE\Software
2092-
- Author: Troy Larson
2093-
Description: Active Setup Installed Components
2094-
Category: ASEP
2095-
Glob: Microsoft\Active Setup\Installed Components\*\ShellComponent
2096-
Root: HKEY_LOCAL_MACHINE\Software
2097-
- Author: Troy Larson
2098-
Description: Active Setup Installed Components
2099-
Category: ASEP
2100-
Glob: Microsoft\Active Setup\Installed Components\*\StubPath
2101-
Root: HKEY_LOCAL_MACHINE\Software
21022082
- Author: Troy Larson
21032083
Description: Command Processor
21042084
Category: ASEP
@@ -2660,21 +2640,6 @@ Rules:
26602640
Category: ASEP
26612641
Glob: WOW6432Node\Microsoft\.NETFramework\DbgManagedDebugger
26622642
Root: HKEY_LOCAL_MACHINE\Software
2663-
- Author: Troy Larson
2664-
Description: Wow6432 Active Setup Installed Components
2665-
Category: ASEP
2666-
Glob: Wow6432Node\Microsoft\Active Setup\Installed Components\*\**\@
2667-
Root: HKEY_LOCAL_MACHINE\Software
2668-
- Author: Troy Larson
2669-
Description: Wow6432 Active Setup Installed Components
2670-
Category: ASEP
2671-
Glob: Wow6432Node\Microsoft\Active Setup\Installed Components\*\**\ShellComponent
2672-
Root: HKEY_LOCAL_MACHINE\Software
2673-
- Author: Troy Larson
2674-
Description: Wow6432 Active Setup Installed Components
2675-
Category: ASEP
2676-
Glob: Wow6432Node\Microsoft\Active Setup\Installed Components\*\**\StubPath
2677-
Root: HKEY_LOCAL_MACHINE\Software
26782643
- Author: Troy Larson
26792644
Description: WOW6432 Command Processor Autorun
26802645
Category: ASEP
@@ -3202,11 +3167,6 @@ Rules:
32023167
Category: ASEP
32033168
Glob: '*\Software\Google\Chrome\Extensions\**\path'
32043169
Root: HKEY_USERS
3205-
- Author: Troy Larson
3206-
Description: Active Setup
3207-
Category: ASEP
3208-
Glob: '*\Software\Microsoft\Active Setup\Installed Components\**'
3209-
Root: HKEY_USERS
32103170
- Author: Troy Larson
32113171
Description: Command Processor
32123172
Category: ASEP
@@ -3567,11 +3527,6 @@ Rules:
35673527
Category: ASEP
35683528
Glob: '*\Software\Policies\Microsoft\WindowsFirewall\StandardProfile\AuthorizedApplications\**'
35693529
Root: HKEY_USERS
3570-
- Author: Troy Larson
3571-
Description: Wow6432 Active Setup
3572-
Category: ASEP
3573-
Glob: '*\Software\Wow6432Node\Microsoft\Active Setup\Installed Components\**'
3574-
Root: HKEY_USERS
35753530
- Author: Troy Larson
35763531
Description: Wow6432 Command Processor
35773532
Category: ASEP

Rules/RegRipper.yaml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# These rules are converted from RegRipper
2+
Preamble:
3+
- |
4+
LET GetProviderDllForGUID(GUID) = GetValue(
5+
OSPath="HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + GUID + "\\InProcServer32\\@")
6+
7+
- |
8+
LET _CharToString(X) = SELECT
9+
format(format="%c", args=_value) AS C FROM foreach(row=X)
10+
- LET CharsToString(X) = join(array=_CharToString(X=X).C)
11+
12+
Rules:
13+
- Description: Parse AmCache InventoryApplicationFile
14+
Author: M. Cohen & H. Carvey
15+
Reference: https://github.com/keydet89/RegRipper4.0/blob/main/plugins/amcache.pl
16+
Category: ASEP
17+
Root: Amcache
18+
Glob: Root\\InventoryApplication*\\*
19+
Filter: x=>true
20+
Details: |
21+
x=>FetchKeyValuesWithRegex(OSPath=OSPath, Regex='.')
22+
23+
- Description: Parse AmCache DriverBinary
24+
Author: M. Cohen & H. Carvey
25+
Reference: https://github.com/keydet89/RegRipper4.0/blob/main/plugins/amcache.pl
26+
Category: ASEP
27+
Root: Amcache
28+
Glob: Root\\InventoryDriverBinary\\*
29+
Filter: x=>IsDir
30+
Details: |
31+
x=>FetchKeyValuesWithRegex(OSPath=OSPath, Regex='.') + dict(Driver=OSPath.Basename)
32+
33+
- Description: Parse AmCache InventoryApplicationShortcut
34+
Author: M. Cohen & H. Carvey
35+
Reference: https://github.com/keydet89/RegRipper4.0/blob/main/plugins/amcache.pl
36+
Category: ASEP
37+
Root: Amcache
38+
Glob: Root\\InventoryApplicationShortcut\\*
39+
Filter: x=>true
40+
Details: |
41+
x=>FetchKeyValuesWithRegex(OSPath=OSPath, Regex='.')
42+
43+
- Description: Active Setup Installed Components
44+
Category: ASEP
45+
Root: HKEY_LOCAL_MACHINE\Software
46+
Glob: Microsoft\Active Setup\Installed Components\*
47+
Filter: x=>true
48+
Details: |
49+
x=>FetchKeyValuesWithRegex(OSPath=OSPath, Regex='.')
50+
51+
- Description: Active Setup Installed Components
52+
Category: ASEP
53+
Root: HKEY_LOCAL_MACHINE\Software
54+
Glob: Wow6432Node\Microsoft\Active Setup\Installed Components\*
55+
Filter: x=>true
56+
Details: |
57+
x=>FetchKeyValuesWithRegex(OSPath=OSPath, Regex='.')
58+
59+
- Description: AMSI Providers
60+
Comment: |
61+
The AMSI provider for Windows Defender seems to have been
62+
removed/could not be found.
63+
64+
Analysis Tip: AMSI providers can be used for persistence.
65+
66+
The FeatureBit check determines if Authenicode signing is enabled or not.
67+
0x01 - signing check is disabled; this is the default behavior (applies if value not found)
68+
0x02 - signing check is enabled
69+
Reference: |
70+
https://pentestlab.blog/2021/05/17/persistence-amsi/
71+
72+
Author: M. Cohen & H. Carvey
73+
Category: System Info
74+
Root: HKEY_LOCAL_MACHINE/SOFTWARE
75+
Filter: x=>true
76+
Glob: 'Microsoft\AMSI\Providers\*'
77+
Details: |
78+
x=>dict(
79+
FeatureBits=GetValue(OSPath=OSPath + "FeatureBits"),
80+
ProviderDll=GetProviderDllForGUID(GUID=OSPath.Basename))
81+
82+
- Description: Adobe app cRecentFiles values
83+
Category: Third Party Applications
84+
Root: HKEY_USERS
85+
Glob: /*/Software/Adobe/*/*/AVGeneral/cRecent{Files,Folders}/*
86+
Filter: x=>true
87+
Details: |
88+
x=>FetchKeyValuesWithRegex(OSPath=OSPath, Regex='.') +
89+
dict(Version=OSPath[-4], Software=OSPath[-5],
90+
sDI=CharsToString(X=GetValue(OSPath=OSPath + "sDI")),
91+
sDate=CharsToString(X=GetValue(OSPath=OSPath + "sDate")))
92+
93+
- Description: Check for Windows 11 requirement bypass values
94+
Author: M. Cohen & H. Carvey
95+
Category: System Info
96+
Comment: |
97+
Analysis Tip: The "AllowUpgradesWithUnsupportedTPMOrCPU" value set
98+
to 1 is a hack to allow Windows 11 updates to be installed on
99+
systems that did not meet the TPM or CPU checks. This could be
100+
interpreted as an attempt at defense evasion, by upgrading the
101+
system image to provide additional capabilities, such as Windows
102+
Subsystem for Android.
103+
104+
Reference: https://support.microsoft.com/en-us/windows/ways-to-install-windows-11-e0edbbfb-cfc5-4011-868b-2ce77ac7c70e
105+
Root: HKEY_LOCAL_MACHINE/System
106+
Glob: Setup\{MoSetup,LabConfig}\{AllowUpgradesWithUnsupportedTPMOrCPU,BypassRAMCheck,BypassTPMCheck,BypassSecureBootCheck}
107+
108+
- Description: Gets user's AMSIEnable value
109+
Author: M. Cohen & H. Carvey
110+
Category: System Info
111+
Root: HKEY_USERS
112+
Glob: "*/Software/Microsoft/Windows Script/Settings/AmsiEnable"
113+
Comment: |
114+
Analysis Tip: If the AmsiEnable value is 0, AMSI is disabled.
115+
116+
- Description: Gets contents of user's ApplicationAssociationToasts key
117+
Author: M. Cohen & H. Carvey
118+
Category: System Info
119+
Root: HKEY_USERS
120+
Glob: /*/Software\\Microsoft\\Windows\\CurrentVersion\\ApplicationAssociationToasts
121+
Filter: x=>true
122+
Details: |
123+
x=>FetchKeyValuesWithRegex(OSPath=OSPath, Regex='.')

Rules/Velociraptor-Rules.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,11 @@ Rules:
422422
423423
Details: |
424424
x=>dict(
425-
DefaultMRU=RDPMRU(OSPath=x.OSPath).Server,
425+
DefaultMRU=RDPMRU(OSPath=OSPath).Server,
426426
Servers={
427-
SELECT OSPath.Basename AS Server,
427+
SELECT OSPath.Basename AS Server, Mtime,
428428
FetchKeyValues(OSPath=OSPath) AS Details
429-
FROM glob(accessor="registry", globs='*', root=x.OSPath + "Servers")
429+
FROM glob(accessor="registry", globs='*', root=OSPath + "Servers")
430430
})
431431
432432
- Author: Andrew Rathbun, Mike Cohen

bin/compile.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"archive/zip"
5+
"fmt"
56
"os"
67

78
"github.com/Velocidex/registry_hunter/compiler"
@@ -45,7 +46,7 @@ func makeZip(rules_compiler *compiler.Compiler) error {
4546
return err
4647
}
4748

48-
f, err = w.Create("rules.yml")
49+
f, err = w.Create("rules.txt")
4950
_, err = f.Write([]byte(rules_compiler.GetRules()))
5051
if err != nil {
5152
return err
@@ -77,7 +78,9 @@ func doCompile() error {
7778
for _, filename := range *compile_yaml {
7879
err := rules_compiler.LoadRules(filename)
7980
if err != nil {
80-
return err
81+
fmt.Printf("Error: Unable to load rules from %v: %v\n",
82+
filename, err)
83+
continue
8184
}
8285
}
8386

0 commit comments

Comments
 (0)