-
Notifications
You must be signed in to change notification settings - Fork 262
client monitoring artifacts for process creation and high privileged logons #1096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: Generic.Events.Processes | ||
| author: Herbert Bärschneider, SEC Consult | ||
| description: | | ||
| This artifact is meant for monitoring processes on clients. It is usable on every operating system supported by Velociraptor. | ||
| It periodically queries the existing processes and emits lines for differences (new processes and missing/removed ones). | ||
| Processes are tracked and compared based on the following elements: process ID, parent process ID, SID of the process owner, username, process name, executable associated with the process, commandline of the process | ||
|
|
||
| type: CLIENT_EVENT | ||
|
|
||
| parameters: | ||
| - name: Period | ||
| default: 2 | ||
| type: int | ||
| description: how many seconds the artifact waits between checking processes for changes | ||
|
|
||
| sources: | ||
| - query: | | ||
| LET RunningProcesses = SELECT *, format(format="%v %v %v %v %v %v %v", args=[Pid, Ppid, OwnerSid, Username, Name, Exe, CommandLine]) AS DiffKey FROM pslist() | ||
|
|
||
| LET EventQuery = SELECT * FROM diff(query=RunningProcesses, period=Period, key="DiffKey") | ||
|
|
||
| SELECT * FROM EventQuery | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| name: Windows.Events.ETWProcesses | ||
| author: Herbert Bärschneider, SEC Consult | ||
| description: | | ||
| This artifact is meant for monitoring processes on Windows clients. | ||
| It uses Kernel ETW providers to notice process creations and terminations. | ||
|
|
||
| Requirements: | ||
| - Velociraptor Client and Velociraptor Server need version v0.74 or newer (or else the feature is just not supported and won't work at all) | ||
|
|
||
| type: CLIENT_EVENT | ||
|
|
||
| sources: | ||
| - query: | | ||
| SELECT *, atoi(string=EventData.ProcessId) AS Pid, atoi(string=EventData.ParentId) AS Ppid | ||
| FROM watch_etw(guid='kernel', kernel_tracer_type=['process']) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using the Microsoft-Windows-Kernel-Process provider instead - the kernel provider is very chatty and can result in higher CPU loads. https://sigma.velocidex.com/docs/models/windows_etw_base/#etwwindowsprocess Also this artifact is better used with the process tracker. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: Windows.Events.HighPrivilegedLogon | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is probably better implemented as a sigma rule https://sigma.velocidex.com/docs/artifacts/windows.hayabusa.monitoring/ |
||
| author: Herbert Bärschneider, SEC Consult | ||
| description: | | ||
| Artifact to detect logons that get special privileges assigned. The artifact monitors for security event id 4672. | ||
| This is useful to see where accounts with high privileges are being actively used. | ||
|
|
||
| Be aware, there is lots of noise from NT_AUTHORITY\SYSTEM and the machine account of a system. These are filtered out for you. | ||
|
|
||
| type: CLIENT_EVENT | ||
|
|
||
| parameters: | ||
| - name: eventLog | ||
| default: C:\Windows\system32\winevt\logs\Security.evtx | ||
| - name: PrivilegesRegex | ||
| type: regex | ||
| description: Regex for the privileges you care about | ||
|
|
||
| sources: | ||
| - precondition: | ||
| SELECT OS From info() where OS = 'windows' | ||
| query: | | ||
| LET files = SELECT * FROM glob(globs=eventLog) | ||
|
|
||
| SELECT timestamp(epoch=System.TimeCreated.SystemTime) As EventTime, | ||
| System.EventRecordID as EventRecordID, | ||
| System.EventID.Value as EventID, | ||
| System.Computer as SourceComputer, | ||
| EventData.SubjectUserName as SubjectUserName, | ||
| EventData.PrivilegeList as PrivilegeList, | ||
| System, | ||
| EventData, | ||
| Message | ||
| FROM foreach( | ||
| row=files, | ||
| async=TRUE, | ||
| query={ | ||
| SELECT * | ||
| FROM watch_evtx(filename=OSPath) | ||
| WHERE System.EventID.Value = 4672 | ||
| AND EventData.PrivilegeList =~ PrivilegesRegex | ||
| AND NOT ((EventData.SubjectUserName =~ "SYSTEM" AND EventData.SubjectDomainName =~ "NT AUTHORITY") OR EventData.SubjectUserName =~ "\$$") | ||
| }) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically what the process tracker does a lot better :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the process tracker available for all supported operating systems? Ive only seen it for Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is available always - you can read more about it here
https://docs.velociraptor.app/blog/2022/2022-08-17-process-tracker/
https://docs.velociraptor.app/artifact_references/pages/linux.events.trackprocesses/
This artifact is most similar to your idea since it only uses pslist
https://docs.velociraptor.app/artifact_references/pages/windows.events.trackprocessesbasic/
This one uses sysmon events as well
https://docs.velociraptor.app/artifact_references/pages/windows.events.trackprocesses/