20
INTRODUCING OSSEC host-based IDS Saturday 21 st November, 2015 Theresa Meiksner BSidesVienna 0x7DF (2015)

Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Embed Size (px)

Citation preview

Page 1: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

INTRODUCING OSSEChost-based IDS

Saturday 21st November, 2015

Theresa Meiksner

BSidesVienna 0x7DF (2015)

Page 2: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Overview

1. What is OSSEC?

2. Architectural overview

3. Why do we need log analysis?

4. How to detect a rootkit with OSSEC?

5. ELK Stack Integration

6. Live-DEMO

2

Page 3: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

whoami

# SysAdmin@s-itsolutions# [email protected]# http://www.aremai.net

# http://github.com/aremai

# [email protected]

3

Page 4: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

What is OSSEC?

Page 5: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

What is OSSEC?

OSSEC is a open-source host-based intrusion detection system.

Main tasks

# Log analysis# File Integrity Monitoring (UNIX &Windows)# Host-based anomaly detection (rootkit detection)# Real time alerting & Active Response

# http://www.ossec.net

# http://www.github.com/ossec/ossec-hids

5

Page 6: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Architectural overview

Page 7: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

OSSEC Processes

7

Page 8: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

OSSEC Processes

# Each process is executed with limited privileges and tasks◦ all processes (except for logcollector) run in a chroot

environment◦ all processes (except for logcollector) are executed with

separate (unprivileged) users

# /var/ossec/bin/ossec-control start script that executes theOSSEC processes in the right order.

8

Page 9: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Network Communication

# compresses the log messages with zlib# encrypted channel with pre-shared keys (blowfish)# syslog protocol UDP port 1514 (FW clearance!)

9

Page 10: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Log Flow (agent/server)

# ossec-logcollector on the agent collects all the logs# ossec-analysisd on the manager analysis the log entries# ossec-maild sends out alerts# ossec-execd used for Active Response (Real-Time Alerting)

10

Page 11: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Internal Log Flow

# 3 parts:◦ Pre-decoding (extracts known fields from the Syslog

header)◦ Decoding (identifies key information: SRC IP, Username)◦ Signatures (user-defined rules)

11

Page 12: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Why do we need log analysis?

Page 13: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Why analyze logs?

# logs are essential for troubleshooting a problem# not just intrusions or potential security risks# but also identifying everyday problems# without logs you have no idea what’s happening on your

system.

13

Page 14: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

How to detect a rootkit withOSSEC?

Page 15: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

How can we detect them?

# OSSEC monitors changes of files, directories andcommands by performing file integrity checks on thesefiles. –> syscheck module.

# file integrity monitoring: comparing _current_ checksums(hashes) of files with known “good” hashes.

# directories that are hashed by default include: /bin,/usr/bin, /sbin, /usr/sbin and /etc

# Interval of each syscheck: 79200 seconds (22 hours) easilyconfigurable in /var/ossec/etc/ossec.conf

# two files for rootkit detection in OSSEC:◦ rootkit_files.txt contains a list of file names known to be

user mode rootkits.◦ rootkit_trojans.txt contains signatures that known rootkits

have embedded in the binary file. by default the binaries in/bin, /sbin, /usr/bin and /usr/sbin are searched.

15

Page 16: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Signature detection

# Rootcheck module extracts strings from binaries and uses aRegEx to identify a match. Referred to as “signaturedetection” -> many rootkits contain unique strings introjaned versions of Linux utilities, e.g ps or netstat.

# additional signatures can be added to therootkit_trojans.txt

# Rootcheck module generates an alert if there’s adiscrepancy in information about a file, process port ornetwork interface.

# relevant linux utitilies for Rootkits are:◦ ps◦ stat◦ netstat

16

Page 17: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

ELK Stack Integration

Page 18: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

enhanced OSSEC with ELK Stack Integration

18

Page 19: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Links

# http://www.ossec.net

# http://github.com/ossec/ossec-hids

# http://github.com/wazuh

# http://www.wazuh.com

19

Page 20: Introducing OSSEC - host-based IDS · INTRODUCING OSSEC host-based IDS Saturday21st November,2015 Theresa Meiksner BSidesVienna0x7DF ... ELK Stack Integration. enhanced OSSEC with

Live-DEMO