Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

mike arpaia / facebook host intrusion detection with osquery

Slide 3

Slide 3 text

javier marcos / facebook ted reed / facebook mimeframe / facebook

Slide 4

Slide 4 text

what’s the problem?

Slide 5

Slide 5 text

it’s a hard problem we’re all trying to catch attackers •insider threats •espionage
 •external threats •APT •hacktivists •mass malware •the list is endless

Slide 6

Slide 6 text

we need help we’re all deploying tools •many of us have too many vendor products •often times, a product solves too narrow of a use-case •new use-case? new vendor •mo’ money and mo’ problems

Slide 7

Slide 7 text

we live in a windows centric world •more OS X laptops •most production infrastructure runs on Linux
 •few are successfully instrumenting their OS X and Linux hosts •how would we solve that problem? but, times are changing

Slide 8

Slide 8 text

desired properties

Slide 9

Slide 9 text

simple performant and reliable easy to integrate flexible

Slide 10

Slide 10 text

simple •no complex coding for users •low-level details should be abstracted •easy to use, deploy and maintain

Slide 11

Slide 11 text

performant and reliable •host degradation is unacceptable •sane resource utilization over time
 •company services should not be impacted
 •extensive logging and metrics

Slide 12

Slide 12 text

easy to integrate •every company has existing infrastructure •distributed configurations •real-time logging •data warehousing
 •you should have the option to use existing infrastructure to help power your host instrumentation

Slide 13

Slide 13 text

flexible •host instrumentation can help solve many problem domains •intrusion detection •vulnerability management •reliability •compliance •< insert domain here >
 •having a single solution reduces cognitive overhead and time spent

Slide 14

Slide 14 text

osquery

Slide 15

Slide 15 text

SQL for your infrastructure osquery use SQL queries to explore OS state •running processes •loaded kernel modules •active network connections •route table •firewall settings •installed software •and more

Slide 16

Slide 16 text

osqueryi

Slide 17

Slide 17 text

LaunchDaemons which run a binary at boot

Slide 18

Slide 18 text

running processes

Slide 19

Slide 19 text

processes listening on ports

Slide 20

Slide 20 text

more tables are being written every day many tables are available •alf •alf_exceptions •alf_explicit_auths •alf_services •apps •ca_certs •cpuid •etc_hosts •groups •homebrew_packages •interface_addresses •interface_details •kextstat •last •launchd •listening_ports •nvram •osx_version •passwd_changes •processes •routes •suid_bin •time •users

Slide 21

Slide 21 text

use simple tables, together osquery enables complex analysis by allowing users to join and aggregate across several simple tables •simple tables have many advantages •easier to write •easier to maintain •can be used in many contexts

Slide 22

Slide 22 text

osqueryd

Slide 23

Slide 23 text

daemon for low-level host monitoring osqueryd know how the results of a query change over time •schedule a query on your hosts via a config
 •the daemon takes care of periodically executing your queries •buffers results to disk and generates a log of state changes •logs results for aggregation and analytics

Slide 24

Slide 24 text

event-based operating system introspection host event pub/sub stream subscribe to key OS events to create dynamically growing tables •subscribe to “publishers” •filesystem changes (inotify, FSEvents) •network setting changes (SCNetwork) •query the history of your host, as it evolves

Slide 25

Slide 25 text

for config distribution and data infrastructure plugin system •simple plugin API •specify your plugins at runtime with a command-line flag filesystem http zookeeper configuration filesystem flume scribe logging

Slide 26

Slide 26 text

#include "osquery/logger/plugin.h" #include namespace osquery { class GlogPlugin : public LoggerPlugin { public: Status logString(const std::string& message) { LOG(INFO) << message; return Status(0, "OK"); } }; REGISTER_LOGGER_PLUGIN("glog", std::make_shared()); } registering a glog plugin

Slide 27

Slide 27 text

tables

Slide 28

Slide 28 text

creating tables is easy easily define what your tables “look like” in Python and use C++ to implement what a full-table scan would return •the Python is used to generate faster C++ code transparently •you write a single C++ function which implements a full-table scan

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

table_name("time") schema([ Column(name="hour", type="int"), Column(name="minutes", type="int"), Column(name="seconds", type="int"), ]) implementation("time@genTime")

Slide 31

Slide 31 text

namespace osquery { namespace tables { QueryData genTime() { QueryData results; struct tm* now = localtime(time(0)); // this could be done in a loop for many rows Row r; r["hour"] = now->tm_hour; r["minutes"] = now->tm_min; r["seconds"] = now->tm_sec; results.push_back(r); return results; } } }

Slide 32

Slide 32 text

build and test

Slide 33

Slide 33 text

cross-platform build infrastructure osquery supports Ubuntu 12.04+, CentOS 6.5 and OS X 10.8+ •dev tools include vagrant build VMs for all supported platforms •every commit publicly builds on Ubuntu and OS X via TravisCI •use build VMs to build and package osquery in a way that works for you

Slide 34

Slide 34 text

cross-platform build infrastructure OS X pkg creation uses homebrew to manage dependencies •distribute relocatable homebrew artifacts such that they work with employees existing installation $ ./tools/make_osx_package.sh -c ~/Desktop/osquery.conf [+] calculating dependency tree [+] copying dependencies - rocksdb (/usr/local/Cellar/rocksdb/3.5) - boost (/usr/local/Cellar/boost/1.56.0) - gflags (/usr/local/Cellar/gflags/2.0) - glog (/usr/local/Cellar/glog/0.3.3) - thrift (/usr/local/Cellar/thrift/0.9.1) - lz4 (/usr/local/Cellar/lz4/r116) - pkg-config (/usr/local/Cellar/pkg-config/0.28) - snappy (/usr/local/Cellar/snappy/1.1.1) [+] copying osquery binaries [+] copying osquery configurations [+] finalizing preinstall and postinstall scripts [+] creating package [+] package created at ~/git/osquery/osqueryd.pkg

Slide 35

Slide 35 text

many tutorials and guides extensive documentation

Slide 36

Slide 36 text

open source

Slide 37

Slide 37 text

all development happens in the open, on GitHub work on osquery with us the problem that osquery solves isn't unique to facebook •https://github.com/facebook/osquery •http://osquery.io this journey is 1% finished: get involved •we’re excited to take on future challenges in the open •let’s build together

Slide 38

Slide 38 text

what’s next?

Slide 39

Slide 39 text

contribute and help us build an awesome tool what we’re working on there’s a team of great engineers at facebook that are actively working on making osquery awesome for everyone •more tables •ad-hoc remote queries •kernel modules for lower-level behavior monitoring •deep systems visibility

Slide 40

Slide 40 text

questions http://osquery.io