Good morning,
As I mentioned in a previous thread, I am in the process of integrating all osquery queries into Velociraptor. As a first step I want to bring them into Velociraptor as is, using the artifact developed for it.
My question is how to create a single artefact with all the queries included in some osquery packs, should I register them one by one or can I group them inside Velociraptor as if they were an osquery pack?
Thank you very much for your help.
Regards,
C. L. Martinez
--
You received this message because you are subscribed to the Google Groups "velociraptor-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to velociraptor-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/velociraptor-discuss/F79B6F61-25F2-40CC-9858-8761FA350B66%40outlook.com.
Many thanks Mike for your help. As an example:
"process_events":{
"query": "SELECT auid, cmdline, ctime, cwd, egid, euid, gid, parent, path, pid, time, uid FROM process_events WHERE path NOT IN ('/bin/sed', '/usr/bin/tr', '/bin/gawk', '/bin/date', '/bin/mktemp', '/usr/bin/dirname', '/usr/bin/head', '/usr/bin/jq', '/bin/cut', '/bin/uname', '/bin/basename') and cmdline NOT LIKE '%_key%' AND cmdline NOT LIKE '%secret%';",
"interval": 10,
"description": "Process events collected from the audit framework"
},
"socket_events":{
"query": "SELECT action, auid, family, local_address, local_port, path, pid, remote_address, remote_port, success, time FROM socket_events WHERE success=1 AND path NOT IN ('/usr/bin/hostname') AND remote_address NOT IN ('127.0.0.1', '169.254.169.254', '', '0000:0000:0000:0000:0000:0000:0000:0001', '::1', '0000:0000:0000:0000:0000:ffff:7f00:0001', 'unknown', '0.0.0.0', '0000:0000:0000:0000:0000:0000:0000:0000');",
"interval": 10,
"description": "Socket events collected from the audit framework"
},
"file_events": {
"query": "SELECT * FROM file_events;",
"interval": 10,
"description": "File events collected from file integrity monitoring",
"removed":false
},
"apt_sources": {
"query": "SELECT * FROM apt_sources;",
"interval": 86400,
"description": "Display apt package manager sources.",
"snapshot": true,
"platform": "ubuntu"
},
"authorized_keys": {
"query": "SELECT * FROM users CROSS JOIN authorized_keys USING (uid);",
"interval": 86400,
"description": "A line-delimited authorized_keys table."
},
"behavioral_reverse_shell": {
"query": "SELECT DISTINCT(processes.pid), processes.parent, processes.name, processes.path, processes.cmdline, processes.cwd, processes.root, processes.uid, processes.gid, processes.start_time, process_open_sockets.remote_address, process_open_sockets.remote_port, (SELECT cmdline FROM processes AS parent_cmdline WHERE pid=processes.parent) AS parent_cmdline FROM processes JOIN process_open_sockets USING (pid) LEFT OUTER JOIN process_open_files ON processes.pid = process_open_files.pid WHERE (name='sh' OR name='bash') AND remote_address NOT IN ('0.0.0.0', '::', '') AND remote_address NOT LIKE '10.%' AND remote_address NOT LIKE '192.168.%';",
"interval": 600,
"description": "Find shell processes that have open sockets"
},
"cpu_time": {
"query": "SELECT * FROM cpu_time;",
"interval": 3600,
"description": "Displays information from /proc/stat file about the time the CPU cores spent in different parts of the system"
},
"crontab": {
"query": "SELECT * FROM crontab;",
"interval": 3600,
"description": "Retrieves all the jobs scheduled in crontab in the target system."
},
"crontab_snapshot": {
"query": "SELECT * FROM crontab;",
"interval": 86400,
"description": "Retrieves all the jobs scheduled in crontab in the target system.",
"snapshot": true
}
What could be the best approach as you have explained?
From: Mike Cohen <mi...@velocidex.com>
Date: Friday, 29 January 2021 at 14:25
To: Carlos Lopez <clo...@outlook.com>
Cc: "velocirapt...@googlegroups.com" <velocirapt...@googlegroups.com>
Subject: Re: Question regarding ossuary queries integration in Veliciraptor
If you already have OSQuery query packs it should be trivial to write some python to generate the multi source artifact for each pack. Let me know if you need a hand writing such a script...
Thanks
Mike
|
Mike Cohen
Digital Paleontologist,
Velocidex Enterprises
To view this discussion on the web visit https://groups.google.com/d/msgid/velociraptor-discuss/1FD5096A-0656-4179-8874-4EFF785F3019%40outlook.com.
|
Many thanks Wes and Mike. I will try both approaches explained by Wes, and I wil see how it goes …
I will keep you informed.
Regards.
From: Mike Cohen <mi...@velocidex.com>
Date: Saturday, 30 January 2021 at 14:34
To: Wes Lambert <wlamb...@gmail.com>
Cc: Carlos Lopez <clo...@outlook.com>, velociraptor-discuss <velocirapt...@googlegroups.com>
Subject: Re: Question regarding ossuary queries integration in Veliciraptor
So what is the process_events() table ? is it a proper event driven source?
Looking at the source it appears that osquery single shot does not work with "event" tables. Certainly running this query does not work:
$ osquery-4.4.0-linux-amd64 "SELECT * FROM process_events"
W0130 13:32:48.475754 2751042 virtual_table.cpp:967] Table process_events is event-based but events are disabled
W0130 13:32:48.475929 2751042 virtual_table.cpp:974] Please see the table documentation:
https://osquery.io/schema/#process_events
Looking at the code I think it uses the auditd to read these events and so it needs to be constantly running. You can easily convert those queries to VQL (using the auditd() plugin) but this is probably not compatible with shelling out to osquery.
Thanks
Mike
Error! Filename not specified.
Error! Filename not specified.