Performance characterization - PowerPoint PPT Presentation

1 / 65
About This Presentation
Title:

Performance characterization

Description:

Title: PowerPoint Presentation Author: Thomas Woo Last modified by: Soumya Sen Created Date: 10/7/2004 7:04:53 PM Document presentation format: On-screen Show (4:3) – PowerPoint PPT presentation

Number of Views:149
Avg rating:3.0/5.0
Slides: 66
Provided by: Thomas633
Category:

less

Transcript and Presenter's Notes

Title: Performance characterization


1
Performance characterization improvement of
SNORT
  • Soumya Sen, UPenn (ssoumya_at_seas.upenn.edu)
  • Joint work with Thomas Woo Tian Bu (Lucent)
    Advisor Prof. Roch Guerin (UPenn)

2
Overview of the projectPart I Snort background
overall performance
  • What is Snort?
  • - The product companies involved
  • Why is IDS important?
  • - Growing trend in malicious patterns
  • Architecture of Snort
  • Snort rules- syntax
  • Performance of Snort as an NIDS
  • - Results from our experiments
  • - Analysis of the trend

3
PART II Performance evaluation of Snort Pattern
Matching Algorithm
  • Deep Packet Inspection multiple pattern search
  • Aho-Corasick algorithm
  • Data structure supports in Snort
  • - Comparative analysis of the performance for
    different data
  • structures and rule files
  • Our modified implementations on Snort
  • - Johnsons algorithm for Triple Array data
    structure
  • - Aoes data structure for double array
  • Experimental results for performance analysis
  • Conclusions

4
  • PART I
  • SNORT background overall performance measure

5
Introduction to SNORT
  • It is an open source Intrusion Detection System
    (IDS) may also be configured as an Intrusion
    Prevention system (IPS)
  • - As an IDS, Snort may detect security attacks
    and alert the system administrator or take the
    designated action like logging the malicious
    packets.
  • - if we configure Snort as an IPS, then it tries
    to prevent attacks by modifying the iptable to
    drop or reject the suspected packets/stream.
  • Originally developed by Martin Roesch, founder of
    Sourcefire, Inc., MD.
  • Version updates V0.96- 1999, V1-4/28/99,
    V2-4/6/03, latest ver2.6
  • It uses a rule-driven language it combines the
    benefits of signature, protocol and anomaly based
    inspection methods.
  • With more than 3 million of downloads to date,
    Snort is the most widely deployed intrusion
    detection and prevention technology worldwide.
    (Website www.snort.org)

6
Intrusion Detection Systems
  • .. Intrusion Detection addresses a range of
    technologies that are involved in the detection,
    reporting, and correlation of system and network
    security events. - The Hackers Handbook
    (Young, Aitel)
  • An IDS is an alerting system that watches data
    flow at one or more points in the network,
    providing alerts and forensics on suspect or
    malicious traffic.
  • An IPS is a system with a proactive method of
    detecting and preventing malicious traffic, but
    allows admin to provide action upon being
    alerted.
  • Both IDS IPS need real-time pattern matching
    capability at very high speed, working with huge
    rule sets.
  • Snort has been reportedly tested by OSEC (Open
    Security Evaluation Criteria) to provide
    intrusion detection capability at 750 Mbps under
    OSEC test conditions.
  • However, it is a challenge to make it work on
    multi-gigabit applications.

7
Signature, Protocol Anomaly detection
capabilities of Snort with a Rule-driven language
  • Example of Signature Detection Rule
  • Snort handles its signatures based detection
    with the rules created for it. In the second half
    of 2001 we observed new and powerful worms on the
    Net, such as Code Red, Code Red II and Nimda.
  • Scenario 1 Detecting Nimda
  • alert tcp EXTERNAL_NET any -gt HTTP_SERVERS 80
    (msg"WEB-IIS cmd.exe access" flags A
    content"cmd.exe" nocase classtypeweb-applicati
    on-attack sid1002 rev2)
  • Scenario 2 Detecting Code Red II
  • alert tcp any any -gt any 80 (msg "CodeRedII
    root exe" flags A content"root.exe"
    depth624 classtypeattempted-admin)

8
Signature, Protocol Anomaly detection
capabilities
  • Example of protocol Detection Rule
  • Snort is provided with rule set for detecting
    protocols and suspicious behavior of these
    protocols in use. Snort rules have the protocol
    field that allows the detection of the protocol.
  • Scenario 1
  • The following rule detects any scan attempt
    using SYN-FIN TCP packets. The flags keyword is
    used to find out which flag bits are set inside
    the TCP header of a packet.
  • alert tcp any any -gt 192.168.1.0/24 any (flags
    SF msg "SYNC-FIN packet detected")
  • Scenario 2
  • Some tools like Nmap may ping a machine by
    sending a TCP packet to port 80 with ACK flag set
    and sequence number 0. Since this packet is not
    acceptable by the receiving side according to TCP
    rules, it sends back a RST packet. When nmap
    receives this RST packet, it learns that the host
    is alive. (This method works on hosts that don't
    respond to ICMP ECHO REQUEST ping packets). To
    detect this type of TCP ping, our rule will be
    like the following that sends an alert message
  • alert tcp any any -gt 192.168.1.0/24 any (flags
    A ack 0 msg "TCP ping detected")

9
Signature, Protocol Anomaly detection
capabilities
  • Example of Anomaly Detection Rule
  • Many attacks use buffer overflow vulnerabilities
    by sending large size packets. Using the dsize
    keyword in the rule, one can find out if a packet
    contains data of a length larger than, smaller
    than, or equal to a certain number. The following
    rule generates an alert if the data size of an IP
    packet is larger than 6000 bytes.
  • alert ip any any -gt 192.168.1.0/24 any (dsize gt
    6000 msg "Large size IP packet detected")

10
Sourcefire, Inc. The companys role
  • Founded by Martin Roesch in 2001.
  • Sourcefire has also released many versions over
    the years, and has an active team that provides
    very frequent version updates. The frequency of
    releases is graphed below (latest standard
    version 2.4.5, implemental ver 2.6)
  • Business model- VRT provides latest rules at
    195/month, 495/quarter, 1795/year to
    subscribers. Organizes training sessions, onsite
    techinical training, customer support of 3
    classes Standard, Gold, Platinum.

11
Why is IDS important?
  • Severe growth in security threats over the years,
    new software vulnerabilities are being
    discovered.
  • Focus on recent trend
  • 2006-3-31 5759 rules
  • 2006-4-25 6182 rules
  • 2006-6-08 gt6471 rules
  • and the growth in rule sets continues!
  • Larger rulesets -gt performance deterioration,
    packet loss.

12
Snort Rule Syntax
  • Example Rule
  • Action Protocol Address Port Direction
    Address Port Keyword separator
    argument delimiter
  • alert tcp BAD_NETK any ? HOME 80
    (msg GET Match content 47 45 54 )
  • Rule Header
    Rule options
  • Rule Header
  • -static definition
  • -must be present in every rule

Rule options -variable definition -not always
present -50 options available
13
Payload detection rule options Simple to Complex!
  • Snort has simple, flexible rule description
    language to describe how data is to be handled
  • Example 1 DNS Exploit
  • alert tcp EXTERNAL_NET any-gtHOME_NET 53 (msg
    DNS EXPLOIT named 8.2-gt8.2.1 flow to_server,
    established content ../../../ reference
    bugtraq, 788 reference cve, 1999-0833
    classtype attempted-admin sid258 rev 6)
  • - action type Generate alert using selected
    method and then log the packet. (other action
    types pass, activate, dynamic)
  • - protocol TCP (UDP/ICMP/IP)
  • - address single IP/CIDR blocks/list of
    address192.168.1.0/24, 10.1.1.1, negation !
    192.168.1.0/24, or any
  • - port 53. (other types any, !443, 1023,
    1024, 60006010)
  • - rule options msg, flow, content, ref, sid,
    classid, rev.
  • (flow option used along with TCP stream
    reassembly to indicate that rules should apply
    only to certain kind of traffic in this case
    match should occur only when client requests the
    content from the server and the connection is
    already established)

14
Example 2 SubSeven trojan
  • alert tcp EXTERNAL_NET 27374 -gt HOME_NET any
    (msg"BACKDOOR subseven 22" flags A content
    "0d0a5b52504c5d3030320d0a" referencearachnids,
    485 referenceurl,www.hackfix.org/subseven/
    sid103 classtypemisc-activity rev4)
  • - msgBACKDOOR subseven 22 message to appear
    in logs
  • - flags A tcp flags many options, like SA,
    SA, !R, SF
  • - content 0d00a binary data to check in
    packet content without (pipe) characters do
    simple content matches. (Mixed Binary Bytecode
    and Text in a 'content' keyword, eg. Content
    5c 00P00I00P00E00 5c)
  • - reference where to go to look for background
    on this rule
  • - sid103 rule identifier
  • - classtype misc-activity rule type
  • - rev4 rule revision number
  • - other rule options possible, like offset,
    depth, nocase

15
Example 3 Overflow attempt (Complex rule)
  • alert tcp EXTERNAL_NET any -gt HOME_NET
    HTTP_PORTS (msg WEB-IIS MDAC Content-Type
    overflow attempt flowto_server, established
    uricontent /msadcs.dll nocase
    contentContent-Type3A nocase isdataat
    50,relative content!0A within50
    pcre/POST\s/smi reference bugtraq, cve,
    url classtypeweb-application-attack sid 1970
    rev9)
  • Rule Option Text between parentheses is the rule
    option
  • Msg message to be printed along with packet
    dump as part of the log or alert
  • Flow specifies the direction of data flow that
    this rule applies to
  • Content specifies the content to search for in
    the packet payload. The symbol represents
    bytecode for binary data (or the representation
    of binary data in hexadecimal). Multiple content
    searches are specified in this one rule the
    second content option is preceded by a ! (not).
  • Uricontent searches the normalized request URI
    field
  • Isdataat tests to ensure that the payload has
    data at the specified location
  • Pcre allows rules to be written using Perl
    compatible regular expressions
  • Reference provides a set of security references
    and documentation for the alert Classtype
    categorizes alerts to attack classes
  • Sid uniquely identifies a particular signature
    ID
  • Rev identifies the revision of a particular rule.

16
Example 4 Bad file attachment (Complex rule-
PCRE)
  • Snort supports PCRE- Powerful Regular Expression
    Payload analysis.
  • alert tcp HOME_NET any -gt EXTERNAL_NET 25
  • (msgVIRUS OUTBOUND bad file attachment\
  • flowto_server, established\
  • contentContent-Disposition3Anocase\
  • pcre/filename\s\s.?\(?abcdehijlmnoprsvwx
    )(a(depsdfx)c(homlimdpp)d(izllot)e(
    mflxe)h(lpsqta)jse?m(dabewsip)p(pst
    iflmot)r(egtf)s(crhyswf)v(bes?cf
    xd)w(mdfszpdmszscfh)xlstwbatinilnk
    nwsocx)\x27\x22\n\r\s/iR\
  • classtypesuspicious-filename-detect\
  • sid721 rev7)

17
Architecture of Snort
  • General operation
  • Decoder- fits captured packets into data
    structures and identifies link level protocols.
    Then it takes the next level, decodes IP, and
    TCP/UDP to get information about port addresses.
  • Snort alerts for malformed headers, unusual TCP
    option.

18
(Contd..)
  • 2. Preprocessors They are like filters, which
    identifies things that should be checked later in
    Detection Engine module (like suspicious
    connection attempt to some TCP/UDP port or too
    many UDP packets received during a port-scan).
  • 3. Rule files Text files with rule sets written
    with a known syntax.
  • 4. Detection Plug-ins Those modules referenced
    from its definition in the rule files, and they
    are intended to identify patterns whenever a rule
    is evaluated.
  • 5. Detection engine Making use of detection
    plug-ins, it matches packets against rules
    previously charged into memory since snort
    initialization.
  • 6. Output plug-ins Alerts, logs, extern files,
    databases.

19
Snort Internals
  • Snort 2.0 uses a High Performance Multi-Rule
    Inspection engine for detecting patterns. Packets
    are first analyzed by the Rule Optimizer to
    select the appropriate set of rules for
    inspection.
  • The Multi-Rule Inspection engine searches
    for rule matches, builds a queue of detected rule
    matches, and selects best rule match for logging.
  • Process of inspecting Network traffic for
    matches
  • Rule Optimization to produce efficient rule sets
    for inspection
  • Set based inspection algorithms that perform
    high-speed multi-pattern content searches.
  • Parameterized inspection techniques which allow
    for complicated pattern inspection.

20
Rule files statistics
  • Snort version 2.4 has about 45 different rule
    files
  • Eg Attack-responses.rules, Smtp.rules,
    Multimedia.rules, Icmp.rules, Chat.rules,
    Web-client.rules
  • Snort rule statistics
  • A study in Oct 2003 found that 87 of 1777 Snort
    rules had content to match. (Refhttp//www.ece.nc
    su.edu/erl/faculty/paulfwww/Research/pubs/BeaconSn
    ort.pdf)

21
Performance Analysis of Snort
  • Experimental Results of running Snort with
    Agilents hardware based packet generator (N2X).
  • Machine used for the test P4, 2,5 GHz, 533 Mbps
    bus speed, DDR, 1M cache
  • Bandwidth supported for varying payload sizes
    (loss ratelt0.005)

22
Snorts performance for varying rule set sizes
(Case 1)
  • Influence of Rule set size on allowable
    bandwidth
  • Packet IP payload size- 1452 bytes

23
Snorts performance for varying rule set sizes
(Case 2)
  • Influence of Rule set size on allowable
    bandwidth
  • IP packet payload size- 46 bytes

24
  • PART II
  • Performance Analysis of the Snort Pattern
    Matching Algorithm

25
Construction Phase diagram for Pattern matching
in Snort
  • The whole process cycle that Snort takes, starts
    from intaking the rule files, constructing the
    state machine, and then walking through it and
    searching for pattern matches with the input
    strings. It may be represented as shown below
  • At the heart of snort lies the pattern matching
    algorithm. It has been estimated that almost
    70-80 of the time is spent by Snort in pattern
    detection.
  • Therefore, it is important to improve the
    efficiency of pattern matching algorithm.

26
Algorithm for Snort Aho-Corasick Algorithm
  • Aho Corasick algorithm involves the construction
    of a finite state machine from the keywords and
    then using pattern matching machine to process
    the text string in a single pass.
  • Failure function
  • i 1 2 3 4 5 6 7 8 9
  • f(i) 0 0 0 1 2 0 3 0 3
  • i Output(i)
  • 2 he
  • 5 she, he
  • 7 his
  • 9 hers

Input u s h e r s 0 0 3 4 5
8 9 2
27
Algorithm for pattern matching
  • Input A text string xa1a2...an where each ai is
    an input symbol and a pattern matching machine M
    with go to function g, failure function f,
    and output function as mentioned.
  • Output Locations at which keywords occur in x
  • Method
  • begin
  • state?0
  • for i?1 until n do
  • begin
  • while g(state, ai) fail do state ?f(state)
  • state?g(state, ai)
  • if output(state) ?empty then
  • begin
  • print i
  • end
  • end
  • end

28
Getting rid of the Failure function to obtain a
DFA
  • Elimination of all failure transitions by using
    next move function of a deterministic finite
    automation in place of the goto and failure
    functions.
  • DFA makes exactly one state transition on each
    input symbol.
  • Input symbol next state
  • State 0 h 1
  • s 3
  • . 0
  • State 1 e 2
  • i 6
  • h 1
  • s 3
  • . 0
  • States 9, 7,3
  • h 4
  • s 3
  • . 0 Failure State function of
    this diagram is now no more needed!

29
DFA (ACSM)
30
Data structures in Snort for AC algorithm
  • ACSM (Aho-Corasick State Machine)
  • NFA (Non-deterministic Finite Automata)
  • DFA (Deterministic Finite Automata)
  • Implementations in Snort
  • NFA
  • Full
  • Sparse
  • Sparsebands
  • Banded
  • Triple Array
  • Double Array
  • DFA
  • Full matrix
  • Sparse
  • Sparsebands
  • Banded

31
Understanding the data structuresFull Matrix
representation
32
Conversion to Sparse storage format
  • Sparse format allows each rows to be stored in
    sparse or full format, depending on user
    specified max number of transition allowed for a
    state.

33
Conversion toBanded Matrix
34
Conversion toSparse Banded Matrix
35
Snort code profiling
  • 78 time spent in state transitions. (tested
    ACSMX2.c on Cygwin for 2160 rules)

36
Comparative Performance Analysis of Data
Structures
  • Memory requirements by different options
  • DFA full gtNFA full gtDFA banded gtNFA banded

37
Performance of ACSM implementation of Snort
  • Platform Cygwin, IBM laptop, testing file Snort
    patterns-2160 in number, looping 1000 times over
    the file.

38
Performance of ACSM implementation of Snort
(Contd..)
  • Platform Linux, mgw server, testing file
    Snort patterns-2160 in number, looping 1000
    times over the file.

39
Performance of ACSM implementation of Snort
(Based on Platforms)
  • For a Sequential input file, with 2160 snort
    patterns, looped over 1000 times, a comparative
    look at the performance dependence of the
    implementation on platforms

40
Time requirement of Snort for pattern file with
355 patterns
  • Test conducted on worm pattern file with 355
    patterns, looped 5k times on different platforms
    for different input files on cygwin platform

41
Time requirement of Snort for pattern file with
355 patterns
  • Test conducted on worm pattern file with 355
    patterns, looped 10k times on different platforms
    for different input files

42
Memory requirements for worm pattern file with
355 pattern rules
43
Time requirement of Snort for bleeding snort
pattern files with 561 patterns
  • Test conducted on bleeding snort pattern file
    with 561 patterns, looped 10k times on different
    platforms for different input files

44
Performance analysis of the options using other
rule files- Bleeding Snort rule
45
Memory requirement of bleeding snort file, 561
patterns used.
46
Intuition into possible improvements in the data
structure The Triple Array
47
Construction of Triple Array data structure by
example
48
Triple Array Data structure
  • Pattern matching algorithm by Triple Array
    structure
  • In Triple Array structure, the go-to function
    is stored in 3 arrays BASE, CHECK and NEXT.
  • g(s, input)s First, the index t of the array
    CHECK is computed as t BASEs input. If
    CHECKts, then g(s, input) becomes NEXTt,
    else g(s, input) fails and failure function for
    that state s is called.
  • Algorithm outline Input- A string x, and the
    state machine J for keywords set K.
  • Output- If x ? K, then the output becomes
    TRUE, else FALSE.
  • Method begin
  • s1
  • loop scan
  • tINPBASEs
  • if CHECKt? s, then goto out
  • s NEXTt
  • goto loop
  • out if INP and s ? F then return(TRUE)
  • else return(FALSE)
  • end

49
Example
  • Numerical values of symbols a,b,c,d are regarded
    as 1,2,3,
  • g(s, b) is fail for all terminal states and input
    symbol n since CHECK has no value s.
  • g(7,n)8 is computed by these arrays as follows
  • BASE7n01414,
  • CHECK147,
  • NEXT148.
  • Another tweak To construct triple array
    structure from the go-to function, utilize
    first-fit decreasing method (ffd) i.e. arrange
    states in decreasing order by the number of
    transitions leaving the state.

50
Performance of Triple array Data structure
Linux platform mgw, 2X2 M cache, DDR
(The other data structure options are based on
measurement from Snort ACSMX C files)
The Triple array structure is very fast in
searching and is also the memory requirement
reduces due to overlapping method used in
generating compact NEXT array. Memory requirement
of the three arrays of the triple array is 23.175
Mb for the 23865 states corresponding to this
pattern file used.
51
Performance of Triple array Data structure
(Cygwin platform)
52
Performance of Triple array Data structure (Worm
rule file, 355 patterns)
  • Our implementation of the Triple Array and the
    banded NFA as Snort datastructures outperforms
    other previous data structures of snort

53
Performance of Triple array Data structure
(Bleeding Snort rule file, 561 patterns)
54
Aoes Double array data structure
  • Extension of the Triple array to Double array by
    removing the need for NEXT array, and renumbering
    the states.
  • Example g(7, n) 8
  • New(7)5, new(8)14,
  • BASE5n 01414
  • More generally, for g(s, inp)s
    CHECKBASEnew(s)inputnew(s),
  • new(s) BASEnew(s) input.

55
Performance of Double array data structure
  • Double Array, Triple Array and NFA banded Data
    structures are faster than the others.

56
Analysis of results Conclusion
  • There is significant room for improving Snorts
    performance
  • Would like to target gt 1Gbps on a general purpose
    CPU with current rule set
  • We have focused on the content matching algorithm
    in this work, but there are many other Snort
    components that can be improved. The bottlenecks
    need to be systematically identified. E.g.,
  • Use of Libpcap to read packets has found to be
    slow and the cause of packet losses
  • Connection tracking mechanism
  • We have implemented new data structures like the
    NFA banded, Triple array and Double array and
    found them to improve both memory and time
    efficiency.
  • The future directions are
  • Continued improvement to the data structure
    studied here, e.g., multi-character transition
  • Improvement to other Snort components
  • Hybrid implementation in HW and SW

57
  • Thank you!

58
Extra Material Backup slides
  • SNORT development model
  • Programs The Snort programs are coded and
    implemented by employees at Sourcefire, Inc. They
    also identify and implement new algorithm as and
    when required.
  • Rules
  • Vulnerability Research Team identifies, tests
    and certifies new rule updates for snort.
  • Snort users can submit their own rules at the
    forum, and when the rules are tested by the VRT,
    they are incorporated into the rule files. Snort
    provides latest rules certified by the VRT to its
    subscribers and an older version of the rule
    files for free to registered and unregistered
    customers.
  • Individual users can further add their own local
    rules to the rule files.

59
Improvements in Snort
  • The combination of Optimized data flow, enhanced
    rule selection and a new High-Performance
    Multi-pattern search engine makes Snort 2.0 about
    eighteen times faster than version 1.9.
  • Recent release of Snort 2.6.0 uses Aho-Corasick
    algorithm as default mode instead of the
    previously used Wu-Manber algorithm, so speed may
    be compromised.

60
Rule files parsing Data structures after
parsing
61
Rule Optimizer Snort rule set
  • Rule classifier classifies all Snort rules into
    rule subsets. This is done prior to any packet
    streaming.
  • Once this is over, each incoming packet is
    matched to a corresponding rule set based on the
    packets unique parameters.

62
Snort components
  • Flow analyzer
  • Protocol Flow analyzer classifies network
    application protocols into clients and server
    data flows.
  • Rule Optimizer
  • It utilizes a set-based methodology for managing
    Snort rules and applying them to Network traffic.
    Rule subsets are formed on unique rule and packet
    parameters using a classification scheme based on
    set criteria. Subsets are predetermined during
    initialization.

63
Multi-Rule search EngineRule Packet
processing flow diagram
  • Rule Sets Search Types
  • 4 categories of rules for testing
  • Protocol Field Rules
  • Generic Content Rules
  • Packet anomaly Rules
  • IP Rules

64
Snort Modes
  • Sniffer Mode- simply reads the packet off the
    network and displays them in a continuous stream
    on the console.
  • Options
  • ./snort v Prints TCP/IP header onto screen
    (also for UDP/ICMP).
  • ./snort vd Prints the application data too.
  • ./snort vde Prints the data link layer contents
    as well.
  • Packet Logger Mode- logs the packets to the disk.
  • Options
  • ./snort dev l ./log Logs the packets to the
    directory specified.
  • ./snort l ./log b Binary log, binary file may
    be read back using r switch.

65
Snort Modes (contd..)
  • Network Intrusion Detection Mode (NIDS) most
    complex and configurable mode. It allows Snort to
    analyze network traffic against a user defined
    rule set and performs actions based on
    detections.
  • Options
  • ./snort A fast c snort.conf Fast alert, writes
    the alert in a simple format with a timestamp,
    alert message, source and destination IPs/ports.
  • Inline mode- obtains packets from iptables
    instead of the libpcap and then causes iptables
    to drop or pass packets based on snort rules that
    use inline-specific rule types. (drop, reject,
    sdrop options). This is the mode used when Snort
    is to act as an IPS.
Write a Comment
User Comments (0)
About PowerShow.com