Algorithm Search⌘K

Techniqueintro

Misuse detection

Also called signature-based intrusion detection.

Detects attacks by matching events against patterns of known attacks. It misses new attacks, and its false alarms depend on how specific the patterns are.

Misuse detection finds attacks by comparing the observed events with descriptions of known attacks, called signatures. A signature can be a byte string in a packet, a regular expression over a request, a condition on header fields, or a sequence of audit events that together form an attack. The monitor compiles the signatures once and then matches each event, or each reassembled stream, against all of them. Debar, Dacier and Wespi (1999) call this knowledge based detection, as opposed to the behavior based approach of anomaly detection. It reports what it knows well: an alarm names the attack that matched. It cannot report an attack for which nobody wrote a signature. The page treats signatures as abstract patterns. It gives no real attack content.

In plain words

Keep a book of known tricks. Each entry says what the trick looks like when you see it happen: a certain string in a message, or a certain series of steps.

Watch everything that happens and compare it with every entry of the book. When something matches an entry, raise an alarm and say which trick it was.

This works well for tricks that are in the book. It does nothing for a new trick. It also fails if the attacker changes the trick a little, so that it no longer looks like the entry. Entries that are too general match harmless things too, and then they cause false alarms.

So the quality of the detector is the quality of its book, and the book must be kept up to date.

When it applies

  • The attacks of interest are known and leave a stable trace in the data, such as a fixed string or a fixed series of events.
  • A false alarm is costly, and an alarm must say what happened. A signature gives both an alarm and a name.
  • The data rate is high. Matching a fixed set of patterns can run in time linear in the input, with automata compiled ahead of time.
  • It does not apply when the attacks change form from copy to copy, as with polymorphic or metamorphic code, or when the attack is new.

The template

  1. MISUSE-DETECT(events, S) ▷ S: a set of signatures
  2. 1M ← ⟨compile S into a matcher: a keyword automaton, a rule tree or state machines⟩
  3. 2for each event e in events do
  4. 3u ← ⟨normalize e: reassemble the stream, decode the protocol, undo encodings⟩
  5. 4for each signature s that M reports on u do
  6. 5if ⟨the extra conditions of s hold on e and on the stored state⟩ then
  7. 6if ⟨s is complete⟩ then emit an alert that names s and e
  8. 7else ⟨store the partial match of s for later events⟩
  9. 8return

The holes are the design choices. Line L1 chooses the representation: for byte strings, an Aho-Corasick automaton finds all occurrences of all keywords in one pass, in time linear in the input plus the number of matches. For regular expressions, a combined automaton does the same at a cost in memory. For multi-step attacks, a state machine per signature keeps the partial matches. Line L3 makes the monitor see the data as the target host sees it, which is necessary for correctness: a string split over two packets is invisible to a per packet match. Line L5 holds the checks that a plain string cannot express, such as a port, a flag, or the length of a field. Line L7 is what makes a signature span several events.

Worked example. The signatures are three made-up strings over an abstract alphabet: abc, bcd and cab. The stream is x a b c d c a b, at positions 1 to 8. One pass of the automaton reports abc ending at position 4, bcd ending at 5 and cab ending at 8. Now suppose the stream arrives as two packets, x a b and c d c a b. A match per packet finds only cab, because abc and bcd cross the boundary. With reassembly at line L3, all three are found.

Classic examples

  • String signatures in network monitors. Snort (Roesch 1999) describes each rule by a header with addresses and ports and by options such as content strings. Matching many content strings at once is a multiple-pattern search, as in Aho-Corasick.
  • Regular expression signatures. Signatures for protocol requests are often regular expressions, compiled into automata.
  • State transition analysis. Ilgun, Kemmerer and Porras (1995) describe an attack as a series of state changes of the system, from an initial state to a compromised one. The monitor tracks the partial series, as in line L7.
  • Colored Petri nets. Kumar and Spafford (1994) match patterns of audit events with ordering and conditions, using colored Petri nets.
  • Generated signatures. Content prevalence detection and vulnerability signature generation produce signatures automatically, which a misuse detector then matches.

Variations

  • Exact strings or patterns with gaps. A signature can be one string, a set of strings that must all occur, or strings with gaps between them. Each step up adds cost and power.
  • Vulnerability signatures. Instead of matching one known attack, a signature can describe every input that reaches a known flaw, which also catches variants. This needs a model of the vulnerable program.
  • Rule trees. Snort groups rules by their header fields, so that a packet is matched only against the rules for its protocol and port.
  • Stateful matching. Signatures on reassembled streams and decoded protocol fields, as in Bro, are more precise than signatures on raw packets.
  • Hybrid systems. Many systems run misuse detection and anomaly detection side by side, as in the expert system and the statistical part of IDES (see the Denning model).

Pitfalls

  • Only known attacks. A missing signature is a missed attack. The time between a new attack and its signature is a period without protection.
  • Small changes. An attacker can change the bytes of an attack without changing its effect. Code that changes form from copy to copy defeats fixed strings. This is a form of evasion.
  • Ambiguity in normalization. Ptacek and Newsham (1998) showed that a monitor that reassembles streams differently from the end host can be fooled: it accepts a packet that the host drops, or drops one that the host accepts. Line L3 must follow the host.
  • Too general signatures. A signature that matches harmless traffic gives false alarms at the rate of that traffic. Because attacks are rare, this can make most alarms false. See the base-rate fallacy.
  • Cost under load. Patterns with many partial matches, or regular expressions with large automata, can make the monitor fall behind and drop data. An attacker can send traffic that triggers this.

Exercises

  1. Build the Aho-Corasick automaton for the keywords abc, bcd and cab, and run it on x a b c d c a b. Check that it reports the three matches of the worked example.
  2. Give a stream and a split into packets such that a per packet match finds a signature that the reassembled stream does not contain. (Hint: think of what reassembly removes.)
  3. A signature matches one harmless event in 10510^5 and every attack event. Attacks are 2 events in 10610^6. Compute the share of alarms that are real.
  4. Write a state machine for a signature of three events A, then B, then C, all from the same source within 10 events. How much state per source does it need?

References

  1. Herve Debar, Marc Dacier and Andreas Wespi, Towards a taxonomy of intrusion-detection systems, Computer Networks 31(8), 1999, pages 805 to 822, knowledge-based detection, its accuracy on known attacks and its lack of completeness
  2. Sandeep Kumar and Eugene H. Spafford, A pattern matching model for misuse intrusion detection, Proceedings of the 17th National Computer Security Conference, 1994, misuse signatures as patterns over audit events, matched with colored Petri nets
  3. Koral Ilgun, Richard A. Kemmerer and Phillip A. Porras, State transition analysis, a rule-based intrusion detection approach, IEEE Transactions on Software Engineering 21(3), 1995, pages 181 to 199, attacks as sequences of state transitions from an initial to a compromised state
  4. Martin Roesch, Snort, lightweight intrusion detection for networks, 13th USENIX Systems Administration Conference (LISA), 1999, pages 229 to 238, the rule language with a header and options, and the matching of rules against packets
  5. Alfred V. Aho and Margaret J. Corasick, Efficient string matching, an aid to bibliographic search, Communications of the ACM 18(6), 1975, pages 333 to 340, the automaton that finds all occurrences of a finite set of keywords in one pass
  6. Thomas H. Ptacek and Timothy N. Newsham, Insertion, evasion, and denial of service, eluding network intrusion detection, technical report, Secure Networks, Inc., 1998, the ambiguity between what the monitor sees and what the end host accepts, and the need to reassemble streams as the host does

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW3 standard
  • five exercises