How to (passively) understand the application layer? Packet Monitoring



Similar documents
Bro at 10 Gps: Current Testing and Plans

The Bro Network Intrusion Detection System

The Open Source Bro IDS Overview and Recent Developments

Intrusion Detection Systems

An Overview of the Bro Intrusion Detection System

A host-based firewall can be used in addition to a network-based firewall to provide multiple layers of protection.

Protocols. Packets. What's in an IP packet

How To Monitor A Network On A Network With Bro (Networking) On A Pc Or Mac Or Ipad (Netware) On Your Computer Or Ipa (Network) On An Ipa Or Ipac (Netrope) On

Monitoring Network Security with the Open-Source Bro NIDS

Network Intrusion Detection Systems. Beyond packet filtering

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

Flow-level analysis: wireshark and Bro. Prof. Anja Feldmann, Ph.D. Dr. Nikolaos Chatzis

COMPUTER NETWORK TECHNOLOGY (300)

High-Performance Network Security Monitoring at the Lawrence Berkeley National Lab

The Bro Network Security Monitor. Broverview

Large-Scale TCP Packet Flow Analysis for Common Protocols Using Apache Hadoop

Ethernet. Ethernet. Network Devices

Basic Networking Concepts. 1. Introduction 2. Protocols 3. Protocol Layers 4. Network Interconnection/Internet

Colasoft Capsa Technical White Paper. Maximize Network Value

The OSI and TCP/IP Models. Lesson 2

Wireshark in a Multi-Core Environment Using Hardware Acceleration Presenter: Pete Sanders, Napatech Inc. Sharkfest 2009 Stanford University

EXPLORER. TFT Filter CONFIGURATION

Validate the performance and security of IPS/IDS, Firewall and Proxy - January 2009

Flow Analysis Versus Packet Analysis. What Should You Choose?

Intrusion Detection System

CS2107 Introduction to Information and System Security (Slid. (Slide set 8)

The Cisco IOS Firewall feature set is supported on the following platforms: Cisco 2600 series Cisco 3600 series

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

Network Forensics: Log Analysis

Managing Latency in IPS Networks

Firewalls, IDS and IPS

1 Data information is sent onto the network cable using which of the following? A Communication protocol B Data packet

Overview of Computer Networks

Firewalls. Chapter 3

Introduction to Computer Networks

Transport and Network Layer

User Datagram Protocol - Wikipedia, the free encyclopedia

How do I get to

Access Control: Firewalls (1)

Basic Network Configuration

Overview of TCP/IP. TCP/IP and Internet

First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring

Network Instruments white paper

How To Monitor And Test An Ethernet Network On A Computer Or Network Card

Network Programming TDC 561

Objectives of Lecture. Network Architecture. Protocols. Contents

Network Traffic Analysis

A Bro Walk-Through. Robin Sommer International Computer Science Institute & Lawrence Berkeley National Laboratory

Intrusion Detection in AlienVault

Firewall VPN Router. Quick Installation Guide M73-APO09-380

IP Networking. Overview. Networks Impact Daily Life. IP Networking - Part 1. How Networks Impact Daily Life. How Networks Impact Daily Life

Detecting rogue systems

Computer Networks CS321

Technical Support Information Belkin internal use only

Multi-Homing Dual WAN Firewall Router

Transport Layer Protocols

Network Pop Quiz 5 Brought to you by please visit our site!

Course Description and Outline. IT Essential II: Network Operating Systems V2.0

Network Security. Network Packet Analysis

TCP/IP Protocol Suite. Marshal Miller Chris Chase

Layered Architectures and Applications

Firewalls. Ingress Filtering. Ingress Filtering. Network Security. Firewalls. Access lists Ingress filtering. Egress filtering NAT

Network Simulation Traffic, Paths and Impairment

Network Security: Workshop

The Bro Network Security Monitor. Broverview. Bro Workshop NCSA, Urbana-Champaign, IL. Bro Workshop 2011

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

Firewalls. Pehr Söderman KTH-CSC

Network Security Monitoring

Analysis and Evaluation of Network-Based Intrusion Detection and Prevention System in an Enterprise Network Using Snort Freeware

Firewall Firewall August, 2003

The OSI & Internet layering models

Network Security. Chapter 3. Cornelius Diekmann. Version: October 21, Lehrstuhl für Netzarchitekturen und Netzdienste Institut für Informatik

Outline. CSc 466/566. Computer Security. 18 : Network Security Introduction. Network Topology. Network Topology. Christian Collberg

Barracuda Intrusion Detection and Prevention System

Course Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network.

LPC2300/LPC2400 TCP/IP Overview. TCP/IP and LPC2300/LPC2400 Family October 2007

Chapter 6 Configuring the SSL VPN Tunnel Client and Port Forwarding

Security+ Guide to Network Security Fundamentals, Fourth Edition. Chapter 6 Network Security

Firewalls. Firewalls. Idea: separate local network from the Internet 2/24/15. Intranet DMZ. Trusted hosts and networks. Firewall.

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

LESSON Networking Fundamentals. Understand TCP/IP

Network Terminology Review

P Principles of Network Forensics P Terms & Log-based Tracing P Application Layer Log Analysis P Lower Layer Log Analysis

Virtual Private Network Using Peer-to-Peer Techniques

Guide to Network Defense and Countermeasures Third Edition. Chapter 2 TCP/IP

Cisco IOS Flexible NetFlow Command Reference

Load Balance Router R258V

Stateful Inspection Technology

NetFlow/IPFIX Various Thoughts

Cape Girardeau Career Center CISCO Networking Academy Bill Link, Instructor. 2.,,,, and are key services that ISPs can provide to all customers.

IP address format: Dotted decimal notation:

Data Collection and Analysis: Get End-to-End Security with Cisco Connected Analytics for Network Deployment

Chapter 2 Quality of Service (QoS)

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

CompTIA Network+ (Exam N10-005)

Transcription:

How to (passively) understand the application layer? Packet Monitoring 1

What to expect? Overview / What is packet monitoring? How to acquire the data Handling performance bottlenecks Analyzing the transport and application layer (Mis-)Using the Bro Network Intrusion Detection System (NIDS) for network measurements 2

What is a packet monitor? Measuring / recording network data on a per packet basis Ordinary (although high-end) PC hardware Datapath: Network Network Card PCI-Bus Monitor Disks PCI-Bus CPU and Mem Kernel Usersp. Kernel 3

Passive Monitoring: Challenges (1) User privacy & network security Data privacy vs. data sharing Data filtering Tap into live network traffic and extract packets Must not interfere with normal packet transmission Real-time: cannot control bandwidth, cannot postpone work 4

Passive Monitoring: Challenges (2) Performance Issues High data rate Bandwidth limits on CPU, I/O, memory, and disk/tape Network cards optimized for bi-directional data transfer, not capturing High data volume Space limitations in main memory and on disk/tape Could do online analysis to sample, filter, & aggregate High processing load CPU/memory limits for extracting, counting, & analyzing Could do offline processing for time-consuming analysis General solutions to system constraints Sub-select the traffic (addresses/ports, first n bytes) Kernel and interface card support for measurement 5

Monitoring Links: Overview How to get data off the network, without interfering normal transmission? For half-duplex: Shared medium Hub For full-duplex: Monitor / SPAN port "Tap" 6

Monitoring Links (1) Half Duplex: host cannot send and receive at the same time. Only one host can send. Hub (packets are sent to all ports) Host A Host B H u b Host C Monitor Shared media (Ethernet, wireless) every node sees all packets Host A Host B Monitor 7

Monitoring Links (2) Full Duplex: host can send and receive at the same time Monitoring- / SPAN port on switch every packet seen by switch copied to SPAN port easy (every switch supports this) all sending host are aggregated into one monitoring link ==> Packet loss Host A Host B Monitor SPAN Switch 8

Monitoring Links (3) Full Duplex Tap into data Only between two nodes (routers) Can capture all traffic Need two receive ports on Monitor Fiber: purely optical Copper: needs active components Router A TX RX Tap RX TX Router B Monitor 9

Handling Performance Bottlenecks 10

Handling high bandwidth Hard for monitors to cope with high load Interrupt VS Polling Long datapath: data copied several times => Ring buffer Timestamping? Dedicated network monitoring cards Often several ports (for Taps) Filtering / aggregation in hardware on card Very expensive (EUR 3,500 for 1G, EUR 20k for 10G) Split or aggregate traffic utilizing off-the-shelf switching hardware 11

Ring buffers Physical chunk of RAM provided by driver Organized as logical ring Mapped into user-space when capturing Buffer handling: write pointer advanced By driver if ordinary network card or In hardware by monitoring card, e.g., DAG User-space process captures data Advances read pointer Writes to disk or live analysis Use DMA if possible! Cell 0 Cell 1 Cell 2 Cell 3 Cell n-1 12

Analyzing the transport and application layer How to get from packets to connections (TCP, UDP) to application level protocols (HTTP, DNS, etc.) 13

Packet VS Connections VS Applications Monitors deliver single packets Lots of measurements one can do on per packet basis Timing, packet sizes, routing, IP stats,... More measurements on transport layer (TCP/UDP) Timing, connection size,... But often we want to analyze application layer protocols (e.g., HTTP, SIP, etc.) 14

Application-level Messages Application-level transfer may span multiple packets Demultiplex packets into separate flows Identify by source/dest IP addresses, ports, and protocol Maybe also application level identifiers 15

Application-level Messages: Reassembly Reconstructing ordered, reliable byte stream De-fragment fragmented IP packets Reassemble TCP segments Sequence number and segment length in TCP header Buffer to deliver packets in correct order to analyzer Drop duplicates Packets might be missing (measurement drops) Packet might be truncated 16

Application-level Messages: Reassembly (2) Inconsistent retransmissions TCP retransmission, but data does not match Need state per connection How many connections? How do you handle attacks, e.g., network scans? Idle connections Is teardown missing? Is there going to be more data? Cannot keep state forever (memory exhaustion) => need strategy for state removal 17

Application-level Messages Extraction of application-level messages Parsing the syntax of the application-level Clients/Servers may not adhere to specification Identifying the start of the next message, e.g., HTTP Absence of body Presence of Content-Length Chunk-encoded message Multipart/byterange End of TCP connection 18

(Mis-)Using the Bro Intrusion Detection System for Network Measurement 19

What is a NIDS? Network Intrusion Detection System (NIDS) Monitors network traffic to detect attacks in real-time Reports suspicious activity to operator A NIDS has to be robust To protect itself from direct attacks To detect / prevent evasions Must be careful to not exhaust its resources (memory, CPU, disk) 20

Why use a NIDS for measurement? To perform its task a NIDS has to De-Fragment IP packets Reassemble TCP connections (and cope with inconsistencies and packet loss) Keep track of connections, manage state Track resource usage Parse Application-layer protocols Extract Application-layer messages and data elements e.g., URLs, etc. Handle broken protocol implementations All this things are also relevant to measurement 21

Bro: an open source NIDS Bro is open source Developed by Vern Paxson (UC Berkeley) Used as productive and research system Is modular and easy to extend We use it heavily As NIDS to protect our network Conduct NIDS research Conduct network measurements 22

Bro System Philosophy Fundamentally, Bro provides a real-time network analysis framework Emphasis on Application-level semantics rare to analyze individual packets Tracking information over time Both within and across connections Also archiving for later off-line analysis Strong separation of mechanism and policy Much of the system is policy-neutral. I.e., no presumption of "good" or "bad" 23

Bro features Full TCP stream reassembly Stateful protocol analysis Dynamic Protocol Analysis (DPD) BinPAC a network protocol description language Very flexible policy language (called Bro as well) Specialized for traffic analysis Strongly typed for robustness (conn_id, addr, port, time, ) Can trigger alarms and/or program execution Supports dynamic timeouts Clustering support for analysis of multi Gbps links Cooperates with Network Time Machine 24

Inside Bro Network Passive link tap copies all traffic 25

Inside Bro Tcpdump! Filter" libpcap Filtered Packet! Stream" Kernel filters high-volume stream Packet Stream" Network 26

Inside Bro Event! Control" Event Engine Tcpdump! Filter" libpcap Event! Stream" Network Filtered Packet! Stream" Packet Stream" Event engine produces policy-neutral events, e.g.: Connection-level: connection attempt connection finished Application-level: ftp request http_reply Activity-level: login success 27

Inside Bro Policy! Script" Policy Script Interpreter Event! Control" Event Engine Tcpdump! Filter" libpcap Real-time Notification! Record To Disk" Event! Stream" Filtered Packet! Stream" Policy script incorporates: Context from past events Site s particular policies and takes action: Records to disk Generates alerts Executes programs as response Packet Stream" Network 28

Event Engine Event engine performs generic analysis Also termed the "Core" Written in C++ Basic element of analysis is a "connection" De-fragment IP Reassemble TCP streams Pass reassembled TCP (UDP) streams to application-level analyzers Event engine uses an analyzer tree 29

Event Engine Analzyer tree TCP IP UDP IMAP SMTP HTTP DNS Tree elements can tune-out if not their protocol Data transforms as it flows through analyzers E.g., packets -> byte stream -> lines of text As analyzers observe activity, they generate events Events span several aggregation levels All events triggered by a given packet executed before next packet is processed 30

Bro s protocol analyzers Full analysis HTTP, FTP, telnet, rlogin, rsh, RPC, DCE/RPC, DNS, Windows Domain Service, SMTP, IRC, POP3, NTP, ARP, ICMP, Finger, Ident, Gnutella, BitTorrent, NNTP, Partial analysis NFS, SMB, NCP, SSH, SSL, IPv6, TFTP, AIM, Skype, In progress BGP, DHCP, Windows RPC, SMB, NetBIOS, NCP, Data sources DAG, libpcap, NetFlow 31

How to write an analyzer (1) Derive from TCP_ApplicationAnalyzer Implement interface methods Constructor & Destructor DeliverStream // Receives new in-order data Undelivered Done // called if packet drop detected // removed from Connection table Other methods as needed: EndpointEOF, Connection {Closed,Finished,Reset}, For UDP: directly derive from Analyzer, implement DeliverPacket rather than DeliverStream 32

How to write an analyzer (2) Make sure your analyzer is used Register it in Analyzer::analyzer_configs[] Trigger analyzer, e.g., via DPD signatures: signature dpd_bittorrent_peer1 { ip-proto == tcp payload /^\x13bittorrent protocol/ tcp-state originator } signature dpd_bittorrent_peer2 { ip-proto == tcp payload /^\x13bittorrent protocol/ tcp-state responder requires-reverse-signature dpd_bittorrent_peer1 enable "bittorrent" } 33

How to write an analyzer (3) Use BinBAC if possible: type BitTorrent_Request = record { } &let { }; Throw events index: uint32; begin: uint32; length: uint32; deliver: bool = $context.flow.deliver_request(index, begin, length); Register in event.bif Makes event available in policy layer Gives method for throwing for free Events expensive: only throw if handler registered! 34

Advanced analyzer features and tricks Support analyzers Preprocess data in an analyzer E.g., ContentLine_Analyzer Jump over missed packets Register expected connections in DPD E.g., FTP data, BT peer traffic after tracker request, 35

Policy Script Layer Bro specific scripting language Procedural Strong support for network data types (IPs, subnets, ports, etc.) Provides support for state management Receives (and processes) events from Event Engine Can also generate further events, that are handled by other policy scripts Tradeoffs: where to implement functionality Event Engine is fast; Script Layer is easy to implement Event Engine processes protocols, Script Layer implements policy 36

Native functions Scripting relies on native implementation of some functions Basic functionality, e.g, fmt() Faster execution, e.g., cat_string_array() Event declaration Use bifcl to implement function cat_string_array%(a: string_array%): string %{ TableVal* tbl = a->astableval(); return new StringVal(cat_string_array_n(tbl, 1, a->astable()->length())); %} 37

Scripting basics Types: bool, int, count, enum, double, enum, string, addr, port, net, subnet, time, interval Custom types via record table and set Regular expressions Types derived from assignment Scope: global, const, local Attributes: &redef, &default, &optional, Functions and event handlers 38

Policy state management Often policy is used to combine different events => requires state Remove state on event connection_state_remove Tables and sets have expire functions From netflow.bro: global flows: table[conn_id] of flow &write_expire = 31 min &expire_func = print_flow; 39

Bro policy example global ssh_log = open_log_file("ssh") &redef; global did_ssh_version: table[addr, bool] of count &default = 0 &read_expire = 7 days; event ssh_client_version(c: connection, version: string) { if ( ++did_ssh_version[c$id$orig_h, T] == 1 ) print ssh_log, fmt("%s %s \"%s\"", c$id$orig_h, "C", version); skip_further_processing(c$id); } event ssh_server_version(c: connection, version: string) { if ( ++did_ssh_version[c$id$resp_h, F] == 1 ) print ssh_log, fmt("%s %s \"%s\"", c$id$resp_h, "S", version); } 40

Advanced scripting Schedule actions into the future: schedule Starts timer to execute a function Asynchronous operation: when statement Delays execution of current handler until a condition is met Keep state over invocations: &persistent 41

Bro in measurement practice Often: run offline for repeatability If live, use traffic splitter to utilize multiple CPU cores Use policy to dump relevant data, analyze log with Bash/Python/AWK/Perl script 42

Advanced Bro Features Broccoli = Bro Client Communications Library C interface for external programs to transmit & receive values and events Support for external analyses Antivir, libmagic, GeoIP, passive OS fingerprinting... Cluster Bro Distribute load across multiple machines Merge event stream to central controller Network traffic time machine selective replay of past connections for further analysis Cutoff for extended traffic storage 43