This application relates to a method and apparatus to classify content in a packet communicated in a network.
A packet or datagram is a piece of a message transmitted over a packet-switching network. An example of a packet-switching network is the Internet where enormous quantities of data are communicated between various network points. In the Internet environment, content to be communicated between two endpoints is broken up into packets and these packets may follow different paths whilst travelling between the endpoints. It will be appreciated that the content of packets may be ordinary or anomalous.
An example of anomalous content in a packet is data that repeats with high frequency, such as the data associated with viruses, computer worms, or the like. In these circumstances, it may be advantageous to identify anomalous content in packets and then monitor subsequent packets for the anomalous content. Anomalous content in a packet may be identified by a “signature” or sequence of bytes that is present in the content. Then, all subsequent packets are checked to see if the signature is present and, if so, appropriate action may be taken to reduce any negative effects of the anomalous packet on the network.
The present application is illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements and in which:
In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of embodiment of the present application. It will be evident, however, to one skilled in the art that the present invention may be practiced without these specific details.
A network anomaly may be an out-of-ordinary event in a network. For example, when a network anomaly occurs where anomalous content is sent to a destination device, the anomalous content is included in the data payload of one or more packets. A “signature” may be a sequence of bytes present in the content that may be selected as an identifier of the anomalous content. Any other packets having a similar signature may thus also potentially contain the anomalous content. Multiple signatures may be identified for each packet, and it may be thus possible to monitor the effect of multiple signatures for a network anomaly in real time.
It will be appreciated that the particular signature selected is of importance. For example, if the signature captured is a common URL, this may be a poor quality signature because it may repeat often in innocent traffic. A second example of a poor quality signature may be the occurrence of all “AAAs” which is used in some worms but is also common to a number of innocent email attachments. Resiliency, especially for blocking, requires the use of a good quality signature with small collateral damage. Thus, selection of the signature or signatures that identify a packet with potentially malicious content may be important. Various factors may be used to identify one or more appropriate signatures.
In an example embodiment described herein, a pool of signatures (comprising a sequence of bytes) of a packet may be processed to determine which one (or more) may be the best signature to use for identifying similar packets in a traffic stream.
In an example embodiment, the analysis may be broken up into two parts, wherein each part builds on the previous. In a first part, only a signature or a pool of signatures may be available. In a second part, a signature and a packet from which the signature(s) was/were extracted and/or the entire flow may be available. The entire flow may, for example, essentially be the sequence of packets that were part of the same session/communication from which the signature(s) were extracted.
Signature or a Pool of Signatures Available
In an example embodiment, three metrics may be utilized to select an appropriate signature. In particular, the three example metrics may be information content or complexity of the signature, frequency at which the signature appears in a packet stream, and simple code analysis.
The complexity of the information content or complexity of the signature may be a determining factor when selecting a signature. Byte sequences of greater complexity may be assumed to occur in fewer payloads and thus may better represent a specific payload. The complexity of the signature may be determined based upon the cardinality (the number of elements in a given mathematical set) of the set of distinct byte values in the byte sequence that are elements of the universe of byte values, where a higher cardinality may correspond to higher complexity. Thus, a byte string with more distinct characters may be a good/easy first order guess of which string is the most complex of a given set, and is relatively easy to calculate. For example, the string “AAAA” has a cardinality of one whereas the string “ABCD” has a cardinality of four.
Furthermore it may be beneficial to determine the complexity based upon a weighted element set, such that some elements contribute greater or lesser value than others to the complexity. For example, we may desire to give greater importance to byte sequences which include the byte value “$”, and assign a weighting factor of 2 to that value, and a weighting factor of 1 to all other values. Thus, the byte sequence “$BCD” would have greater complexity than the byte sequence “ABCD”.
In an embodiment where a combined score is created from a plurality of different selection criteria or factors, a complexity score derived from the signature may be normalized to accommodate byte sequences of various lengths without creating bias. The higher the complexity, the greater the complexity score is that may be given to the signature.
In
For example, the method 50 may be implemented by the following pseudo code:
As mentioned above, the relative frequency of a signature in a set of signatures may also be a determining factor when selecting a signature. Assume that the signature as well as the number of times the signature has been seen in a traffic stream is available for each signature in a set of signatures. Generally speaking, if a signature appears more frequently, then it may be related to content that is very common across many packet payloads, and is thus not a good representation of the given packet and may result in high collateral damage (from false positives) if used. If a signature appears less frequently then it may be more relevant to the given packet. Therefore, in an embodiment, a signature with the lowest frequency may be selected.
However, in a polymorphic attack, it is possible that some signatures are unique and some keep varying. Thus using the lowest count may not be a favorable option. In these circumstances, clustering may be utilized and a median value may be determined. In particular, the signatures falling outside of a selected count (e.g., either the largest or smallest counts) may be discarded and a signature that falls within a cluster of counts that are within a small range of each other may be chosen. In general, if two signatures have counts that are very close to each other, then one or the other of the signatures may be a reasonable candidate.
Thus, in an example embodiment, signatures may be clustered. For a given signature, the lower the frequency, the better the signature score may be and hence the more appropriate the signature may be. As in the case of the complexity scores, signature scores may be normalized to keep a frequency component of the total score from having an excessive much bias. This may be accomplished by creating a scaling factor based upon the distance of each signature's frequency of occurrence from the average of the frequency of occurrences of all signatures in a set of signatures. A base score may be set for the average. Signatures with a frequency of occurrence below the average may add to this base score. Signatures with frequency of occurrence above the average may subtract from this base score. The further a signature's occurrence is from the average, the greater the effect on the score. Scoring may be normalized relative to the furthest frequency of occurrence from the average.
In
Example pseudo code to perform the method 70 is as follows:
The abovementioned methodologies for determining the frequency and complexity scores may require three passes over the data. In a first pass, the average value (be it frequency or complexity) for the set of signatures may be determined. In a second pass, the span or distance from average, for each signature may be calculated. This pass may also be used to find the span of the signature with the largest span (for normalization) referred to as the max_span. In a third pass, the signature score may be calculated.
A third factor that may be utilized to identify one or more appropriate signatures is code analysis. Code analysis of signatures may be used to augment the abovementioned count based choices of an appropriate signature. The code can be analyzed to discard common idioms (such as strings of NOPs) and the signature with the most unusual code fragment (subject to the other tests) may be selected as the appropriate signature.
Signature and Packet/Flow Available
Additional analysis may be performed if the packet and/or flow of packets from which the signature was extracted are also available. In an example embodiment, protocol analysis and conformity analysis may be utilized.
With the development of algorithms used to detect repeating signatures in IP traffic comes the need to identify those signatures which represent benign repeating sequences in the traffic flow. A large percentage of false positives detected during signature learning can be classified as application protocol headers observed traveling over well known ports (e.g., ports which have been assigned or agreed upon as being exclusively used by a given protocol). This bias can be explained as a result of protocol headers containing a number of commonly occurring byte sequences. As many payloads for protocols contain similar application level header content, they appear with enough frequency to trigger inclusion in the list of repeating signatures. The signatures may be portions of the protocol headers, and thus benign.
The method described below may be used to determine whether a signature can be identified as being part of a benign protocol header. In the example method, common attributes of application protocols may be utilized to create a method for testing a signature for conformity to a given protocol.
In an example embodiment, the protocols to be verified may tend to conform to a client/server model where the client makes a request, and the server provides a response. The set of ways a client asks for information, and the ways the server responds to that request make up the protocol. This may provide a logical separation for most of these kinds of protocols (the request portion and the response portion). Servers for most common services tend to have defined ports on which they listen on. Request behavior may be verified when a destination port for a packet is the protocol's service port and response behavior may be verified when the source port for a packet is the protocol's service port. In an embodiment, this may allow testing of a signature to be limited to a small number (e.g., one) of the known protocols, and often to be limited to either a request or a response portion of the protocol.
Application protocol headers tend to operate on a key/value pair system, with the pairs separated by some defined delimiter. Keys are a small set of identifiers for variables within the protocol. Values are the much larger set of possible values for a given key. For instance we might see a key “Color” with values “red”, “blue”, “green”, etc. The values could be limited to primary colors, colors of the rainbow, every color in a 200 crayon box, etc. For example, the value for any key for any protocol may not be important but only the maximum “normal” size of a value would be for a given key may be important. This methodology may work well with given observations of truly malicious content in application protocol headers, which tend to be buffer overflow exploits and thus by the nature of exploit, that are extremely long.
The above allows testing of the signature to be limited to a search for keys inside or before the signature, which along with their expected value lengths, may assist in identifying substrings as conforming to the protocol. In addition, it is possible to easily identify signatures that are associated with threats to specific application protocol headers. For example, if an HTTP protocol exploit is known to occur following the key “GET”, signatures which contain the key may be identified as being more interesting.
In many cases, a given key may only partially cover a signature, but still reach the end point of coverage. In those cases the point of “coverage” may be moved from the end of the signature to the point where the known key starts. The process may then be repeated again, moving to the previous byte, and looking for another key.
Once the point of coverage reaches the beginning of the signature, it may be concluded that a successful match has been obtained. If the beginning of the payload is reached without covering the signature, a final check must be performed to determine if a key is at the start of the payload (no delimiter) or end up with an unsuccessful match. As with many algorithms, multiple variations may be defined which give similar results but provide different levels of “strictness” of conformity.
In an example embodiment, the algorithm mentioned above is utilized but the requirement for successful coverage may be changed to include the requirement that at least one key appears within the signature, or for a key's value to completely cover every byte of the signature. In an example embodiment, the abovementioned algorithm may be utilized but the requirement for successful coverage may be changed to include the requirement of a key or its acceptable length's value to appear within in the signature. In an example embodiment, an algorithm may be implemented where search is conducted for keys at each offset, and a check for the delimiters is then performed but such an implementation may be slower than the method described above. In an example embodiment, an algorithm may be implemented where the search for keys or delimiters is performed forwards from the beginning of the packet rather than backwards from the end of the signature, but such an implementation may be slower than the method described above.
To prove that the signature 112 is benign, the method 90 may start from the end of the signature (at offset 0×0037) 116, scanning towards the beginning of the signature looking for 0×0d0a 114. Following the delimiter 114, a key may be searched for, which in the given example is “Referer:” 118. Based upon observations of HTTP traffic, it may be concluded that the Referer tag is rarely if ever longer than 384 bytes. Scanning forward from the Referer key 118 an ending delimiter at offset 0×0045 120 may be found. This may be well within the acceptable range for the Refer key and is after the end of the signature. The point from the matched delimiter to the end of the signature may be considered as covered.
If coverage of the entire signature 112 is required to be verified, the process may begin again from offset 0×0021, scanning for another delimiter. In the given example, the delimiter would be found at 0×0015. Following that delimiter the key “Accept:” may be found, which again based on observation of common packet traffic, may rarely be more than 256 bytes. Again the ending delimiter for that key is well within range and is the last point of coverage. The point of coverage moved to the beginning of the Accept key's starting delimiter. Scanning backwards again, the beginning of the payload would be reached without finding another delimiter. Since it is the beginning of the payload, one final test may be performed to determine a key starting can be found starting from that position. In given example, “GET” would be found. The length of a GET key's value may, for example be set to 384 bytes. It will however be appreciated that there are many valid URLs which are much longer than 384 bytes, and many implementations of HTTP servers handle URLs in the 2000 to 8000 byte range. However, merely by way of example, a value-length 384 has been chosen, which may be adequate for a substantial number of valid URL GET requests. Again the end delimiter for the GET key is well within range and is the last point of coverage. Thus, in the given example, it may be concluded that that this signature is benign.
In order to determine a quality of the signature, it may be advantageous to understand the type of content that the signature resides within. Some protocols break up their data into content sections of different types. In email, for example, the tag <Content-Type: X> informs the reader of the protocol what the type of data in the following section is. On a web page, the tag <script type=“X”> informs the reader of a section that contains script commands.
In an embodiment, for determining network anomalies, particular attention may be paid to content sections whose data is to be processed by other programs or which will be run as code. So, for the email example, a signature residing within a content-type of text/plain may be an indication of a lower quality signature, and a signature within a content-type of application/X may be an indication of a high quality signature. For web pages, any signature between script tags may be regarded to be high a quality signature.
It may also be important to continue content sections across packets in a packet flow. In an embodiment, if a content section doesn't end before the end of a packet, then that content section should cover the beginning of the next packet in the flow. If such an analysis is not done, then every packet in the flow would have to begin with an “unknown” content section, which would reduce the precision of the methodologies described herein.
In an embodiment, to enhance processing speed, a finite state machine may be utilized to search for either a “Content-Type” string or a “<script” string at the same time. This may allow a single-pass through a packet, rather than multiple passes to extract the relevant data. Then, the type itself may be stored within a database and associated with both the packet and the flow. This type may be given a sequence number, which increments for each new type added to the flow. When a new packet in the same flow is received, the highest sequence number content type may be used to identify the first content type in the next packet. When the Content-Type tag or the <script tag is broken across packets, the first section may be left as an unknown content-type.
The growing variety of network traffic makes it difficult to enforce security, measurement and traffic shaping policies without affecting unintended traffic flows. In an example embodiment, a content analysis engine uses a content section identification module, a protocol parser module, and a conformity module to classify packets into various traffic classes. The content analysis engine may classify content on the following 4 tuple: source port number, destination port number, content section IDs, and data content classification score.
The source and destination port numbers may be obtained from the packet. The content section IDs may be Multipurpose Internet Mail Extensions or MIME-type identification, HTML tag section IDs, XML tag IDs or other content section class IDs obtained from the content section identification module. A data content classification score may be the percentage of ASCII or code content in the data section of the packet (e.g. after the TCP/UDP header). This score may be calculated from a full disassembler that tries to match the bytes in the data portion of the packet to valid and reasonable platform opcodes (e.g. ×86 opcodes). It may also be calculated from inspecting each byte offset in the data for the occurrence of commonly used opcodes (e.g. add,mov,pop in ×86) and their close proximity (in bytes). The score may also be calculated from detecting known opcode sequences that represent common malicious code segments (e.g. opening a shell, invoking a system call or accessing known system files). Furthermore, each character (or a sampling of characters), 8 bits, in the packet 26 can be checked to see if they are valid printable ASCII characters or one of space, tab, carriage return or line feed. A high concentration of printable and white-space ASCII characters, as described above, may signify an ASCII section of the data which is probably benign.
To classify content, embodiments may use the above 4 tuple in any configuration to match a particular traffic content. The classifications can either be done on the designated representative signature for a packet or on all identified signatures of the packet. In the former case, the class of the packet is the same as the class of the representative signature. In the latter case, however, the class of the packet may be determined from the classes of all its identified signatures (e.g. majority class chosen as packet class). In an embodiment, all these operations can be done on any of the data boundaries including packet fragments, full packets, partial flows, full flows, or the like.
An example method 130 using such a configuration for content classification is shown in
Referring to
In decision block 142, the method 130 classifies the content of the content section to determine if it is X86 code and, if so the content section is then classified as a worn/http exploit as shown at block 144. If, however, the content is classified as ASCII, then the method proceeds to decision block 146 where a determination is made if an ASCII score is less than, for example, 70%. If the ASCII score is less than 70%, then the method 130 proceeds to decision block 148 where an investigation is conducted to determine whether or not the content section includes a suspicious byte sequence and, if so, the content section is classified as a worm/http exploit at block 150. A suspicious byte sequence contains potentially malicious patterns. Example of such byte sequences are name of executable files (for example “.exe”), name of system calls (for example “GetTickCount”) and common shell commands (for example “rm”). If, however, at block 148, it is determined that the content section does not include a suspicious byte sequence, then the method 130 proceeds to block 152 where the packet 26 is classified as an other/web ad. As shown at decision block 146, if the ASCII score is less than 70%, then the method 130 proceeds directly to decision block 152. If, however, the packet 26 is not communicated via port 80 (see decision block 132) then the method 130 proceeds to that part of the method 130 shown in
As shown at block 162 (see
Returning to block 168, if the content section is not associated with an application or a model, then the method 130 proceeds to decision block 184 to determine whether or not the content section is associated with text or a message. If the content section is associated with a text or message, then the method 130 proceeds to determine at block 186. If the content section is associated with RFC822 the designated signature is classified as spam/relay (see block 188). If, however, the content section is not associated with RFC822, then as shown at decision block 190, a determination is made if the content section is in a script and, if so, the designated signature is classified as spam/script as shown at block 192. If, however, the content section is not in a script, the designated signature may be classified as spam/plain text as shown at block 194. Returning to block 184, if the content section is not associated with text or a message, then a determination is made at decision 196 to determine if the content section is associated with an image, audio or video. If the content section is associated with an image, audio or video, the designated signature may be classified as other/embedded media as shown at block 198. If, however, the content section is not associated with an image, audio or video then the designated signature is classified as other/unknown at block 200.
Returning to decision block 166, if the content section does not have a valid MIME type/content section ID, then a determination is made if the content section includes an HTML tag at decision block 202. If the content section includes an HTML tag, then the designated signature is classified as spam/plain text at block 204. If, however, the content section does not include an HTML tag, then a determination is made at block 206 to determine if the content section is mostly plain text and, if so, the designated signature is also classified as spam/plain text (see block 204). If, however, the content section at decision block 206 is not determined to contain plain text, then at decision block 208 the content of the content section is classified. If the content is classified as X86 code, then the packet 26 is classified as a virus/malware at block 210. However, if the content is classified as ASCII at block 208, then the packet 26 is classified as spam/unknown at block 212.
If the packet 26 was not associated with port 25 (see decision block 164), then at decision block 214 the content is also classified. If the content is classified as X86 code, then the packet 26 is classified as worm/service explicit (see block 216) and, if the content is classified as ASCII, the method 130 proceeds to decision block 218. In decision block 218, a determination is made if the source port of the packet 26 is 80 and, if so, the packet 26 is classified as spam/web ad (see block 220). However, if the source port is not 80, then a determination is made whether or not the source port is port 25. If the source port is 25, then the packet 26 is classified at block 224 as spam/plain text. If, however, the source port is not port 25, then a determination is made at block 226 to ascertain if an ASCII score is less than, for example, 80% and, if so, then the packet 26 is classified as P2P/unknown as shown at block 228. If, however, the ASCII score is not less than 80%, then the packet 26 may be classified as other/unknown as shown at block 230. It will be noted that that multiple classifications may be given to content according to the criteria they satisfy.
The example computer system 300 includes a processor 302 (e.g., a central processing unit (CPU), a graphics processing unit (GPU) or both), a main memory 304 and a static memory 306, which communicate with each other via a bus 308. The computer system 300 may further include a video display unit 310 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)). The computer system 300 also includes an alphanumeric input device 312 (e.g., a keyboard), a user interface (UI) navigation device 314 (e.g., a mouse), a disk drive unit 316, a signal generation device 318 (e.g., a speaker) and a network interface device 320.
The disk drive unit 316 includes a machine-readable medium 322 on which is stored one or more sets of instructions and data structures (e.g., software 324) embodying or utilized by any one or more of the methodologies or functions described herein. The software 324 may also reside, completely or at least partially, within the main memory 304 and/or within the processor 302 during execution thereof by the computer system 300, the main memory 304 and the processor 302 also constituting machine-readable media.
The software 324 may further be transmitted or received over a network 326 via the network interface device 320 utilizing any one of a number of well-known transfer protocols (e.g., HTTP).
While the machine-readable medium 322 is shown in an example embodiment to be a single medium, the term “machine-readable medium” should be taken to include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the one or more sets of instructions. The term “machine-readable medium” shall also be taken to include any medium that is capable of storing, encoding or carrying a set of instructions for execution by the machine and that cause the machine to perform anyone or more of the methodologies of the present invention, or that is capable of storing, encoding or carrying data structures utilized by or associated with such a set of instructions. The term “machine-readable medium” shall accordingly be taken to include, but not be limited to, solid-state memories, optical and magnetic media.
Although an embodiment of the present invention has been described with reference to specific example embodiments, it will be evident that various modifications and changes may be made to these embodiments without departing from the broader spirit and scope of the invention. Accordingly, the specification and drawings are to be regarded in an illustrative rather than a restrictive sense.
This patent application claims the benefit of priority, under 35 U.S.C. Section 119(e), to U.S. Provisional Patent Application Ser. No. 60/522,810, filed on Nov. 9, 2004, the entire content of which is incorporated herein by reference.
Number | Name | Date | Kind |
---|---|---|---|
4734856 | Davis | Mar 1988 | A |
6016546 | Kephart et al. | Jan 2000 | A |
6279113 | Vaidya | Aug 2001 | B1 |
6477651 | Teal | Nov 2002 | B1 |
6519703 | Joyce | Feb 2003 | B1 |
6578147 | Shanklin et al. | Jun 2003 | B1 |
6738814 | Cox et al. | May 2004 | B1 |
6829635 | Townshend | Dec 2004 | B1 |
6988208 | Hrabik et al. | Jan 2006 | B2 |
7080408 | Pak et al. | Jul 2006 | B1 |
7089592 | Adjaoute | Aug 2006 | B2 |
7130981 | Nachenberg | Oct 2006 | B1 |
7251692 | Raz | Jul 2007 | B1 |
7451309 | Aaron et al. | Nov 2008 | B2 |
7535909 | Singh et al. | May 2009 | B2 |
7917955 | Spurlock et al. | Mar 2011 | B1 |
20020107953 | Ontiveros et al. | Aug 2002 | A1 |
20020129140 | Peled et al. | Sep 2002 | A1 |
20030004689 | Gupta et al. | Jan 2003 | A1 |
20030014503 | Legout et al. | Jan 2003 | A1 |
20030067921 | Sivalingham | Apr 2003 | A1 |
20030105973 | Liang et al. | Jun 2003 | A1 |
20030115485 | Milliken | Jun 2003 | A1 |
20030145232 | Poletto et al. | Jul 2003 | A1 |
20030226035 | Robert et al. | Dec 2003 | A1 |
20040054925 | Etheridge et al. | Mar 2004 | A1 |
20040064737 | Milliken et al. | Apr 2004 | A1 |
20040073617 | Milliken et al. | Apr 2004 | A1 |
20040117648 | Kissel | Jun 2004 | A1 |
20040215976 | Jain | Oct 2004 | A1 |
20040257994 | Paskett et al. | Dec 2004 | A1 |
20050041955 | Beuque | Feb 2005 | A1 |
20050060535 | Bartas | Mar 2005 | A1 |
20050060754 | Simyon | Mar 2005 | A1 |
20050076228 | Davis et al. | Apr 2005 | A1 |
20050111367 | Chao et al. | May 2005 | A1 |
20050114700 | Barrie et al. | May 2005 | A1 |
20050229254 | Singh et al. | Oct 2005 | A1 |
20050262556 | Waisman et al. | Nov 2005 | A1 |
20050262561 | Gassoway | Nov 2005 | A1 |
20060048209 | Shelest et al. | Mar 2006 | A1 |
20060064746 | Aaron et al. | Mar 2006 | A1 |
20060072464 | Aaron et al. | Apr 2006 | A1 |
20060098585 | Singh et al. | May 2006 | A1 |
20060098687 | Singh et al. | May 2006 | A1 |
20060107318 | Jeffries et al. | May 2006 | A1 |
20060139187 | Helfman et al. | Jun 2006 | A1 |
20060150249 | Gassen et al. | Jul 2006 | A1 |
20060242703 | Abeni | Oct 2006 | A1 |
20070025243 | Ayyagari et al. | Feb 2007 | A1 |
20070047457 | Harijono et al. | Mar 2007 | A1 |
20070094728 | Julisch et al. | Apr 2007 | A1 |
20070112714 | Fairweather | May 2007 | A1 |
20070192863 | Kapoor et al. | Aug 2007 | A1 |
20080140631 | Pandya | Jun 2008 | A1 |
20080140912 | Pandya | Jun 2008 | A1 |
20080140991 | Pandya | Jun 2008 | A1 |
20080219178 | Barrett | Sep 2008 | A1 |
Number | Date | Country |
---|---|---|
WO-2005103899 | Nov 2005 | WO |
Number | Date | Country | |
---|---|---|---|
20060161986 A1 | Jul 2006 | US |
Number | Date | Country | |
---|---|---|---|
60522810 | Nov 2004 | US |