N/A
Computing systems—i.e. devices capable of processing electronic data such as computers, telephones, Personal Digital Assistants (PDA), etc.—communicate with other computing systems by exchanging data messages according to a communications protocol that is recognizable by the systems. Such a system utilizes filter engines containing queries that are used to analyze messages that are sent and/or received by the system and to determine if and how the messages will be processed further.
A filter engine may also be called an “inverse query engine.” Unlike a database, wherein an input query is tried against a collection of data records, an inverse query engine tries an input against a collection of queries. Each query includes one or more conditions, criteria, or rules that must be satisfied by an input for the query to evaluate to true against the input.
For example, an XPath filter engine is a type of inverse query engine in which the filters are defined using the XPath language. The message bus filter engine matches filters against eXtensible Markup Language (XML) to evaluate which filters return true, and which return false. In one conventional implementation, the XML input may be a Simple Object Access Protocol (SOAP) envelope or other XML document received over a network.
A collection of queries usually takes the form of a tree like data structure, where each node in the tree represents an instruction and each path executed from a root node to a terminating node represents a query expression. Each data structure may include hundreds or thousands of query expression, and each query path may contain several conditions, criteria, or rules. As such, each query path may be seen as a series of instructions that include various functions, language constructs, and/or operations as defined by the inverse query specifications. As messages are received, their inputs are converted into a form conducive to the inverse query engine, which then evaluates the inputs against the instruction paths for each of the query expression.
Such query expressions operate well in confined and properly managed environments (e.g., environments in which only trusted parties use the system and/or the expressions and messages are properly built). These inverse query engines, however, are susceptible to attacks (e.g., Denial of Service (DoS) attacks) in third party settings or when the languages are not properly defined. More specifically, as is the case with most computer languages, there exist pairs of query expressions and inputs that take a long time to process and/or consume large amounts of memory resources. As such, the query system is open to attack whenever it accepts messages and/or query expressions from unreliable third party sources or when the messages or expressions are not well defined. Currently, however, there are few, in any, mechanisms in place that would allow for the mitigation of such attacks.
The above-identified deficiencies and drawback of current inverse query engines are overcome through example embodiments of the present invention. For example, embodiments described herein provide for mitigating attacks on an inverse query engine by monitoring the runtime evaluation of messages and/or for evaluating the complexity of criteria for query expressions. Note that this Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
One example embodiment provides for mitigating attacks on an inverse query engine by comparing monitored runtime data for messages against quota restrictions. In this embodiment, a message is received, which includes input(s) used in runtime evaluation of the message against query expressions for determining if the one or more inputs satisfy the criteria thereof. The runtime evaluation of the inputs is then monitored for collecting runtime data used in determining if the evaluation overly consumes processing time and/or memory resources. Runtime quota(s) are also accessed, which define a threshold of tolerable limits in terms of data size and/or processing lengths. The runtime data is then compared against the runtime quota(s) for determining if an exception will be thrown based on runtime data values that exceed the threshold limits of the runtime quota(s).
Another example embodiment provides for evaluating the reliability of the query expression by comparing complexities of the criteria against acceptable limitations when compiling the query expression in a safe mode. In this embodiment, a query expression is received, which includes criteria for applying against inputs of messages. Prior to compiling the query expression, the complexities of the criteria are determined in terms of criteria functions, language constructs, or both. The complexities of the criteria are then compared with complexity limitation(s) that define the reliability of criteria in terms of execution time, memory consumption, or both. Based on the comparison, it is then determined whether the query expression should be compiled for evaluation against the inputs of the messages.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention. The features and advantages of the invention may be realized and obtained by means of the instruments and combinations particularly pointed out in the appended claims. These and other features of the present invention will become more fully apparent from the following description and appended claims, or may be learned by the practice of the invention as set forth hereinafter.
In order to describe the manner in which the above-recited and other advantages and features of the invention can be obtained, a more particular description of the invention briefly described above will be rendered by reference to specific embodiments thereof which are illustrated in the appended drawings. Understanding that these drawings depict only typical embodiments of the invention and are not therefore to be considered to be limiting of its scope, the invention will be described and explained with additional specificity and detail through the use of the accompanying drawings in which:
The present invention extends to methods, systems, and computer program products for mitigating attacks on an inverse query engine by monitoring the runtime evaluation of messages and/or for evaluating the complexity of criteria for query expressions. The embodiments of the present invention may comprise a special purpose or general-purpose computer including various computer hardware or modules, as discussed in greater detail below.
As with most computer languages, there exist pairs of query expressions and inputs that overly consume processing time and/or memory resources. Such pairs represent a potential for a DoS attack against inverse query engines (e.g., XPath engine). Embodiments herein prevent or mitigate such attacks by monitoring the runtime processing of message and/or performing analysis on the query expressions prior to compilation. These safe mode routines allow for the acceptance of third party messages and/or query expressions, as well as prevent trusted sources from accidental DoS attacks.
As alluded to above, inverse query engine mitigations fall into two categories: compile-time and runtime. Compile-time mitigations prevent query expressions from being accepted that are susceptible to known attacks. By way of example only, a compile-time mitigation might be identifying and rejecting nested predicates of the form “//*[//*[//*]]]”, which is a common example of a query expression that takes a very long time to evaluate. Runtime mitigations, on the other hand, monitor the data size and processing lengths of messages against the various query expressions and throw an exception (e.g., abort) or take some other action once the evaluation has been deemed an attack. An example of a runtime mitigation may be to monitor the total time of the evaluation and abort it once a certain amount of time has elapsed.
As described in greater detail below, however, there are many other ways of identifying and controlling an attack, which are also contemplated herein. In fact, many of the mitigations as presented herein are not strict criteria, but can be adjusted and tuned to change the threshold at which exceptions are raised. For example, increasing the safety mode decreases what the query expression are capable of doing before reaching the threshold. While raising the threshold allows for more powerful query expression, yet also makes the engine more susceptible to attack.
Although more specific reference to advantageous features are described in greater detail below with regards to the Figures, embodiments within the scope of the present invention also include computer-readable media for carrying or having computer-executable instructions or data structures stored thereon. Such computer-readable media can be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to carry or store desired program code means in the form of computer-executable instructions or data structures and which can be accessed by a general purpose or special purpose computer. When information is transferred or provided over a network or another communications connection (either hardwired, wireless, or a combination of hardwired or wireless) to a computer, the computer properly views the connection as a computer-readable medium. Thus, any such connection is properly termed a computer-readable medium. Combinations of the above should also be included within the scope of computer-readable media.
Computer-executable instructions comprise, for example, instructions and data which cause a general purpose computer, special purpose computer, or special purpose processing device to perform a certain function or group of functions. Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
As used herein, the term “module” or “component” can refer to software objects or routines that execute on the computing system. The different components, modules, engines, and services described herein may be implemented as objects or processes that execute on the computing system (e.g., as separate threads). While the system and methods described herein are preferably implemented in software, implementations in hardware or a combination of software and hardware are also possible and contemplated. In this description, a “computing entity” may be any computing system as previously defined herein, or any module or combination of modulates running on a computing system.
As shown in
In any event, as shown in
Regardless of the how, where, or from whom, the message 105 is received, the query engine 100 uses message processor 110 to process the inputs 107 of message 105 against query expressions 125, which are typically compiled into an instruction tree 114 to generate query results 112. Although the instruction tree 114 is illustrated schematically as a box in
In any event, when the message 105 is received, the runtime evaluation module 170 (or other component) determines if the query engine 100 is running in safe mode, as shown in process 210 on the runtime side 200 of the flowchart in
More specifically, the runtime evaluation module 170 gathers runtime data from the message processor 110. This data is then compared against runtime quotas 175 retrieved from quota store 180, wherein the quotas 175 define various thresholds of tolerable limits for processing the message 105 in terms of data size and/or processing lengths. For example, the runtime evaluation module 170 determines if the message 105 exceeds the data size quotas 175 (as shown in process 215) and/or determines if the processing of the message 105 exceeds the processing length quotas 175 (as shown in process 220). If neither of these events occurs, the message 105 continues to be processed by applying the compiled query expressions 125, as shown by following the “No” paths in the flow diagram for processes 215 and 220. On the other hand, if any of the runtime quotas 175 are exceeded, a violation may be signaled, such as an exception may be thrown to exception handler 155, as shown in process 225 by following “Yes” paths of either process 215 or 220. (Note that embodiments as herein described use the terms “throwing an exception” and the like to broadly mean any type of indication that a violation has occurred.)
Note that if a violation is indicated, e.g., by throwing an exception, exception handler 155 (or other device as the case may be) can cause any number of events to occur. For example, the exception handler 155 may abort the processing of the message 105, alert system administrators of a possible attack, discard the message, identify who created the message, and/or take some other form of action. In one embodiment, the exception handler 155 allows the processing of the message 105 to continue, however, looks for other exceptions to be raised based on other runtime quotas 175 being violated. In other words, the embodiments herein allow for a combination of violations of runtime quotas 175 before it is determined that an attack is occurring. This feature may be useful in the event that a message 105 only barely exceeds a quota 175 and/or includes violations that are considered minor relative to other quotas 175. Nevertheless, it may be the overall combination of several minor violations that determine that a possible attack is occurring.
In any event, as previously mentioned the runtime quotas 175 define the tolerable thresholds in terms of data size and/or processing lengths. For example, one quota 175 may limit the data size of the message 105 and/or inputs 107, while another may limit the total number of inputs 107 in the message or a total number of sub-inputs for a particular input 107. Alternatively, or in conjunction, a data size quota 175 may limit the total bytes of the message 105 and/or the total number of allowable characters in an input 107. In this latter example, the message 105 and/or inputs 107 may be limited by a string length of the concatenation of the inputs 107 and/or sub-inputs for a particular input 107. In other words, the total message 105 and/or individual inputs 107 may be concatenated into string lengths, which can then be compared with allowable threshold values in the runtime quotas 175.
Other runtime quotas 175 define tolerable thresholds in terms of processing lengths. For example, one processing length quota 175 may limit the duration for processing the entire message 105 or any portion thereof. For example, the overall process time may be monitored, as well as processing time for individual inputs 107. In another example embodiment, the processing length quota 175 includes threshold value(s) for node counts. More specifically, a navigator (not shown) is used to iterate over the message 105 and exposes the message 105 as a tree like data structure (e.g., a document object model (DOM)), similar to the instruction tree 114. Every node that the navigator moves to, or past, may be counted. When the count exceeds the node quota 175, a violation is signaled, e.g., by throwing an exception 225 to the exception handler 155.
Note that in the above node quota 175, the count may be an overall node count for the entire message, or it may be based on the node count for one or more individual input paths within the data structure. For example, every node move operation may cause the node count to increment. In another embodiment, however, the node count resets as each path is traversed. In the case where paths are merged, when a branch within the data structure (e.g., the DOM) is reached, the node count up to that branch may be saved. As the navigator moves to evaluate the merged paths from the point of the branching node, it will use this saved node count and increment the count of the other paths from that point on. For example, if the navigator reaches a branch at a node count of 23, and then continues to move down a first path that has a total count of 55. When the navigator moves back to the branching node to evaluate other paths, rather than continuing the node count at 55, the node count starts over at 23. Note, however, that the node count may be based on a cumulative node quota of one or more input paths.
Note also that the above described quotas 175 are configurable and extensible based on any number of factors. For example, the quotas 175 are not limited to just those quotas described above with reference to data size and processing duration. Further, the number of quotas 175 used, the threshold limits, and other values are adjustable on either a static or dynamic basis. For instance, in the case where a message is received by an unreliable third party, the quotas 175 may be dynamically adjusted based on an unreliability confidence level of the message 105 as defined by historical data about other messages 105 received from the third party. In other words, as messages 105 are continually received from a third party that are not considered attacks on the system, good will may be granted such that the restrictions from the quotas 175 are eased for messages 105 received from this source. Similarly, messages 105 received from trusted parties may have lesser threshold values set than messages 105 received from unreliable sources. In fact, the threshold values for the runtime quotas 175 may be dynamically or statically adjusted based on any other number of factors. Accordingly, the above examples for dynamically or statically adjusting the quotas 175 are used for illustrative purposes only and are not meant to limit or otherwise narrow the scope of embodiments described herein.
As previously mentioned, other example embodiments provide for compile-time mitigations. Accordingly, the following discussion will make reference to the compile-time components 150 in
For example, when the query expressions 125 are received, the complexity evaluation module 120 (or other component) determines if the compilation of the query expressions 125 are to occur in safe mode, as shown in process 255 on the compile-time side 250 of the flowchart in
More specifically, the complexity module 120 iterates over the criteria 130 of the query expressions 125 for determining the complexities thereof in terms of criteria functions and/or language constructs. The determined criteria 130 complexities are then compared against complexity limitations 145 retrieved from complexity store 140, wherein the complexity limitations define the reliability of criteria 130 in terms of potential execution time and/or memory consumption. For example, the complexity evaluation module 120 determines if the criteria 130 functions may exceed execution time and/or memory consumption limitations (as shown in process 260). Alternatively, or in conjunction, the complexity module 120 determines if the criteria 130 language constructs may exceed execution time and/or memory consumption limitations (as shown in process 265). If neither of these events can occur, the query expressions 125 are compiled by compiler 115, as shown by following the “No” paths in the flow diagram for processes 260 and 265. On the other hand, if any of the complexity limitations 145 are meet, a violation is signaled by, e.g., throwing an exception to exception handler 155, as shown in process 270 by following “Yes” paths of either process 260 or 265.
Note that if an exception is thrown (or other violation indication is made), similar to the case above with regards to the runtime process 200, exception handler 155 may cause any number of events to occur. For example, the exception handler 155 may abort the compilation, discard the query expression 125, alert system administrators, identify the party that created the query expression 125, and/or take some other form of action. In one embodiment, the exception handler 155 does not abort the compilation and/or discard the query expression 125, however, it looks for other exceptions to be raised based on other violations of complexity limitations. In other words, the embodiments herein allow for a combination of violations before it is determined that a query expression 125 will not be compiled.
In any event, as previously mentioned the complexity limitations 145 define the reliability of criteria 130 in terms of potential execution time and/or memory consumption. For example, the complexity limitations 145 may restrict the criteria language in terms of functions described therein. For instance, the functions that may be restricted may include functions that have, or do, the following: non-linier runtimes; non-constant memory usage; or can create large strings. Such functions represent possible DoS attacks due to how quickly they can consume resources. Alternatively, or in conjunction, the complexity limitations 145 may restrict criteria in terms of language constructs. For example, the nested predicates or predicates that have any restricted function may be prohibited.
Other embodiments provide that the complexity limitations 145 further define the reliability of criteria 130 in terms of node-set operations. For example, equality and relational operators that search for nodes in a node-set that satisfy the relation potentially produce lengthy runtimes. As such, they may be restricted. Also, union operators that return the resulting node-set sorted into document order can potentially cause problems if implemented inefficiently; and therefore may be limited from criteria 130.
Note that the above complexities for criteria 130 (and/or the complexity limitations) may be defined in terms of order statistics. As such, an ordered statistic can be assigned to each function, language construct, or combination thereof with operators, and such complexity values compared with complexity limitations 145. For example, if “n” is the maximum node count and “m” is the number of characters allowed in a string, it may be determined that functions, language constructs, or operators that cause runtimes and/or memory consumptions of O(m), O(m2), O(n2), O(mn), O(n2), O(nm2), or greater should be restricted. As such, the complexity limitations 145 can be simply defined in terms of order statistic limitations and the criteria 130 can be scanned looking for functions, language constructs, and/or node-set operations that cause the limitation. The actual order statistics for the criteria 130 will typically vary with implementation. Note, however, that the above list of ordered statistics are not the only ones available to the embodiments herein described, but are used as examples of possible complexity limitations 145.
In one embodiment, the query expressions 125 are XPath queries. XPath is a functional language for representing queries that are often evaluated against XML documents. During conventional evaluation of inverse query paths (such as XPath statements) against XML documents, there is significant looping in order to fully navigate the XML document. As such, nested predicates such as “//*[/*[/*[/*]]]” may be restricted based on the complexity limitations 145. Other XPath expressions that may cause large runtimes and/or memory may include those with any of the following functions: contact( ); contains( ); translate( ); string( ); substring( ); substring-before( ); substring-after( ); normalize-space( ); sum( ); and others. Accordingly, these expressions may be included in the complexity limitations 145 when the query engine 100 is an XPath engine.
Note, however, that the complexity limitations 145 may include other XPath functions, language constructs, and/or operators not herein listed. For example, the string( ) function should include any implicit conversions from node-set to string. In addition, the present invention contemplates the use of custom functions that may be used, but may limit such functions to only those whose runtime and memory consumption are known and be controlled. As such, the above example XPath criteria are used herein for illustrative purposes only and are not meant to limit or otherwise narrow the scope of embodiments herein unless explicitly claimed.
Also note that similar to the runtime quotas 175, the above described complexity limitations 145 are configurable and extensible based on any number of factors. For example, the complexity limitations 145 used, the threshold limits set, and/or other values are adjustable on either a static or dynamic basis. For instance, in the case where a query expression 125 is received by an unreliable third party, the complexity limitations 145 may be dynamically adjusted based on an unreliability confidence level of the query expression 125 as defined by historical data about other query expressions 125 received from the third party.
In other words, as query expressions 125 are continually received from a third party that include criteria 130 that are not considered attacks on the system, good will may be granted such that the restrictions from the complexity limitations 145 are eased for query expressions 125 received from this source. Similarly, query expressions 125 received from trusted parties may have lesser restrictions set than query expressions 125 received from unreliable sources. In fact, the complexity limitations 145 may be dynamically or statically adjusted based on any other number of factors, for instance the composite complexity of all the criteria 130 within the query expression 125. Accordingly, the above examples for dynamically or statically adjusting the complexity limitations 145 are used for illustrative purposes only and are not meant to limit or otherwise narrow the scope of embodiments described herein.
Other adjustments for the complexity limitations 145 are also available in terms of the runtime quotas 175. For example, in the case that the query expressions 125 are XPath expressions and the node and/or string quotas 175 are enforced, sum( ), string( ), and concat( ) may not need to be excluded. Accordingly, the adjustments for the complexity limitations 145 can be dynamically or statically made depending on these and other similar considerations for the runtime quotas 175 that will be enforced.
The present invention may also be described in terms of methods comprising functional steps and/or non-functional acts. The following is a description of steps and/or acts that may be performed in practicing the present invention. Usually, functional steps describe the invention in terms of results that are accomplished, whereas non-functional acts describe more specific actions for achieving a particular result. Although the functional steps and/or non-functional acts may be described or claimed in a particular order, the present invention is not necessarily limited to any particular ordering or combination of steps and/or acts. Further, the use of steps and/or acts is the recitation of the claims—and in the following description of the flow diagrams for FIGS. 3 and 4—is used to indicate the desired specific use of such terms.
As previously mentioned,
In any event, as shown in
Note that the runtime quota(s) 175 defined by the processing lengths may include processing duration for the message 105, a node count for the runtime evaluation 200, or both. In addition, the runtime quota(s) 175 defined by the data size may include a limitation of a data size of the message 105, data size of one or more inputs 107, or both. More specifically, the data size of the message may limit the number of inputs 107 in the message 105, the number of total bytes in the message 105, or both, and the data size of the inputs 107 may limit the number of sub-inputs of the inputs 107, the number of characters in the inputs 107, or both. For example, the data size of the inputs 107 may be limited by a string length of the concatenation of the sub-inputs.
Regardless of the type of runtime quota 175, step for 325 further includes an act of comparing 320 the runtime data against the one or more runtime quota(s). For example, runtime evaluation module 170 may compare the runtime data collected against the runtime quota(s) 175 for determining if an exception (or other violation indication) will be thrown based on runtime data value(s) that exceed the threshold limits of the runtime quota(s) 175. In one embodiment, the message 105 may be considered unreliable and an exception is thrown 270 to the exception handler 155 that causes terminating the evaluation, raising an alert to a system administrator, etc.
Note that another embodiment provides that the runtime quotas 175 are configurable. Further, another embodiment provides that if the message 105 is received by a third party, the runtime quotas 175 may be dynamically adjusted based on an unreliability confidence level of the message 105 as determined by historical data about other messages 105 received from the third party.
Further, step for 420 includes an act of comparing 415 the complexities of the criteria with complexity limitations. For example, complexity evaluation module 120 may retrieve the complexity limitations 145 in complexity store 140, which define the reliability of criteria 130 in terms of execution time, memory consumption, or both. These complexity limitations 145 may then be compared with complexities of the criteria 130, wherein based on the comparison it is determined whether the query expression(s) 125 should be compiled for evaluation against the inputs 107 of the messages 105.
Note that the complexity limitations 145 may further define the reliability of criteria 130 in terms of operators that combine the criteria functions, language constructs, or both. Further, the complexity limitations 145 may further defines the reliability of criteria 130 in terms of node-set operations that search for node-set equality, relations, or both. Moreover, the complexity limitations 145 may further defines the reliability of the criteria 130 in terms of union operators, which form a union of two node-sets. Still other embodiments provide that the complexity limitations 145 may define the reliability of the criteria 130 in terms of functions that have, or do, one or more of the following: non-linear runtimes; non-constant memory usage; or create large strings. In another embodiment, the language constructs may include one or more of the functions. While other embodiments provide that the complexity limitations 145 do not allow the language constructs to have nested predicates.
As previously mentioned, the query expression may be received from a third party. In such case, example embodiments provide that the complexity limitations 145 may be dynamically adjustable based on a degree of trust for the third party. In another embodiment, the complexity limitations 145 are adjustable based on the composite complexity of all functions and language constructions within the query expression 125.
The present invention may be embodied in other specific forms without departing from its spirit or essential characteristics. The described embodiments are to be considered in all respects only as illustrative and not restrictive. The scope of the invention is, therefore, indicated by the appended claims rather than by the foregoing description. All changes which come within the meaning and range of equivalency of the claims are to be embraced within their scope.
Number | Name | Date | Kind |
---|---|---|---|
5249262 | Baule | Sep 1993 | A |
5432930 | Song | Jul 1995 | A |
5781432 | Keeler et al. | Jul 1998 | A |
6105023 | Callan | Aug 2000 | A |
6847974 | Wachtel | Jan 2005 | B2 |
7017016 | Chujo et al. | Mar 2006 | B2 |
7031958 | Santosuosso | Apr 2006 | B2 |
7047242 | Ponte | May 2006 | B1 |
20020112061 | Shih et al. | Aug 2002 | A1 |
20030055814 | Chen et al. | Mar 2003 | A1 |
20030163285 | Nakamura et al. | Aug 2003 | A1 |
20040010752 | Chan et al. | Jan 2004 | A1 |
20040060007 | Gottlob et al. | Mar 2004 | A1 |
20040068487 | Barton et al. | Apr 2004 | A1 |
20040172599 | Calahan | Sep 2004 | A1 |
20040193586 | Sashida et al. | Sep 2004 | A1 |
20040261019 | Imamura et al. | Dec 2004 | A1 |
20050091196 | Day et al. | Apr 2005 | A1 |
20050097084 | Balmin et al. | May 2005 | A1 |
20050165754 | Valliappan et al. | Jul 2005 | A1 |
20050177570 | Dutta et al. | Aug 2005 | A1 |
20050187906 | Madan et al. | Aug 2005 | A1 |
20050193023 | Ismail | Sep 2005 | A1 |
20050203957 | Wang et al. | Sep 2005 | A1 |
20050228768 | Thusoo et al. | Oct 2005 | A1 |
20050257201 | Rose et al. | Nov 2005 | A1 |
20060005122 | Lemoine | Jan 2006 | A1 |
20060005148 | Cheng et al. | Jan 2006 | A1 |
20060020631 | Cheong Wan et al. | Jan 2006 | A1 |
20060031233 | Liu et al. | Feb 2006 | A1 |
20060150162 | Mongkolsmai et al. | Jul 2006 | A1 |
20060173841 | Bill | Aug 2006 | A1 |
20060294095 | Berk et al. | Dec 2006 | A1 |
Number | Date | Country | |
---|---|---|---|
20070078829 A1 | Apr 2007 | US |