wennan.he
10/12/2022, 9:17 PMwennan.he
10/13/2022, 12:47 AMThomas Stromberg
10/13/2022, 12:59 AMwennan.he
10/13/2022, 5:40 PM--disable_events=false
, --enable_file_events=true, --disable_audit=false and --enable_ntfs_event_publisher=true, then i restart osquery but when i login osqueryi and check osquery_flags, i can see the value of them not changed. plz advice.Gaston Beltramelli
10/13/2022, 10:09 PMwennan.he
10/13/2022, 10:10 PMGaston Beltramelli
10/13/2022, 10:12 PMGaston Beltramelli
10/13/2022, 10:12 PMGaston Beltramelli
10/13/2022, 10:13 PMany advice is highly appreciated
wennan.he
10/14/2022, 1:39 AMKarthick
10/14/2022, 3:20 PMwennan.he
10/14/2022, 9:44 PMSlackbot
10/14/2022, 10:08 PMSubash Rajaa
10/17/2022, 1:21 PMSubash Rajaa
10/17/2022, 1:21 PMSubash Rajaa
10/17/2022, 1:22 PMMario Bardowell
10/17/2022, 5:41 PMMario Bardowell
10/17/2022, 5:43 PMMario Bardowell
10/17/2022, 5:43 PM#!/bin/bash
#Download OSQuery and Install with Custom Configuration
echo "Making directory to run installer."
cd /var/tmp
mkdir OSQuery
cd OSQuery
OSqueryInstaller="<https://pkg.osquery.io/darwin/osquery-5.5.1.pkg>"
curl -L -O ${OSqueryInstaller}
echo "Downloading package."
sleep 6
echo "Installing package."
packageName="osquery-5.5.1.pkg"
/usr/sbin/installer -pkg /var/tmp/OSQuery/${packageName} -target /
touch /var/osquery/osquery.conf
echo '{
"options": {
"config_plugin": "filesystem",
"logger_plugin": "filesystem",
"utc": "true"
},
"schedule": {
"system_info": {
"query": "SELECT hostname, cpu_brand, physical_memory FROM system_info;",
"interval": 3600
},
"high_load_average": {
"query": "SELECT period, average, '70%' AS 'threshold' FROM load_average WHERE period = '15m' AND average > '0.7';",
"interval": 900,
"description": "Report if load charge is over 70 percent."
},
"low_free_memory": {
"query": "SELECT memory_total, memory_free, CAST(memory_free AS real) / memory_total AS memory_free_perc, '10%' AS threshold FROM memory_info WHERE memory_free_perc < 0.1;",
"interval": 1800,
"description": "Free RAM is under 10%."
},
"detect all unencrypted SSH keys on disk": {
// The exact query to run.
"query": "SELECT path FROM user_ssh_keys WHERE encrypted = 0;",
// The interval in seconds to run this query, not an exact interval.
"interval": 3600
},
"Fireall Status": {
// The exact query to run.
"query": "SELECT * from alf;",
// The interval in seconds to run this query, not an exact interval.
"interval": 3600
},
"osinfo": {
// The exact query to run.
"query": "SELECT * from os_version;",
// The interval in seconds to run this query, not an exact interval.
"interval": 86400
},
"logged_in_users": {
// The exact query to run.
"query": "select liu.*, p.name, p.cmdline, p.cwd, p.root from logged_in_users liu, processes p where liu.pid = p.pid;",
// The interval in seconds to run this query, not an exact interval.
"interval": 3600
},
"OS Disk Encryption": {
// The exact query to run.
"query": "select * from disk_encryption where name = '/dev/disk3s1s1';",
// The interval in seconds to run this query, not an exact interval.
"interval": 3600
},
"Etc_host": {
// The exact query to run.
"query": "select * from etc_hosts;",
// The interval in seconds to run this query, not an exact interval.
"interval": 3600
},
"Startup Items": {
// The exact query to run.
"query": "select * from startup_items;",
// The interval in seconds to run this query, not an exact interval.
"interval": 86400
}
},
"packs": {
"osquery-monitoring": "/private/var/osquery/packs/osquery-monitoring.conf",
"incident-response": "/private/var/osquery/packs/incident-response.conf",
"it-compliance": "/private/var/osquery/packs/it-compliance.conf",
"osx-attacks": "/private/var/osquery/packs/osx-attacks.conf",
"vuln-management": "/private/var/osquery/packs/vuln-management.conf",
"hardware-monitoring": "/private/var/osquery/packs/hardware-monitoring.conf",
"ossec-rootkit": "/private/var/osquery/packs/ossec-rootkit.conf"
// "windows-hardening": "C:\\Program Files\\osquery\\packs\\windows-hardening.conf",
// "windows-attacks": "C:\\Program Files\\osquery\\packs\\windows-attacks.conf"
}
}' > /var/osquery/osquery.conf
echo "Launch Daemons"
sleep 6
cp /var/osquery/io.osquery.agent.plist /Library/LaunchDaemons
sleep 6
echo "Starting agent."
sleep 6
launchctl load /Library/LaunchDaemons/io.osquery.agent.plist
echo "Cleaning folders and exiting."
cd /var/tmp
rm -r OSQuery
exit 0
slevchenko
10/19/2022, 11:58 AM/proc/${PID/exe}
belongs to corresponding process
SELECT DISTINCT processes.path, (SELECT sha256 FROM hash WHERE path = concat('/proc/', socket.pid, '/exe')) AS sha256, socket.remote_address, socket.remote_port FROM bpf_socket_events socket LEFT JOIN bpf_process_events processes ON socket.pid = processes.pid WHERE socket.remote_port NOT IN (0, 443, 993, 4172, 4195) AND socket.remote_address NOT LIKE '127.0.%.%';
slevchenko
10/19/2022, 12:28 PMslevchenko
10/19/2022, 12:39 PM+------+------------------------------------------------------------------+----------------------+-------------+
| path | sha256 | remote_address | remote_port |
+------+------------------------------------------------------------------+----------------------+-------------+
| | 9e1797de8e2e0c3e8b477727f764f08954eae5dfc97def295b2d100[REDACTED]| <http://XXX.XXX.XXX.XXX|XXX.XXX.XXX.XXX> | 8983 |
+------+------------------------------------------------------------------+----------------------+-------------+
defensivedepth
10/19/2022, 1:42 PMAhmed
10/20/2022, 9:07 AMThomas Stromberg
10/20/2022, 1:49 PMRaghavendra Hiremath
10/20/2022, 1:57 PMRaghavendra Hiremath
10/20/2022, 1:59 PMRaghavendra Hiremath
10/20/2022, 1:59 PMRaghavendra Hiremath
10/20/2022, 2:00 PMNuno Guerreiro
10/21/2022, 7:53 AM