Skip to content

Commit 2b3e63b

Browse files
committed
add lolrmm
1 parent 9c4d099 commit 2b3e63b

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

vql/LolRMM.yaml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Windows.Detection.LolRMM
2+
author: Matt Green - @mgreen27
3+
description: |
4+
This artifact hunts for Remote Monitoring and Management (RMM) tools using the
5+
LolRMM project.
6+
7+
Detectraptor generates a Regex csv that is pulled locally to the Velociraptor
8+
server via the tools management capability.
9+
10+
NOTE: This artifact may not detect RMMs that are not installed, renamed or
11+
using custom DNS.
12+
13+
Special thanks to Herbert Bärschneider for inspiring this artifact on the
14+
Artifact Exchange. :)
15+
16+
reference:
17+
- https://github.com/mgreen27/DetectRaptor
18+
- https://lolrmm.io/
19+
- https://attack.mitre.org/techniques/T1219/
20+
21+
tools:
22+
- name: DetectRaptorLolRMM
23+
url: https://github.com/mgreen27/DetectRaptor/raw/master/csv/lolrmm.csv
24+
serve_locally: true
25+
26+
type: CLIENT
27+
resources:
28+
timeout: 1200
29+
30+
sources:
31+
- query: |
32+
LET lolrmm <= SELECT OSPath FROM Artifact.Generic.Utils.FetchBinary(
33+
ToolName='DetectRaptorLolRMM',
34+
IsExecutable='N' )
35+
36+
LET lolrmm_csv <= SELECT Name, Description, LolRMMLink, PathRegex, DomainRegex
37+
FROM parse_csv(filename=lolrmm[0].OSPath)
38+
39+
LET process_hits = SELECT Pid,Name as ProcessName,CommandLine,Exe,Authenticode,
40+
parse_pe(file=Exe).VersionInformation as VersionInformation,
41+
_Source
42+
FROM Artifact.Windows.System.Pslist()
43+
WHERE
44+
ProcessName =~ join(array=filter(list=lolrmm_csv.PathRegex, regex="^[^$]"),sep='|')
45+
OR Exe =~ join(array=filter(list=lolrmm_csv.PathRegex, regex="^[^$]"),sep='|')
46+
OR VersionInformation.OriginalFilename =~ join(array=filter(list=lolrmm_csv.PathRegex, regex="^[^$]"),sep='|')
47+
OR VersionInformation.InternalFileName =~ join(array=filter(list=lolrmm_csv.PathRegex, regex="^[^$]"),sep='|')
48+
49+
LET process = SELECT * FROM foreach(row=process_hits,
50+
query={
51+
SELECT _Source as Source,
52+
Name,Description,LolRMMLink,
53+
dict( PathRegex = PathRegex,
54+
DomainRegex=DomainRegex
55+
) as HitRegex,
56+
dict(Pid=Pid,
57+
ProcessName=Name,
58+
Exe=Exe,
59+
CommandLine=CommandLine,
60+
VersionInformation=VersionInformation,
61+
Authenticode=Authenticode
62+
) as Event
63+
FROM lolrmm_csv
64+
WHERE PathRegex
65+
AND ( ProcessName =~ PathRegex
66+
OR Exe =~ PathRegex
67+
OR VersionInformation.OriginalFilename =~ PathRegex
68+
OR VersionInformation.InternalFileName =~ PathRegex )
69+
},workers=20)
70+
71+
LET program_hits = SELECT * FROM Artifact.Windows.Sys.Programs()
72+
WHERE DisplayName =~ join(array=filter(list=lolrmm_csv.Name, regex="^[^$]"),sep='|')
73+
OR ProcessName =~ join(array=filter(list=lolrmm_csv.PathRegex, regex="^[^$]"),sep='|')
74+
75+
SELECT * FROM foreach(row=program_hits,
76+
query={
77+
SELECT _Source as Source,
78+
Name,Description,LolRMMLink,
79+
dict(
80+
PathRegex = PathRegex,
81+
DomainRegex=DomainRegex
82+
) as HitRegex,
83+
dict(
84+
DisplayName=DisplayName,
85+
DisplayVersion=DisplayVersion,
86+
InstallLocation=InstallLocation,
87+
InstallSource=InstallSource,
88+
Publisher=Publisher,
89+
UninstallString=UninstallString,
90+
InstallDate=InstallDate
91+
) as Event
92+
FROM lolrmm_csv
93+
WHERE
94+
( Name AND DisplayName =~ Name )
95+
OR ( PathRegex AND InstallLocation =~ PathRegex )
96+
},workers=20)
97+
98+
- name: ResolvedDomains
99+
query: |
100+
LET dns_hits = SELECT Name as DNSName, *, _Source as Source FROM Artifact.Windows.System.DNSCache()
101+
WHERE DNSName =~ join(array=filter(list=lolrmm_csv.DomainRegex, regex="^[^$]"),sep='|')
102+
103+
SELECT * FROM foreach(row=dns_hits,
104+
query={
105+
SELECT Source,
106+
Name,Description,LolRMMLink,
107+
dict( PathRegex = PathRegex,
108+
DomainRegex=DomainRegex
109+
) as HitRegex,
110+
dict(DNSName=DNSName,
111+
Record=Record,
112+
RecordType=RecordType,
113+
TTL=TTL
114+
) as Event
115+
FROM lolrmm_csv
116+
WHERE DomainRegex AND DNSName =~ DomainRegex
117+
},workers=20)

0 commit comments

Comments
 (0)