These and other advantages of the invention will be apparent to those of ordinary skill in the art by reference to the following detailed description and the accompanying drawings.
The invention addresses the memory blow-up of deterministic finite automatas DFAs and the slow speed of non-deterministic finite automatas NFAs. One aspect of the invention is reduction of a DFA, such as state merging, where two or more non-equivalent states in a DFA can be merged into a single state using transition labels. Coupled with an enhanced data structure, this merger compresses the DFA by an order of magnitude in practice. The second aspect of the invention is an abstracted hybrid automaton where a DFA is abstracted and combined with an NFA to build an automaton that has the speed of a DFA and the compactness of an NFA.
State Merging. The inventive state merging is a technique that allows non-equivalent states in a DFA to be merged using a scheme where the transitions in the DFA are labeled. By carefully labeling transitions, in effect, we are transferring information from the nodes to the edges of the graph representing the DFA. A data structure for representing a DFA with merged states and labeled transitions is a lossless compression method that can achieve significant memory reductions in practice.
Two or more states in a DFA or NFA can be merged into a single state by introducing labels on their transitions. For every transition connecting two merged states, we define source labels and destination labels. A transition, represented by c.ld/l0,l1 . . . , thus has three attributes: (1) a character c upon which the transition is taken; (2) a single destination label Id that indicates to the destination state which underlying original state this transition is meant for; and (3) one or more source labels l0,l1 . . . that indicate to the source state upon which label to take this transition.
Each time a transition c.ld/l0,l1 . . . is taken, a label Id is produced and stored. Transition c.ld/l0,l1 . . . will be taken if the current input character is ‘c’ and the stored label is any of l0,l1. . . . If either the source or destination states are not merged, those labels are absent from the transition. Clearly, labels cause an overhead in terms of memory since they need to be stored. The number of required labels is bounded and small, and therefore their introduction only marginally affects memory usage. Such a transformation on the DFA is legal and does not affect correctness.
Merged-state DFAs can be realized in two major ways. First, they can be realized purely in software. It has been demonstrated that, for real security rule-sets, state merging can reduce software memory requirements by 10× over basic data structures, and by over 2× over the more advanced bitmap-based data structure. The bitmap-based data structure is discussed in more detail in priority claimed U.S. Provisional Application No. 60/821,192, entitled “Memory-Efficient Regular expression Search for Intrusion Detection”, filed on Aug. 2, 2006, the contents of which is incorporated by reference herein.
Second, they may be realized using specialized hardware, implemented using field programmable gate arrays (FPGAs) or custom chips. The specialized hardware consists of a lookup table to implement the state-to-next-state mapping of the DFA. With specialized hardware, the memory reduction possible is over 10×. In addition to this, there is a considerable reduction in the hardware logic complexity.
Hybrid Finite Automata. Two key ideas are used to realize hybrid finite automata. The first is the notion of “abstracting a DFA” to build a smaller DFA that allows false positives in a regulated manner. The second is the well-known architectural principle of “making the common-case fast”. We describe these below.
DFA Abstraction. The goal of DFA abstraction is to remove states from the DFA in such a manner that the resulting, smaller DFA can produce false positives but no false negatives. The state diagrams 41, 42, 43 of
For the purpose of outlining how to systematically build a reduced DFA, let d be the transition function of the DFA, and d(S, c) indicate the state to which state S transitions to upon receiving input character c. We want to find two states A and B such that, for all possible strings w, d(A, w) is an accepting state if d(B, w) is an accepting state. Once we find A and B, we move B's incoming and outgoing transitions to A and then delete B. The resulting DFA can have false positives but no false negatives.
While in practice it may not be possible to build a reduced DFA with no false negatives, we propose a probabilistic approach where the reduced DFA will have very few false positives and very few false negatives. We do this by profiling the input traffic and removing those transitions from the original DFA that have the least likelihood of being traversed. This may be done during a training period. After the training period, the reduced DFA that is built may be deployed. During operation, if a transition that was removed is traversed, we revert to the NFA for resolution.
One method of realizing the above reduced DFA is to maintain an additional bitmap for each state. (Refer to the bitmap discussion/references provided before). The new bitmap tells us which transition was removed. For example, in a 4-character alphabet, if state S0 had valid transitions on characters a, b and c, it's bitmap would be 1110. If we remove transition c during training, the second bitmap would be 0010. The third bit being ‘1’ indicates that transition c was present in the original DFA but removed (so we must consult the NFA if this transition is traversed).
A DFA provides high performance (O(1) processing time per input character) but can require considerable memory (up to O(2n), where n is the number of characters in the regular expression). On the other hand, an NFA is slow (up to O(n) time per input character), but has small memory requirements (O(n)). The goal is to build a hybrid finite automata (FA) that combines the benefits of both an NFA and DFA. In other words, the hybrid FA aims to have the performance of a DFA and the memory requirements of an NFA.
We realize this by combining an reduced DFA with an NFA in such a manner that all matches from the DFA (including false positives) are checked by the NFA. In networking security applications where very few packets contain malicious information, matches will be few and far between. Therefore most of the packets will be processed quickly by the abstracted DFA, and a few will be checked by the slower NFA. Since the abstracted DFA is typically much smaller than a regular DFA, overall memory requirements are mitigated.
The block diagrams 50 of
In summary, the invention teaches reducing a DFA is to decrease the memory usage by removing states and transitions. In doing so, we try to MINIMIZE false positives and false negatives. In the ideal case, we want no false negatives, but this may not be practically achievable. The two methods of reducing a DFA are: (i) state merging with transition labeling and (ii) deleting states and transitions based on their probabilities (obtained by profiling network traffic). A reduced DFA, however it is generated, is always coupled with an NFA. When we encounter a false positive or a false negative, we resolve it using the NFA.
The present invention has been shown and described in what are considered to be the most practical and preferred embodiments. It is anticipated, however, that departures may be made therefrom and that obvious modifications will be implemented by those skilled in the art. It will be appreciated that those skilled in the art will be able to devise numerous arrangements and variations which, although not explicitly shown or described herein, embody the principles of the invention and are within their spirit and scope.
This application claims the benefit of U.S. Provisional Application No. 60/821,192, entitled “Memory-Efficient Regular expression Search for Intrusion Detection”, filed on Aug. 2, 2006, the contents of which is incorporated by reference herein.
Number | Date | Country | |
---|---|---|---|
60821192 | Aug 2006 | US |