Abnormality detection method and related equipment
By obtaining transaction fingerprints of API messages and correlating multiple API messages, combined with sequence behavior and flow behavior detection models, comprehensive anomaly detection of API business transactions is achieved, which solves the problem of insufficient detection in the existing technology and improves network security. sex.
Patent Information
- Application Number
- CN202310335791.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2024-10-01
AI Technical Summary
Existing technology is difficult to achieve comprehensive and accurate anomaly detection of API business transactions. Single API message detection is not enough to capture abnormal behaviors in business transactions, leading to potential network security risks.
By obtaining transaction fingerprints of API messages, correlating multiple API messages of the same business transaction, and using sequence behavior and traffic behavior detection models to determine whether the order of API messages and traffic statistics are consistent with normal patterns, a comprehensive view of business transactions is achieved. Anomaly detection.
It improves network security, can accurately identify abnormal behaviors in business transactions, enhances the ability to detect attackers, and prevents network security threats.
Smart Images

Figure CN118740404A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to an anomaly detection method and related equipment. Background Art
[0002] With the continuous development of the Internet, more and more users provide services to the outside world through open application programming interfaces (APIs). In order to ensure the normal provision of services, it is necessary to test the security of services provided based on APIs. Summary of the invention
[0003] Based on this, the present application provides an anomaly detection method and related equipment, which can accurately identify multiple API messages belonging to a business transaction, and perform accurate and comprehensive anomaly detection on the business transaction based on the multiple API messages in the business transaction, thereby improving the security of the network.
[0004] In the first aspect, the present application provides an anomaly detection method. The method can be performed by a computer device. The computer device, such as a gateway (such as an API gateway), a controller, a firewall, a probe, etc., can collect, parse, and deeply learn API messages. The computer device obtains a first transaction fingerprint of a first API message, and obtains at least one second API message associated with the first API message based on the first transaction fingerprint, thereby determining the anomaly detection result of the first business transaction based on the first API message and the at least one second API message. Among them, the value of the first transaction fingerprint in the first API message is used to indicate the first business transaction, and the value of the first transaction fingerprint in the first API message and the at least one second API message is the same.
[0005] This solution is based on the transaction fingerprint that can uniquely identify the business transaction, associates multiple API messages belonging to the same business transaction, and performs anomaly detection on the business transaction based on multiple API messages of a business transaction, thereby achieving comprehensive and accurate detection of API business transactions.
[0006] In a possible implementation, the computer device can determine the first transaction fingerprint based on the first service identifier of the first API message and the transaction configuration library, the transaction configuration library including at least one service identifier and a transaction fingerprint corresponding to each service identifier in the at least one service identifier, the first service identifier is used to identify a first category of services, and the first service transaction belongs to the first category of services. In this way, the computer device maintains the transaction fingerprints corresponding to each type of services through the transaction configuration library, providing a data basis for the execution of the anomaly detection method of the present application.
[0007] In another possible implementation, a computer device obtains a plurality of first API messages including a first service identifier, wherein the first service identifier is used to identify a first type of service, and the first service transaction belongs to the first type of service; for any parameter among the plurality of parameters included in the plurality of first API messages, based on the value of the parameter in the plurality of first API messages, a first value of the parameter is determined, wherein the first value is used to indicate the uncertainty of the corresponding parameter; and the first transaction fingerprint is determined based on the first values of the plurality of parameters, wherein the plurality of parameters include the first transaction fingerprint. As an example, the determination of the first transaction fingerprint based on the first values of the plurality of parameters may include: determining the parameter whose first value among the plurality of parameters meets a preset condition as the first transaction fingerprint. The first value may include, for example, at least one of the following: information entropy or Gini coefficient. The preset condition may be a critical condition that can identify the parameter whose value is highly random and representative, for example, it may be a maximum value, that is, the parameter with the largest first value among the plurality of parameters is used as the first transaction fingerprint. In this way, the computer device calculates the first value that can standardize the uncertainty of each parameter, and determines the most representative parameter among the plurality of parameters as the transaction fingerprint by screening the first value, thereby providing a data basis for the execution of the anomaly detection method of the present application.
[0008] The manner in which a computer device determines an anomaly detection result of a first business transaction based on a first API message and at least one second API message may include but is not limited to: a first manner, based on the first API message and at least one second API message, performing anomaly detection on a sequence behavior of the first business transaction to obtain a sequence behavior detection result, and using the sequence behavior detection result as an anomaly detection result; a second manner, based on the first API message and at least one second API message, performing anomaly detection on a flow behavior of the first business transaction to obtain a flow behavior detection result, and using the flow behavior detection result as an anomaly detection result; a third manner, based on the first API message and at least one second API message, performing anomaly detection on a sequence behavior of the first business transaction to obtain a sequence behavior detection result, performing anomaly detection on the flow behavior of the first business transaction to obtain a flow behavior detection result, and determining the anomaly detection result according to the sequence behavior detection result and the flow behavior detection result.
[0009] In a possible implementation, for an implementation that only performs sequence behavior detection, for example, it may include: sorting the first API message and the at least one second API message by time to obtain a first API sequence; based on the first API sequence and a sequence behavior detection model, obtaining the sequence behavior detection result, the sequence behavior model is used to detect whether the API sequence matches the API call sequence in the corresponding business transaction. The above time may refer to the forwarding time or call time of the API message, for example. In this way, the sequence behavior of the first business transaction can be accurately detected by judging whether the API sequence in the first business transaction satisfies the API call sequence that the first business transaction should have.
[0010] In one case, the first API sequence is a sequence of API messages directly obtained by sorting the first API message and the at least one second API message in time.
[0011] In another case, the process of obtaining the first API sequence may include: directly obtaining the second API sequence by sorting the first API message and the at least one second API message in time, matching the API asset according to each API message in the second API sequence, and converting the second API sequence into the first API sequence, wherein the first API sequence is an ordered set of identifiers of the API assets matched by each API message in the second API sequence. In this case, converting the second API sequence into the first API sequence may include: determining the corresponding API asset for each API message in the second API sequence in turn according to the API asset library, obtaining the identifier of the corresponding API asset, arranging the identifier of the API asset according to the order of the corresponding API message in the second API sequence, and obtaining the first API sequence. The first API asset includes multiple attributes of the first API message and the value of each of the multiple attributes. Among them, the API asset library may be content pre-maintained by a computer device, and the attributes included in the API asset library may include, for example, but are not limited to: a protocol (scheme), a method (method), a host (host), a path (path), and key parameters (also referred to as access parameters, recorded as keys). In this case, you only need to maintain an ordered set of API asset identifiers and an API asset library. Compared with maintaining an ordered set of API messages, you do not need to pay attention to other parameters that do not belong to the keys and their corresponding values, and you do not need to maintain the values of key parameters in the keys, which saves storage resources and improves the performance of anomaly detection.
[0012] In another possible implementation, for a scheme that performs both sequence behavior anomaly detection and flow behavior anomaly detection, taking the example of first performing sequence behavior detection and then flow behavior detection, if the sequence behavior detection result obtained by performing sequence behavior detection on the first API message and at least one second API message indicates that the first API sequence does not match the API call sequence in the first business transaction, then it is determined that the anomaly detection result indicates that the first API sequence behavior is abnormal; if the sequence behavior detection result indicates that the first API sequence matches the API call sequence in the first business transaction, then based on the first API message and the at least one second API message, anomaly detection is performed on the flow behavior of the first business transaction to obtain a flow behavior detection result, and the anomaly detection result of the first business transaction is determined according to the flow behavior detection result, and the flow behavior detection result is used to indicate whether the traffic statistics results of the first API message and the at least one second API message meet the traffic statistics characteristics of the first business transaction. In this way, it is possible to perform more comprehensive anomaly detection on business transactions from the two aspects of flow behavior and sequence behavior, making the anomaly detection of business transactions more comprehensive and accurate. Moreover, after determining that the sequence behavior is abnormal, no subsequent flow behavior detection is performed, which can improve the detection efficiency to a certain extent.
[0013] In another possible implementation, for a scheme of performing only abnormality detection of flow behavior, the computer device may perform abnormality detection on the flow behavior of the first business transaction based on the first API message and the at least one second API message to obtain a flow behavior detection result, and use the flow behavior detection result as the abnormality detection result of the first business transaction. As an example, performing abnormality detection on the flow behavior of the first business transaction to obtain the flow behavior detection result may include: determining the flow statistics result of the first business transaction based on the flow information of the first API message and the flow information of each second API message in the at least one second API message; performing abnormality detection on the flow behavior of the first business transaction according to the flow statistics result of the first business transaction using a parameter configuration template or a flow behavior detection model to obtain the flow behavior detection result, wherein the parameter configuration template is used to indicate the flow statistics characteristics of the first business transaction, and the flow behavior detection model is used to detect whether the flow statistics results of multiple API messages belonging to the first business transaction meet the flow statistics characteristics of the first business transaction. Wherein, the flow behavior detection model may include, for example, an unsupervised autoencoder or a deep support vector data description (Deep-SVDD) model. In this way, the flow behavior of the first business transaction can be accurately detected by judging whether the flow statistics result of the API message in the first business transaction meets the flow statistics feature of the first business transaction.
[0014] In the second aspect, the present application also provides an anomaly detection method. The method can be performed, for example, by an analysis platform. The analysis platform can be a cloud big data platform, a cloud artificial intelligence (AI) training platform, an analyzer, or other platform that includes a deep learning training framework. The analysis platform obtains multiple training samples and determines a sequence behavior detection model based on the multiple training samples, wherein the first training sample among the multiple training samples is a first application program interface API sequence corresponding to a first business transaction, and the first API sequence is obtained by sorting multiple API messages with the same value of the first transaction fingerprint in time, and the value of the first transaction fingerprint in the multiple API messages is used to indicate the first business transaction, and the sequence behavior detection model is used to detect whether the API sequence matches the API call order in the corresponding business transaction.
[0015] In this solution, a sequence behavior detection model is trained through API sequences corresponding to multiple business transactions. In this way, a tool is provided for detecting the sequence behavior of business transactions. After subsequently mining multiple API messages belonging to the first business transaction, the trained sequence behavior detection model can be used to determine whether the occurrence order of the multiple API messages of the first business transaction matches the normal sequence behavior of the first business transaction, making it possible to achieve accurate and comprehensive anomaly detection of business transactions, thereby improving the security of the network.
[0016] In a possible implementation, each of the multiple training samples corresponds to a first type of business, and the first business transaction belongs to the first type of business. The determining of the sequence behavior detection model based on the multiple training samples may include: constructing the sequence behavior detection model applicable to the first type of business based on the multiple training samples. In this way, by constructing sequence behavior detection models corresponding to various types of business at the granularity of business type, preparations are made for sequence behavior anomaly detection of various possible business transactions of various types of business.
[0017] In another possible implementation, the multiple training samples include training samples corresponding to multiple types of business, and the multiple types of business include the first type of business to which the first business transaction belongs. Then, determining the sequence behavior detection model based on the multiple training samples may include: grouping the multiple training samples according to the business type to obtain multiple training sample sets, each sequence sample set in the multiple training sample sets corresponds to a type of business; for any training sample set in the multiple training sample sets, based on the training samples in the any training sample set, constructing a sequence behavior detection sub-model applicable to the business type corresponding to the any training sample set; and constructing the sequence behavior detection model based on the sequence behavior detection sub-model applicable to the multiple types of business. In this way, the constructed sequence behavior detection model uses multiple types of business. For the business transaction to be detected, the corresponding business type can be first determined in the sequence behavior detection model, and then the sequence behavior detection can be performed from the part corresponding to the business type. It can also be prepared for the sequence behavior anomaly detection of various possible business transactions of various types of business.
[0018] In a possible implementation, after the sequence detection model is trained, the method may further include: obtaining the first transaction fingerprint of the first API message; obtaining at least one second API message associated with the first API message based on the first transaction fingerprint, the value of the first transaction fingerprint in the first API message and the at least one second API message being the same; sorting the first API message and the at least one second API message in time to obtain a second API sequence; and determining the sequence behavior detection result of the first business transaction based on the second API sequence and the sequence behavior detection model.
[0019] As an example, obtaining the first transaction fingerprint of the first API message may include: determining the first transaction fingerprint based on the first business identifier of the first API message and a transaction configuration library, the transaction configuration library including at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
[0020] As another example, the acquisition of the first transaction fingerprint of the first API message may include: acquiring multiple first API messages including a first business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business; for any parameter among the multiple parameters included in the multiple first API messages, based on the value of the any parameter in the multiple first API messages, determining the first value of the any parameter, the first value is used to indicate the uncertainty of the corresponding parameter; determining the first transaction fingerprint based on the first values of the multiple parameters, the first transaction fingerprint belongs to the multiple parameters. Wherein, determining the first transaction fingerprint based on the first values of the multiple parameters may include: determining the parameter whose first value among the multiple parameters meets the preset condition as the first transaction fingerprint.
[0021] It should be noted that, for the relevant description of the second aspect regarding the implementation of sequence behavior anomaly detection on the first business transaction to which the first API message belongs, reference can be made to the relevant description of the first aspect.
[0022] In the third aspect, the present application also provides an anomaly detection method. The method can be performed, for example, by an analysis platform. The analysis platform can be a cloud big data platform, a cloud AI training platform, an analyzer, or other platform that includes a deep learning training framework. The analysis platform obtains multiple training samples and determines a flow behavior detection model based on the multiple training samples. The flow behavior detection model is used to detect whether the traffic statistics result of any business transaction in multiple business transactions belonging to the first category of business meets the traffic statistics characteristics of the first category of business, and the first business transaction belongs to the first category of business. Among them, each training sample in the multiple training samples corresponds to the first category of business, and the first training sample in the multiple training samples is the traffic statistics result of multiple API messages of the first business transaction belonging to the first category of business, and the value of the first transaction fingerprint in the multiple API messages is the same, and the value of the first transaction fingerprint in the multiple API messages is used to indicate the first business transaction.
[0023] In this solution, based on multiple training samples of various types of business, a flow behavior detection model corresponding to the business type is trained, providing a tool for realizing the detection of business transactions in terms of flow behavior. In this way, after subsequently mining multiple API messages belonging to the first business transaction, the trained flow behavior detection model can be used to detect whether the traffic statistics results of the multiple API messages of the first business transaction match the normal traffic statistics characteristics of the first business transaction, making it possible to realize accurate and comprehensive anomaly detection of business transactions, thereby improving the security of the network.
[0024] In a possible implementation, after the sequence detection model is trained, the method may further include: obtaining the first transaction fingerprint of the first API message; obtaining at least one second API message associated with the first API message based on the first transaction fingerprint, the value of the first transaction fingerprint in the first API message and the at least one second API message being the same; determining the traffic statistics result of the first business transaction based on the traffic information of the first API message and the traffic information of each second API message in the at least one second API message; and determining the traffic behavior detection result of the first business transaction using the traffic behavior detection model and the traffic statistics result of the first business transaction.
[0025] As an example, obtaining the first transaction fingerprint of the first API message may include: determining the first transaction fingerprint based on the first business identifier of the first API message and a transaction configuration library, the transaction configuration library including at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
[0026] As another example, the acquisition of the first transaction fingerprint of the first API message may include: acquiring multiple first API messages including a first service identifier, the first service identifier being used to identify the first type of service; for any parameter among multiple parameters included in the multiple first API messages, based on the value of the any parameter in the multiple first API messages, determining the first value of the any parameter, the first value being used to indicate the uncertainty of the corresponding parameter; determining the first transaction fingerprint based on the first values of the multiple parameters, the first transaction fingerprint belonging to the multiple parameters. Wherein, determining the first transaction fingerprint based on the first values of the multiple parameters may include: determining the parameter whose first value among the multiple parameters meets a preset condition as the first transaction fingerprint.
[0027] It should be noted that, for the relevant description of the third aspect regarding the implementation of flow behavior anomaly detection for the first business transaction to which the first API message belongs, reference can be made to the relevant description of the first aspect.
[0028] In a fourth aspect, the present application also provides an anomaly detection device, which may include: an acquisition unit and a determination unit. The acquisition unit is used to acquire a first transaction fingerprint of a first application program interface API message, wherein the value of the first transaction fingerprint in the first API message is used to indicate a first business transaction; the acquisition unit is also used to obtain at least one second API message associated with the first API message based on the first transaction fingerprint, wherein the value of the first transaction fingerprint in the first API message and the at least one second API message is the same; the determination unit is used to determine the anomaly detection result of the first business transaction based on the first API message and the at least one second API message.
[0029] In a possible implementation, the acquisition unit is specifically used to determine a first transaction fingerprint based on a first business identifier of the first API message and a transaction configuration library, wherein the transaction configuration library includes at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
[0030] In another possible implementation, the acquisition unit may include: a first acquisition subunit, a first determination subunit, and a second determination unit. The first acquisition subunit is used to acquire multiple first API messages including a first business identifier, wherein the first business identifier is used to identify a first type of business, and the first business transaction belongs to the first type of business; the first determination subunit is used to determine the first value of any parameter among the multiple parameters included in the multiple first API messages based on the value of the parameter in the multiple first API messages, wherein the first value is used to indicate the uncertainty of the corresponding parameter; the second determination subunit is used to determine the first transaction fingerprint based on the first values of the multiple parameters, wherein the first transaction fingerprint belongs to the multiple parameters. As an example, the second determination subunit is specifically used to: determine the parameter whose first value among the multiple parameters meets the preset conditions as the first transaction fingerprint.
[0031] In a possible implementation, the determination unit may include: a first detection subunit and a third determination subunit. The first detection subunit is used to perform anomaly detection on the sequence behavior of the first business transaction based on the first API message and the at least one second API message to obtain a sequence behavior detection result; and the third determination subunit is used to determine the anomaly detection result of the first business transaction according to the sequence behavior detection result.
[0032] As an example, the first detection subunit may include: a sorting module and a detection module. The sorting module is used to sort the first API message and the at least one second API message according to time to obtain a first API sequence; the detection module is used to obtain the sequence behavior detection result based on the first API sequence and the sequence behavior detection model, and the sequence behavior model is used to detect whether the API sequence matches the API call sequence in the corresponding business transaction. For example, the sorting module may include: a sorting submodule and a conversion submodule. The sorting submodule is used to sort the first API message and the at least one second API message according to time to obtain a second API sequence; the conversion submodule is used to convert the second API sequence into the first API sequence according to the API assets matched by each API message in the second API sequence, and the first API sequence is an ordered set of identifiers of the API assets matched by each API message in the second API sequence. The sorting submodule is specifically used to: determine the first API asset corresponding to the first API message according to the first API message and the API asset library, and the first API asset includes multiple attributes of the first API message and the value of each of the multiple attributes.
[0033] As an example, the third determination subunit may include: a first determination module and a second determination module, wherein the first determination module is used to determine that the anomaly detection result indicates that the first API sequence behavior is abnormal if the sequence behavior detection result indicates that the first API sequence does not match the API call sequence in the first business transaction; and the second determination module is used to perform anomaly detection on the flow behavior of the first business transaction based on the first API message and the at least one second API message to obtain a flow behavior detection result if the sequence behavior detection result indicates that the first API sequence matches the API call sequence in the first business transaction, and determine the anomaly detection result of the first business transaction based on the flow behavior detection result, and the flow behavior detection result is used to indicate whether the traffic statistics results of the first API message and the at least one second API message meet the traffic statistics characteristics of the first business transaction. Among them, the second determination module performs anomaly detection on the flow behavior of the first business transaction based on the first API message and the at least one second API message to obtain the flow behavior detection result, specifically including: determining the flow statistics result of the first business transaction based on the flow information of the first API message and the flow information of each second API message in the at least one second API message; according to the flow statistics result of the first business transaction, a parameter configuration template or a flow behavior detection model is used to perform anomaly detection on the flow behavior of the first business transaction to obtain the flow behavior detection result, the parameter configuration template is used to indicate the flow statistical characteristics of the first business transaction, and the flow behavior detection model is used to detect whether the flow statistics results of multiple API messages belonging to the first business transaction meet the flow statistical characteristics of the first business transaction.
[0034] In a possible implementation, the determination unit may include: a second detection subunit and a fourth determination subunit. The second detection subunit is used to perform anomaly detection on the flow behavior of the first business transaction based on the first API message and the at least one second API message to obtain a flow behavior detection result; and the fourth determination subunit is used to determine the anomaly detection result of the first business transaction according to the flow behavior detection result.
[0035] The device provided in the fourth aspect corresponds to the method provided in the first aspect. For the specific implementation method and the technical effect achieved, please refer to the relevant description of the first aspect.
[0036] In a fifth aspect, the present application also provides an anomaly detection device, which may include: an acquisition unit and a determination unit. The acquisition unit is used to acquire multiple training samples, wherein the first training sample among the multiple training samples is a first application program interface API sequence corresponding to a first business transaction, wherein the first API sequence is obtained by sorting multiple API messages having the same value of a first transaction fingerprint in time, and the value of the first transaction fingerprint in the multiple API messages is used to indicate the first business transaction; the determination unit is used to determine a sequence behavior detection model based on the multiple training samples, wherein the sequence behavior detection model is used to detect whether the API sequence matches the API call sequence in the corresponding business transaction.
[0037] In a possible implementation, each of the multiple training samples corresponds to a first category of business, the first business transaction belongs to the first category of business, and the determination unit is specifically used to: construct the sequence behavior detection model applicable to the first category of business based on the multiple training samples.
[0038] In another possible implementation, the multiple training samples include training samples corresponding to multiple categories of business, and the multiple categories of business include the first category of business to which the first business transaction belongs. The determination unit is specifically used to: group the multiple training samples according to business type to obtain multiple training sample sets, and each sequence sample set in the multiple training sample sets corresponds to a category of business; for any training sample set in the multiple training sample sets, based on the training samples in the any training sample set, construct a sequence behavior detection sub-model applicable to the business type corresponding to the any training sample set; and construct the sequence behavior detection model based on the sequence behavior detection sub-model applicable to the multiple categories of business.
[0039] In a possible implementation, in the device, the acquisition unit is further used to acquire the first transaction fingerprint of the first API message; the acquisition unit is further used to obtain at least one second API message associated with the first API message based on the first transaction fingerprint, and the value of the first transaction fingerprint in the first API message and the at least one second API message is the same; the acquisition unit is further used to sort the first API message and the at least one second API message in time to obtain a second API sequence; the determination unit is further used to determine the sequence behavior detection result of the first business transaction based on the second API sequence and the sequence behavior detection model.
[0040] As an example, the acquisition unit executes the acquisition of the first transaction fingerprint of the first API message, which may include: determining the first transaction fingerprint based on the first business identifier of the first API message and a transaction configuration library, the transaction configuration library including at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
[0041] As an example, the acquisition unit executes the acquisition of the first transaction fingerprint of the first API message, which may include: acquiring multiple first API messages including a first business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business; for any parameter among the multiple parameters included in the multiple first API messages, based on the value of the any parameter in the multiple first API messages, determining the first value of the any parameter, the first value is used to indicate the uncertainty of the corresponding parameter; determining the first transaction fingerprint based on the first values of the multiple parameters, the first transaction fingerprint belongs to the multiple parameters. Wherein, determining the first transaction fingerprint based on the first values of the multiple parameters may include: determining the parameter whose first value among the multiple parameters meets the preset condition as the first transaction fingerprint.
[0042] The device provided in the fifth aspect corresponds to the method provided in the second aspect. For the specific implementation method and the technical effect achieved, please refer to the relevant description of the second aspect.
[0043] In a sixth aspect, the present application also provides an anomaly detection device, which may include: an acquisition unit and a determination unit. The acquisition unit is used to acquire multiple training samples, each of the multiple training samples corresponds to a first type of business, and the first training sample of the multiple training samples is a traffic statistics result of multiple API messages of a first business transaction belonging to the first type of business, and the values of the first transaction fingerprints in the multiple API messages are the same, and the values of the first transaction fingerprints in the multiple API messages are used to indicate the first business transaction; the determination unit is used to determine a flow behavior detection model based on the multiple training samples, and the flow behavior detection model is used to detect whether the traffic statistics result of any business transaction in the multiple business transactions belonging to the first type of business meets the traffic statistics characteristics of the first type of business, and the first business transaction belongs to the first type of business.
[0044] In a possible implementation, in the device, the acquisition unit is also used to acquire the first transaction fingerprint of the first API message; the acquisition unit is also used to obtain at least one second API message associated with the first API message based on the first transaction fingerprint, and the value of the first transaction fingerprint in the first API message and the at least one second API message is the same; the determination unit is also used to determine the traffic statistics result of the first business transaction based on the traffic information of the first API message and the traffic information of each second API message in the at least one second API message; the determination unit is also used to determine the traffic behavior detection result of the first business transaction by using the traffic behavior detection model and the traffic statistics result of the first business transaction.
[0045] As an example, the acquisition unit executes the acquisition of the first transaction fingerprint of the first API message, which may include: determining the first transaction fingerprint based on the first business identifier of the first API message and a transaction configuration library, the transaction configuration library including at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
[0046] As an example, the acquisition unit executes the acquisition of the first transaction fingerprint of the first API message, which may include: acquiring multiple first API messages including a first service identifier, the first service identifier is used to identify the first type of service; for any parameter among multiple parameters included in the multiple first API messages, based on the value of the any parameter in the multiple first API messages, determining the first value of the any parameter, the first value is used to indicate the uncertainty of the corresponding parameter; determining the first transaction fingerprint based on the first values of the multiple parameters, the first transaction fingerprint belonging to the multiple parameters. Wherein, determining the first transaction fingerprint based on the first values of the multiple parameters may include: determining the parameter whose first value among the multiple parameters meets the preset condition as the first transaction fingerprint.
[0047] The device provided in the sixth aspect corresponds to the method provided in the third aspect. For the specific implementation method and the technical effect achieved, please refer to the relevant description of the third aspect.
[0048] In the above scheme, the sequence behavior detection model may be, for example, a deterministic model or a probabilistic model; the flow behavior detection model may, for example, include an unsupervised autoencoder or a deep support vector data description (Deep Support Vector Data Description, Deep-SVDD) model.
[0049] In a seventh aspect, the present application further provides a computer device. The computer device includes a processor and a memory. The processor is used to execute instructions stored in the memory, so that the computer device performs the method provided by the first aspect or any possible implementation of the first aspect, or the method provided by the second aspect or any possible implementation of the second aspect, or the method provided by the third aspect or any possible implementation of the third aspect.
[0050] In an eighth aspect, the present application further provides a storage medium. The storage medium stores instructions, and when the instructions are executed on a processor, the method provided by the first aspect or any possible implementation of the first aspect is executed, or the method provided by the second aspect or any possible implementation of the second aspect is executed, or the method provided by the third aspect or any possible implementation of the third aspect is executed. The storage medium may be, for example, a computer-readable storage medium.
[0051] In a ninth aspect, the present application provides a program product, which, when running on a processor, executes the method provided by the first aspect or any possible implementation of the first aspect, or the method provided by the second aspect or any possible implementation of the second aspect, or the method provided by the third aspect or any possible implementation of the third aspect. The program product may be, for example, a computer program product. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A schematic diagram of an architecture structure of an applicable network scenario provided in an embodiment of the present application;
[0053] Figure 2 A flowchart of an anomaly detection method 100 provided in an embodiment of the present application;
[0054] Figure 3 A flowchart of another anomaly detection method 200 provided in an embodiment of the present application;
[0055] Figure 4 A schematic diagram of a deterministic model provided in an embodiment of the present application;
[0056] Figure 5 A schematic diagram of a probability model provided in an embodiment of the present application;
[0057] Figure 6 A flowchart of another anomaly detection method 300 provided in an embodiment of the present application;
[0058] Figure 7 A schematic diagram of an unsupervised autoencoder provided in an embodiment of the present application;
[0059] Figure 8 A schematic diagram of a Deep-SVDD model provided in an embodiment of the present application;
[0060] Fig. 9 A schematic diagram of the structure of an abnormality detection device 900 provided in an embodiment of the present application;
[0061] Fig.10 A schematic diagram of the structure of a communication device 1000 provided in an embodiment of the present application;
[0062] Fig.11 A schematic diagram of the structure of another communication device 1100 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] With the continuous development of the Internet, users provide services through open APIs. While this method brings convenience, API security issues have also become an unavoidable problem accompanying the development of API technology.
[0064] In order to improve network security, each API message can be detected for anomalies separately. However, the inventors of the present application have found that detecting a single API message may result in API anomaly detection that is not comprehensive and accurate enough. For example, for a business transaction of withdrawing cash from a bank's automated teller machine (ATM), the steps involved may include: 1. card reading, 2. login, 3. input the amount of cash to be withdrawn, and 4. printing a receipt after the withdrawal is completed. These steps require 4 API calls to complete; for another example, a business transaction in which a user pays a phone bill may involve at least the following steps: 1. login to a payment application (Application, APP), 2. query the amount of outstanding fees on the account, 3. input the payment amount, and 4. complete the payment to generate an electronic voucher. These steps require 4 API calls to complete. In other words, a business transaction of a business usually requires multiple API calls to be implemented together. The detection method based on a single API message does not take into account the association between multiple API messages in a business transaction, and it is easy to miss certain attack situations, resulting in API anomaly detection that is not comprehensive and accurate enough. Take the business transaction of a user paying for a phone bill as an example. After the user logs in to the payment APP, the number of times the user accesses the arrears API when checking the amount of arrears in the account is within the normal range. However, the attacker is likely to query the arrears of each account of the user in a traversal manner. By using the method of separately detecting each API message, the detection of the API messages generated by the attacker's access behavior is normal and the attack cannot be discovered. However, looking at the business transaction as a whole, the number of times the arrears API is accessed is likely to far exceed the normal range, and the attacker's access behavior to the arrears API is very abnormal. The above abnormal access behavior of the attacker will allow the attacker to push the arrears of each account to other business chains, bringing network security risks.
[0065] Based on this, an embodiment of the present application provides an anomaly detection method, which associates multiple API messages belonging to the same business transaction based on a transaction fingerprint that can uniquely identify a business transaction, and performs anomaly detection on the business transaction based on multiple API messages of a business transaction, thereby achieving comprehensive and accurate detection of API business transactions. In specific implementation, the anomaly detection process may include: first, obtaining a first transaction fingerprint of a first API message, the value of the first transaction fingerprint in the first API message is used to indicate the first business transaction; then, based on the first transaction fingerprint, obtaining at least one second API message associated with the first API message, the first API message and the at least one second API message have the same value of the first transaction fingerprint; then, based on the first API message and the at least one second API message, determining the anomaly detection result of the first business transaction. Perform anomaly detection on the first business transaction based on multiple API messages of the first business transaction, for example, determining whether the occurrence order of the multiple API messages of the first business transaction matches the normal sequence behavior of the first business transaction, and for example, determining whether the traffic statistics results of the multiple API messages of the first business transaction meet the normal traffic statistics characteristics of the first business transaction. In this way, accurate and comprehensive anomaly detection of business transactions is achieved, thereby improving the security of the network.
[0066] Among them, for different types of services, the service identifier of the API message can be indicated, and different types of services can also be called different types of services. The service identifier can also be flexibly set based on demand. As an example, the value of the host can be specified to distinguish different types of services, such as www.test.com corresponds to the first type of service, and www.exercise.com corresponds to the second type of service; as another example, the common value of host and path can also be specified to distinguish different types of services, such as www.test.com / login / index.html corresponds to the first type of service, and www.test.com / authApply corresponds to the second type of service; as another example, the common value of the destination Internet Protocol (IP) address and the destination port number can also be specified to distinguish different types of services.
[0067] For the same type of business, if the values of the transaction fingerprints in multiple API messages are different, it means that the multiple API messages do not belong to the same business transaction (also called the same business transaction); if the values of the transaction fingerprints in multiple API messages are the same, it means that the multiple API messages belong to the same business transaction.
[0068] Still taking the business transaction of the user paying the phone bill as an example, even if the attacker queries the arrears status of each account of the user in a traversal manner, and the number of times the arrears API is accessed far exceeds the normal value range, then, based on the method provided in the embodiment of the present application, all API messages belonging to the business transaction can be mined, and all API messages belonging to the business transaction can be used as data basis for anomaly detection of the business transaction. Regardless of the perspective of the occurrence order of multiple API messages or the perspective of the traffic statistics results of multiple API messages, it can be determined that the business transaction is abnormal, thereby effectively improving network security.
[0069] The following is an exemplary description of a possible architecture of a network scenario applicable to the method provided in the embodiment of the present application. Figure 1 The network scenario may include: a device 100 and an analysis platform 200, wherein the device 100 may be a device capable of collecting and parsing API messages, and the device 100 may be, for example, a gateway (such as an API gateway), a controller, a firewall, a probe, etc.; the analysis platform 200 may be a platform including a deep learning training framework, and the analysis platform 200 may include any one or more of an analysis device, a management device, or a control device, and the analysis platform 200 may be, for example, a cloud big data platform, a cloud artificial intelligence (AI) training platform, an analyzer, etc.
[0070] Combination Figure 1 , the overall implementation process of the embodiment of the present application is introduced: before the device 100 performs anomaly detection on the API message to be detected, on the one hand, the device 100 can obtain the transaction fingerprints corresponding to various types of services from the analysis platform 200, and the device 100 can save the obtained transaction fingerprints corresponding to various types of services in the transaction configuration library 120; on the other hand, the device 100 can also obtain the sequence behavior detection model 131 and the flow behavior detection model (or parameter configuration template) 132 corresponding to various types of services from the analysis platform 200, and the device 100 can save the obtained sequence behavior detection model 131 and the flow behavior detection model (or parameter configuration template) 132 corresponding to various types of services in the anomaly detection module 130. The device 100 can also obtain the API asset library 140 from the analysis platform 200, which is used to configure the sequence behavior detection model 131 to perform sequence behavior detection. In addition, the device 100 can also include a parsing module 110, which is used to parse the collected original API message or the flow log of the original API message. The parsing module 110 may also perform structured processing on the original API message or the information obtained by parsing the flow log of the original API message, and save the parameters and parameter values related to the original API message in a specific format, which may be a table, for example.
[0071] Among them, if device 100 is a network forwarding device such as a switch or a router, device 100 can obtain the original API message, and the parsing module 110 parses the original API message to obtain the "API message" in the embodiment of the present application; if device 100 is an API gateway, a probe, or other device that itself supports parsing of original API messages, device 100 can obtain the flow log corresponding to the original API message through its own function of parsing the original API message, then the parsing module 110 can obtain the "API message" in the embodiment of the present application by parsing the flow log of the original API message.
[0072] The "API message" in the embodiments of the present application may include network layer information and application layer information. The network layer information may include: five-tuple information (i.e., source IP address, destination IP address, source port number, destination port number and network layer protocol type), number of bidirectional bytes, number of bidirectional packets, etc. The application layer information may refer to the payload part of the original API message. The application layer information may include, for example: host, request header field, post request body, status code of the response body, referer field, etc. and the value of each field.
[0073] The "API message" in the embodiments of the present application may be the original API message or the flow log of the original API message, or may be the original API message or the flow log of the original API message after parsing and other processing.
[0074] The abnormality detection process of the device 100 may include: S11, obtaining an API message 1 to be detected from multiple API messages obtained in the time window 1, the time window 1 may be flexibly configured based on actual needs, for example, every 5 minutes may be set as a time window, and the API message 1 may be any one of the multiple API messages to be detected obtained in the time window 1; S12, determining a transaction fingerprint 1 corresponding to the business identifier 1 included in the API message 1 from the transaction configuration library 120; S13, obtaining multiple API messages obtained in the time window 1 (or the time window 0 and the time window 1) from the time window 1 (or the time window 0 and the time window 1). In the API message, at least one API message 2 is obtained that is the same as the value 1 of the transaction fingerprint 1 in the API message 1, the API message 1 and the at least one API message 2 belong to the business transaction 1 indicated by the value 1 of the transaction fingerprint 1, and the business transaction 1 belongs to a business transaction in the business type 1 indicated by the business identifier 1, wherein the time window 0 can be understood as the first preset number (such as 1) of time windows adjacent to the time window 1; S14, determining the sequence behavior detection model 131 and / or the flow behavior detection model (or parameter configuration template) 132 applicable to the business type 1 from the anomaly detection module 130. In one case, if only the sequence behavior detection model 131 applicable to the business type 1 is determined in S14, then the above steps may also include: S15, sorting the API message 1 and the at least one API message 2 according to time (such as call time or forwarding time) to obtain the API sequence 1; S16, determining the anomaly detection result of the business transaction 1 based on the API sequence 1 and the sequence behavior detection model 131 applicable to the business type 1. In another case, if S14 only determines the flow behavior detection model (or parameter configuration template) 132 applicable to business type 1, then the above steps may also include: S15, determining the flow statistics result 1 of business transaction 1 based on the flow information of API message 1 and the flow information of each API message 2 in at least one API message 2; S16, determining the abnormality detection result of the business transaction 1 according to the flow statistics result 1 and the flow behavior detection model (or parameter configuration template) 132.In another case, if the sequence behavior detection model 131 and the flow behavior detection model (or parameter configuration template) 132 applicable to the business type 1 are determined in S14, then the above steps may also include: S15, sorting the API message 1 and at least one API message 2 according to time (such as call time or forwarding time) to obtain API sequence 1; S16, determining the sequence behavior detection result 1 of the business transaction 1 based on the API sequence 1 and the sequence behavior detection model 131 applicable to the business type 1; S17, determining the traffic statistics result 1 of the business transaction 1 based on the traffic information of the API message 1 and the traffic information of each API message 2 in at least one API message 2; S18, determining the flow behavior detection result 1 of the business transaction 1 according to the traffic statistics result 1 and the flow behavior detection model (or parameter configuration template) 132; S19, determining the abnormal detection result of the business transaction 1 according to the sequence behavior detection result 1 and the flow behavior detection result 1. For a detailed description of the sequence behavior detection model 131 and the flow behavior detection model (or parameter configuration template) 132 and anomaly detection of the sequence behavior and flow behavior of business transactions based on the two, please refer to the relevant description of the embodiments below.
[0075] The analysis platform 200 may include, for example, an API asset library 210, a transaction configuration library 220, a training module 230, and a transaction fingerprint determination module 240, wherein the training module 230 may include a sequence behavior training module 231, a flow behavior training module 232, and a verification model 233. For a description of the functions and acquisition methods of each part of the analysis platform 200, see the following description.
[0076] The transaction fingerprints corresponding to various types of services sent by the analysis platform 200 to the device 100 can be maintained in the transaction configuration library 220. The following is an introduction to the way in which the analysis platform 200 obtains the transaction fingerprints corresponding to various types of services. As a first example, the analysis platform 200 can obtain the transaction fingerprints corresponding to various types of services from the configuration information. The configuration information can be entered by the staff on the configuration interface 300 connected to the analysis platform 200. The staff can be, for example, an operation and maintenance personnel familiar with the API business. As a second example, the analysis platform 200 can obtain the transaction fingerprints corresponding to various types of services from the transaction fingerprint determination module 240. In one case of the second example, the transaction fingerprint determination module 240 can directly obtain the transaction fingerprint of the corresponding type of business based on the calculation of the values of the parameters in the multiple API messages of any type of business in each type of business. In another case of the second example, the transaction fingerprint determination module 240 can obtain candidate transaction fingerprints for the corresponding type of business based on calculations of the values of parameters in multiple API messages of any type of business in each type of business, and then display the candidate transaction fingerprints corresponding to each type of business on the configuration interface 300. The staff confirms the transaction fingerprints corresponding to each type of business based on the candidate transaction fingerprints of each type of business on the configuration interface 300. Thus, the transaction fingerprint determination module 240 obtains the transaction fingerprints corresponding to each type of business that are finally confirmed by the staff from the configuration interface 300. In another case of the second example, the transaction fingerprint determination module 240 calculates the candidate transaction fingerprint corresponding to each business type based on the values of the parameters in the multiple training API messages corresponding to each business type, and then inputs the values of the candidate transaction fingerprints corresponding to each business type into the verification model 233 under the trained corresponding business type, so that the transaction fingerprint determination module 240 determines whether the selection of the candidate transaction fingerprints of each business type is reasonable based on the output results of the verification model 233 corresponding to each business type. If the selection of the candidate transaction fingerprint of a certain business type is determined to be reasonable based on the output results of the verification model 233 corresponding to the business type, then the candidate transaction fingerprint of the business type is recorded as the transaction fingerprint corresponding to the business type; if the selection of the candidate transaction fingerprint of the business type is determined to be unreasonable based on the output results of the verification model 233 corresponding to the business type, then the process is re-executed for the business type until a reasonable transaction fingerprint corresponding to the business type is determined, wherein when the process is re-executed, the multiple training API messages corresponding to the business type may be updated, or the calculation method of the candidate transaction fingerprint corresponding to the business type may be updated. It should be noted that for the relevant description of the transaction fingerprints corresponding to the business type, refer to the corresponding description in the following embodiment.
[0077] The sequence behavior detection model 131 corresponding to each type of business sent by the analysis platform 200 to the device 100 can be maintained on the sequence behavior training module 231; the flow behavior detection model (or parameter configuration template) 132 corresponding to each type of business sent by the analysis platform 200 to the device 100 can be maintained on the flow behavior training module 232. The following is an introduction to the implementation method in which the analysis platform 200 obtains the sequence behavior detection model 131 and the flow behavior detection model (or parameter configuration template) 132. As a first example, the analysis platform 200 can obtain the sequence behavior detection model 131 and the flow behavior detection model (or parameter configuration template) 132 from the configuration information. The configuration information can be entered by a staff member on the configuration interface 300 connected to the analysis platform 200. The staff member can, for example, be an operation and maintenance personnel familiar with the API business. As a second example, the analysis platform 200 can respectively use the sequence behavior training module 231 and the flow behavior training module 232 in the training module 230 based on multiple training API messages corresponding to various types of services to obtain the sequence behavior detection model 131 and the flow behavior detection model (or parameter configuration template) 132. For the relevant description of the sequence behavior detection model and the flow behavior detection model (or parameter configuration template) corresponding to various types of services, refer to the corresponding description in the following embodiments.
[0078] In addition, the API asset library 210 in the analysis platform 200 can store multiple API assets, each of which corresponds to a unique API asset identifier. The API asset is obtained by extracting the attributes and attribute values of the API message, and is used to replace the API message in the subsequent sequence behavior detection. There is no need to save the content in the API message that is not related to the sequence behavior detection, which effectively reduces the amount of data that needs to be saved and processed, reduces the occupation of storage, processing and other resources by anomaly detection, and improves the efficiency of anomaly detection. The API asset is described in detail in the following embodiments.
[0079] It should be noted that the above Figure 1The network scenario shown only takes the analysis platform 200 and the device 100 deployed separately as an example to illustrate the network scenario applicable to the embodiment of the present application. The transaction fingerprint determination module 240 and the training model 230, which require powerful processing capabilities, are implemented on the analysis platform 200, which alleviates the processing pressure of the device 100 to a certain extent. In other implementations, according to other actual needs, the analysis platform 200 can be integrated into the device 100, or some functions in the analysis platform 200 can be migrated to the device 100 for implementation, or some functions in the device 100 can be migrated to the analysis platform 200 for implementation. For example, in order to further alleviate the storage pressure of the device 100, when the business type corresponding to the API message to be detected is determined, the transaction fingerprint corresponding to this type of business can be obtained from the analysis platform 200, and the sequence behavior detection model 131 and the flow behavior detection model (or parameter configuration template) 132 corresponding to this type of business can be loaded.
[0080] It should be noted that, in order to perform anomaly detection on multiple types of services, the device 100 may include multiple sequence behavior detection models 131 and multiple flow behavior detection models 132. Figure 1 Only one sequence behavior detection model 131 and one flow behavior detection model 132 are shown as examples, which is not intended to limit the number of sequence behavior detection models 131 and flow behavior detection models 132 in the device 100 .
[0081] The method provided in the embodiments of the present application is described below with reference to the accompanying drawings.
[0082] Figure 2 The flowchart of an abnormality detection method 100 provided in the embodiment of the present application is shown below. The execution subject of the method 100 is not shown below. The execution subject of the method 100 can be any device having the function of the method 100 provided in the embodiment of the present application, for example, the above-mentioned Figure 1 The device 100 or analysis platform 200 in FIG. Figure 2 As shown, the method 100 may include, for example, the following S101 to S103.
[0083] S101, obtaining a first transaction fingerprint of a first API message, where a value of the first transaction fingerprint in the first API message is used to indicate a first business transaction.
[0084] The first API message is an API message to be detected. Based on different protocol types, the protocol type corresponding to the first API message may include: Hyper Text Transfer Protocol (HTTP) or File Transfer Protocol (FTP), etc. The following description is made by taking the API message as an HTTP message as an example.
[0085] In the method 100, a time window (such as 5 minutes) can be set, and each API message among all API messages collected within a time window can be understood as the first API message in S101, and the method 100 is executed for the first API message. However, in some possible implementations, in order to improve the efficiency of anomaly detection and avoid repeated detection of the same API message, the API message that has been executed for anomaly detection within the time window can also be excluded, and the API message that has not been executed for anomaly detection is taken as the first API message in S101, and the method 100 is executed.
[0086] The first transaction fingerprint can be used to identify different business transactions of the first category of business indicated by the first business identifier included in the first API message. Different values of the first transaction fingerprint can correspond to different business transactions of the first category of business. For example, the value of the first transaction fingerprint in the first API message can be used to indicate the first business transaction in the first category of business. Assume that the business identifier 1 is www.test.com, the business identifier 1 indicates business 1, and the transaction fingerprint of business 1 is code. For API message 1, it is http: / / www.test.com / login / index.html?userNo=aa&code=bb, API message 2 is http: / / www.test.com / authApply?userNo=aa&code=bb, and API message 3 is http: / / www.test.com / login / index.html?userNo=aa&code=bb. userNo=aa&code=cc. Since API message 1, API message 2 and API message 3 all include business identifier 1 (i.e. www.test.com), API message 1, API message 2 and API message 3 are all API messages of business 1. Since the value of code in API message 1 and API message 2 is bb, API message 1 and API message 2 belong to business transaction 1 of business 1. The value of code in API message 3 is cc, so API message 3 belongs to business transaction 2 of business 1.
[0087] In some implementations, before S101, the method 100 may further include: filtering Internet traffic to obtain API messages by configuring information such as the IP address, port, and protocol type of the API server. The API message in S101 may be an original API message or information after the original API message is processed.
[0088] As an example, S101 may include: determining a first transaction fingerprint based on a first business identifier of the first API message and a transaction configuration library, wherein the transaction configuration library includes at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, wherein the first business identifier is used to identify a first type of business, and the first business transaction belongs to the first type of business. The execution subject of the method 100 may maintain transaction fingerprints corresponding to various types of business, and provide a data basis for the execution of S101. Among them, the above-mentioned way of maintaining transaction fingerprints corresponding to various types of business through the transaction configuration library is a possible example, that is, the transaction fingerprints corresponding to various types of business are saved in the transaction configuration library, for example, the transaction configuration library may be presented in the correspondence relationship between the business identifier and the transaction fingerprint. Then, S101 may include, for example: obtaining a first business identifier from the first API message, and obtaining a first transaction fingerprint matching the first business identifier from the transaction configuration library. For example, the transaction fingerprint library includes: business identifier 1-transaction fingerprint 1, business identifier 2-transaction fingerprint 2, ..., business identifier n-transaction fingerprint n, wherein n is an integer greater than 1. If the first service identifier of the first API message in S101 is service identifier 2, then the first transaction fingerprint is transaction fingerprint 2.
[0089] A service identifier may refer to an identifier that can indicate a service type. In one case, the service identifier may be pre-configured, such as by configuring a specified host value as a service identifier for distinguishing service types, or by configuring a specified host+path value as a service identifier for distinguishing service types, or by configuring a specified destination IP address+destination port number value as a service identifier for distinguishing service types. In another case, when the service identifier is not specified through configuration, all API messages may be classified according to the default grouping rules (such as the host value).
[0090] For example, for the following three API messages:
[0091] API message 1: http: / / www.test.com / login / index.html?userNo=aa&code=bb
[0092] API message 2: http: / / www.test.com / authApply? userNo=aa&code=bb
[0093] API message 3: http: / / www.test.com / tokenQuery?userNo=aa&code=bb
[0094] Among them, the host of API message 1, API message 2 and API message 3 is www.test.com, and the path of API message 1, API message 2 and API message 3 is login / index.html, authApply and tokenQuery respectively. Assuming that the value of host is specified as the service identifier, then www.test.com is the service identifier 1, which is used to indicate the first type of service. Then, API message 1, API message 2 and API message 3 all belong to the first type of service. Assuming that the value of host+path is specified as the service identifier, then login / index.html is the service identifier 2, which is used to indicate the second type of service. API message 1 belongs to the second type of service; authApply is the service identifier 3, which is used to indicate the third type of service. API message 2 belongs to the third type of service; tokenQuery is the service identifier 4, which is used to indicate the fourth type of service. API message 3 belongs to the fourth type of service. In the following, the value of host is used as the service identifier for example and explanation.
[0095] The method for obtaining the transaction fingerprints corresponding to the various types of businesses maintained in the transaction configuration library includes but is not limited to the following possible implementation methods. Method 1: Based on the transaction fingerprints corresponding to the various types of businesses configured by the staff, a transaction configuration library is obtained, and the transaction configuration library includes the transaction fingerprints corresponding to the various types of businesses configured. The staff member may be, for example, an operation and maintenance personnel familiar with the API business. Method 2: The first step is to calculate the candidate transaction fingerprints corresponding to the various types of businesses, and the second step is to determine the transaction fingerprints of the corresponding business type based on the candidate transaction fingerprints corresponding to the various types of businesses. For the method of determining the transaction fingerprints corresponding to any type of business in the transaction configuration library using method 2, please refer to the method for determining the first transaction fingerprint of the first type of business below. It should be noted that for the transaction fingerprints corresponding to the various types of businesses maintained in the transaction configuration library determined based on method 2, after calculating the transaction fingerprint of a certain type of business, it can be checked in the transaction configuration library whether the transaction fingerprint corresponding to the type of business already exists. If so, the existing transaction fingerprint is replaced with the latest determined transaction fingerprint to ensure that there is only one more reasonable transaction fingerprint corresponding to each type of business.
[0096] As another example, S101 may include: S1011, obtaining multiple first API messages including a first business identifier, wherein the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business; S1012, for any parameter among multiple parameters included in the multiple first API messages, based on the value of the any parameter in the multiple first API messages, determining the first value of the any parameter, wherein the first value is used to indicate the uncertainty of the corresponding parameter; S1013, determining a candidate transaction fingerprint based on the first values of the multiple parameters; S1014, determining the first transaction fingerprint from the candidate transaction fingerprint, wherein the first transaction fingerprint belongs to the multiple parameters. Among them, S1011 to S1013 may correspond to the first step of the above-mentioned method 2; S1014 may correspond to the second step of the above-mentioned method 2.
[0097] For S1011, for example, it may include: obtaining a plurality of first API messages including the first service identifier from the collected plurality of API messages.
[0098] For S1012, for example, it may include: extracting parameters that appear at least once in the multiple first API messages; for any parameter among the multiple parameters, obtaining the value of each first API message in the multiple first API messages of the parameter as a possible value of the parameter; thereby, based on the determined possible values of the parameter, calculating the first value of the parameter, the first value is used to indicate the uncertainty of the value of the parameter. The uncertainty of the parameter can be understood as the probability distribution of the parameter value, or the stability of the parameter value. The first value may include, for example, at least one of the following: information entropy or Gini coefficient.
[0099] For S1013, for example, it may include: the candidate transaction fingerprint corresponding to the first type of business includes the parameters whose first values meet the preset conditions among the parameters appearing in the multiple first API messages. It can be understood that among the parameters of the API message, the values of some parameters are relatively fixed, such as the values of parameters such as the number of returned pages and the amount of page data, which are relatively regular; the values of some parameters are relatively random, such as the values of parameters such as session identifiers and temporary user names, which may be filled by random coding. Such parameters can indicate the uniqueness of different business transactions in a type of business to a certain extent, and the values of such parameters can distinguish different business transactions of this type of business. In the embodiment of the present application, it is necessary to select at least one parameter with a relatively random value as a candidate transaction fingerprint, so the preset condition may be a critical condition of the parameter that can identify the randomness of the parameter value and is representative.
[0100] Taking the first service identifier www.test.com as an example, the multiple first API messages obtained may be, for example:
[0101] First API message 1: http: / / www.test.com / login / index.html?userNo=aa&code=bb
[0102] First API message 2: http: / / www.test.com / authApply?userNo=aa&code=bb
[0103] First API message 3: http: / / www.test.com / tokenQuery?userNo=aa&code=bb
[0104] First API message 4: http: / / www.test.com / login / index.html?userNo=cc&code=dd
[0105] After S1012, the parameters that appear at least once in the plurality of first API messages and possible values of the parameters are obtained, as shown in Table 1 below:
[0106] Table 1
[0107]
[0108] If the first value is information entropy, then the first values of the two parameters userNo and code can be calculated based on the following formula (1):
[0109]
[0110] In formula (1), n is the number of possible values of the calculated parameter. For the case shown in Table 2, when formula (1) is used to calculate the information entropy of userNo, n=2, and when formula (1) is used to calculate the information entropy of code(token), n=3; i is the i-th possible value of the calculated parameter. For example, when calculating the first value of userNo based on formula (1), H userNo =-((aa)log2(aa)+(cc)log2(cc)).
[0111] It can be understood that information entropy is usually used to measure the uncertainty of a parameter value. The more random the parameter value is, the greater the information entropy of the parameter is. The preset condition can be the largest N first values, where N is an integer greater than or equal to 1. Then, the candidate transaction fingerprint for the first type of business can be determined by: userNoand H code(token) The parameters corresponding to the largest N values are recorded as candidate transaction fingerprints corresponding to the first type of business. N may be set by the staff based on experience; or N may be determined according to a certain rule based on the information entropy of multiple parameters obtained by calculation.
[0112] If the first value is the Gini coefficient, then the first values of the two parameters userNo and code (token) in Table 1 can be calculated based on the following formula (2):
[0113]
[0114] In formula (2), k is the number of possible values of the calculated parameter. For the case shown in Table 2, when using formula (2) to calculate the information entropy of userNo, k = 2, and when using formula (2) to calculate the information entropy of code (token), k = 3; p i is the i-th possible value of the calculated parameter. For example, when calculating the first value of userNo based on formula (2), G userNo =1-((aa) 2 +(cc) 2 ).
[0115] It can be understood that the Gini coefficient is usually used to measure the uncertainty of a parameter value. The more random the parameter value is, the larger the Gini coefficient of the parameter is. Therefore, it is necessary to select a parameter with a larger Gini coefficient as the candidate transaction fingerprint. Then, the preset condition can be the largest N first values. Then, the candidate transaction fingerprint of the first type of business can be determined by: G obtained by calculation based on formula (2) userNo and G code(token) The parameters corresponding to the largest N values are recorded as candidate transaction fingerprints corresponding to the first type of business. N may be set by the staff based on experience; or N may be determined according to a certain rule based on the information entropy of multiple parameters obtained by calculation.
[0116] If the first value of a parameter includes the Gini coefficient of the parameter and the information entropy of the parameter, then the preset condition may include: the information entropy in the first value is greater than a first threshold and the Gini coefficient in the first value is greater than a second threshold. When the information entropy of the parameter is greater than the first threshold and the Gini coefficient of the parameter is greater than the second threshold, the first value of the parameter is considered to meet the preset condition.
[0117] If the first value of a parameter is a numerical value calculated based on the Gini coefficient of the parameter and the information entropy of the parameter, for example, weights are preset for the information entropy and the Gini coefficient, and the Gini coefficient of the parameter and the information entropy of the parameter are weighted (or weighted averaged) to obtain the first value of the parameter, then the preset conditions may include: the largest N first values.
[0118] It should be noted that N in the preset conditions corresponding to the above-mentioned various situations may be the same or different, the first threshold value and the second threshold value may be the same or different, and may be flexibly set based on the requirements of each solution.
[0119] For S1014, after determining the candidate transaction fingerprints of the first type of business, as an example, the candidate transaction fingerprint determined in the first step can be directly recorded as the first transaction fingerprint, and then the number of candidate transaction fingerprints determined in the above S1013 can be 1. As another example, the candidate transaction fingerprint determined in S1013 can be displayed through an interface (such as Figure 1 The configuration interface 300 in the configuration interface 300 is displayed to the staff, and the staff confirms the parameters of the candidate transaction fingerprint according to the actual situation (for example, it may include: selecting a parameter in the candidate transaction fingerprint, deleting a parameter from the candidate transaction fingerprint, or updating the parameter in the candidate transaction fingerprint). The staff's confirmation result of the candidate transaction fingerprint is recorded as the first transaction fingerprint. As another example, the candidate transaction fingerprint of the first type of business can also be verified based on the verification model corresponding to the first type of business. If the verification passes, the candidate transaction fingerprint is used as the first transaction fingerprint. If the verification fails, the process of S1011 to S1013 and S1014 in this example is re-executed until the verification passes. Alternatively, the candidate transaction fingerprint can be manually adjusted according to the verification result, and the manual adjustment result of the candidate transaction fingerprint is recorded as the first transaction fingerprint.
[0120] Wherein, verifying the candidate transaction fingerprint of the first type of business based on the verification model corresponding to the first type of business may include: determining the first transaction fingerprint of the first type of business based on the verification model of the first type of business and the values of the candidate transaction fingerprint in multiple API messages belonging to the first type of business. For example, the process of verifying the candidate transaction fingerprint based on the verification model and determining the first transaction fingerprint may include: S31, obtaining multiple first training samples, each of the multiple first training samples includes the value of the candidate transaction fingerprint in the API belonging to the first type of business; S32, based on the multiple first training samples and the verification model corresponding to the first type of business, obtaining the detection difference corresponding to the first type of business; S33, if the detection difference meets the baseline value of the verification model corresponding to the first type of business, then determining that the candidate transaction fingerprint of the first type of business is the first transaction fingerprint; S34, if the detection difference does not meet the baseline value of the verification model corresponding to the first type of business, then updating the candidate transaction fingerprint corresponding to the first type of business, and returning to execute S31 to S34 until the first transaction fingerprint is obtained. In this scenario, the number of candidate transaction fingerprints N=1. Wherein, the detection difference may refer to the difference between the input content and the output result of the detection model. The baseline value can be the maximum deviation allowed between the input and output of the verification model determined based on the verification sample during the training-validation-test process of the verification model. The specific introduction of the verification model training-validation-test process is similar to the training-validation-test process of the flow behavior detection model described below, and can refer to the corresponding description.
[0121] It can be seen that through the above method, the first transaction fingerprint of the first API message can be obtained, which prepares for the execution of subsequent steps.
[0122] It should be noted that when determining the first transaction fingerprint of the first business transaction in the above manner, considering that the field names of fields with the same meaning may be different, the fields with the same meaning may be first regarded as a field set, such as {code, token}, and the first value of the field set is calculated. The first transaction fingerprint of the first business transaction is determined based on the first value of the field set and the first values of other fields or field sets. Assuming that the first API message includes the first business identifier: www.test.com, then, through S101, it can be determined that the first transaction fingerprint corresponding to the first type of business indicated by the first business identifier is {code, token}. Code and token indicate the same meaning, and only one of them appears in different API messages. Therefore, the first transaction fingerprint {code, token} can be considered as a parameter.
[0123] S102: Obtain at least one second API message associated with the first API message based on the first transaction fingerprint, wherein the first transaction fingerprint in the first API message and the at least one second API message has the same value.
[0124] As an example, S102 may include: obtaining multiple API messages whose transaction fingerprints are also the first transaction fingerprint; obtaining the value of the first transaction fingerprint in the multiple API messages; determining the API message whose value of the first transaction fingerprint in the multiple API messages is the same as the value of the first transaction fingerprint in the first API message as the second API message associated with the first API message in S102. Wherein, the value of the first transaction fingerprint in the first API message and the at least one second API message is the same, and it can be considered that the at least one second API message and the first API message belong to the same business transaction, that is, the first business transaction.
[0125] The at least one second API message may belong to the same time window as the first API message; or, the at least one second API message may not belong to the same time window as the first API message; or, when the at least one second API message is a plurality of second API messages, the at least one second API message may also partially belong to the same time window as the first API message. The following description will be made by taking the example that the at least one second API message may belong to the same time window as the first API message.
[0126] It can be understood that the first API message and at least one second API message can be different API request messages (such as http request messages) carried by the same data stream, or different API request messages carried by different data streams. Both situations do not affect the implementation of the embodiments of the present application.
[0127] For example, suppose that among the API messages collected in a time window, the API messages with the first service identifier www.test.com include:
[0128] API message 1: http: / / www.test.com / login / index.html?userNo=aa&code=bb
[0129] API message 2: http: / / www.test.com / authApply? userNo=aa&code=bb
[0130] API message 3: http: / / www.test.com / tokenQuery?userNo=aa&token=bb
[0131] API message 4: http: / / www.test.com / login / index.html? userNo=cc&code=dd
[0132] Assuming that the first transaction fingerprint is {code, token}, the first API message is API message 1, and the value of the first transaction fingerprint in the first API message is bb, among the above three messages (i.e., API message 2, API message 3, and API message 4), based on the API message with code=bb or token=bb obtained in S102, two second API messages are obtained, i.e., API message 2 and API message 3. So far, if the business transaction indicated by code=bb or token=bb is recorded as the first business transaction, API message 1, API message 2, and API message 3 belonging to the first business transaction are identified from multiple API messages.
[0133] It can be seen that through S101 and S102, multiple API messages under a business transaction are accurately identified, which prepares for S103 to perform anomaly detection on the business transaction based on multiple API messages of the business transaction.
[0134] S103: Determine an anomaly detection result of the first business transaction based on the first API message and the at least one second API message.
[0135] In the embodiment of the present application, on the one hand, the API calls that need to be executed in a business transaction are regular, that is, the forwarding time or call time of the multiple API messages included in a business transaction should follow the API call regularity that the business transaction should have. Simply put, a business transaction should have a specific sequence behavior. On the other hand, the traffic statistics results of the multiple API messages included in a business transaction should meet the traffic statistics characteristics that the business transaction should have. Simply put, a business transaction should have a specific flow behavior. Based on this, the anomaly detection of the first business transaction based on S103 can include three possible implementation methods: only detecting sequence behavior, only detecting flow behavior, or detecting sequence behavior and flow behavior.
[0136] It should be noted that the executor of the method 100 can deploy the ability to detect sequence behavior and / or the ability to detect flow behavior according to needs; alternatively, the executor of the method 100 can deploy the ability to detect sequence behavior and the ability to detect flow behavior, and use the above three possible implementation methods as optional anomaly detection modes when performing anomaly detection on each business transaction. The user can select the anomaly detection mode based on the time window or the granularity of the business transaction, and perform the corresponding anomaly detection based on the selected anomaly detection mode, thereby improving the flexibility of the anomaly detection provided by the embodiments of the present application.
[0137] In a first possible implementation, for a solution that only detects the serial behavior of the first business transaction, S103 may include: performing anomaly detection on the serial behavior of the first business transaction based on the first API message and the at least one second API message, and obtaining a serial behavior detection result, which can be used as the anomaly detection result of the first business transaction.
[0138] As an example, S103 may include: S1031, sorting the first API message and the at least one second API message in time to obtain a first API sequence; S1032, obtaining the sequence behavior detection result based on the first API sequence and a sequence behavior detection model, wherein the sequence behavior model is used to detect whether the API sequence matches the API call order in the corresponding business transaction.
[0139] It is understandable that the API message may include a call time field or a forwarding time field, which is used to record the time when the API message is called or forwarded, and the time can be used as the basis for sorting the first API message and at least one second API in S1031. Among them, the call time field or the forwarding time field in the API message can be a field used to carry the timestamp of the original API message collected by the collection module.
[0140] In one case, the first API sequence may refer to an ordered set of API messages. For example, the first API message is API message 1: http: / / www.test.com / login / index.html?userNo=aa&code=bb, and at least one second API message includes: API message 2: http: / / www.test.com / authApply?userNo=aa&code=bb and API message 3: http: / / www.test.com / tokenQuery?userNo=aa&token=bb. Assuming that the time of API message 1 is earlier than the time of API message 3, and the time of API message 3 is earlier than the time of API message 2, then the first API sequence may be {API message 1, API message 3, API message 2}.
[0141] In another case, the first API sequence may refer to an ordered set of identifiers of API assets corresponding to the API message. S1031 may, for example, include: S1031a, sorting the first API message and the at least one second API message in time to obtain a second API sequence; S1031b, converting the second API sequence into the first API sequence according to the API assets matched by each API message in the second API sequence, wherein the first API sequence is an ordered set of identifiers of API assets matched by each API message in the second API sequence. For S1031b, for example, it may include: determining the first API asset corresponding to the first API message according to the first API message and the API asset library, wherein the first API asset includes multiple attributes of the first API message and the value of each of the multiple attributes. S1031a and the second API sequence may refer to the description of the first API sequence in the previous case. In this way, since the API asset includes less content than the API message, the maintenance cost of the first API sequence is lower.
[0142] For the API asset library, for example, it can be through API document or protocol stream parsing, and then extracting the attributes and attribute values of each API message. Based on a large number of API messages, self-learning API assets can obtain a more comprehensive API asset library. Here, attributes can refer to the fields in the Uniform Resource Locator (URL) of the API message and the key parameters proposed in other parts. Attributes may include, but are not limited to: protocol (scheme), method (method), host (host), path (path) and key parameters (also called access parameters, recorded as keys). Taking API message 1: http: / / www.test.com / login / index.html? userNo=aa&code=bb as an example, the API asset 1 obtained based on the API message 1 can be shown in Table 2 below:
[0143] Table 2
[0144]
[0145]
[0146] In Table 2 above, except for the first row, the left side of other rows indicates the attribute of API asset 1, and the right side indicates the value corresponding to the attribute. Two API messages with the same attribute and attribute value can be considered to be the same API asset. Two API assets have at least one different attribute, or, when the attributes included in the two API assets are the same, at least one attribute value is different.
[0147] Take the second API sequence as {API message 1, API message 3, API message 2} in the above example, assuming that API message 1 belongs to API asset 1, and the identifier of API asset 1 is ID_1, API message 2 belongs to API asset 2, and the identifier of API asset 2 is ID_2, API message 3 belongs to API asset 3, and the identifier of API asset 3 is ID_3, then the first API sequence corresponding to this situation can be expressed as {ID_1, ID_3, ID_2}. In this way, only the ordered set of API asset identifiers and the API asset library need to be maintained. Compared with maintaining an ordered set with API messages, other parameters that do not belong to keys and their corresponding values can be ignored, and the values of key parameters in keys can also be ignored, which saves storage resources and improves the performance of anomaly detection.
[0148] The sequence behavior detection model can be a deterministic model, which can be embodied, for example, by a table or a tree structure. The deterministic model can include API sequences for various possible business transactions under one or more business types. Once the API sequence to be detected matches the existing API sequence in the sequence behavior detection model, it is determined that the API sequence to be detected is normal, thereby determining that the business transaction corresponding to the API sequence to be detected is normal; otherwise, it is determined that the API sequence to be detected is abnormal, thereby determining that the business transaction corresponding to the API sequence to be detected is abnormal.
[0149] The sequence behavior detection model can also be a probability model, which can be embodied, for example, by a table or a directed graph. The probability model can include the conditional probability of each API message or API asset relative to other API messages or API assets in one or more business types, and the conditional probability can be replaced with an abnormality indication when the conditional probability is less than a preset probability threshold. Once the API sequence to be detected matches the abnormality indication in the sequence behavior detection model, it is determined that the API sequence to be detected is abnormal, thereby determining that the business transaction corresponding to the API sequence to be detected is abnormal; if the API sequence to be detected does not match the abnormality indication in the sequence behavior detection model, it is determined that the API sequence to be detected is normal, thereby determining that the business transaction corresponding to the API sequence to be detected is normal.
[0150] In one case, a sequence behavior detection model is maintained for each type of business, and the sequence behavior detection model in S1032 is a sequence behavior detection model applicable to the first type of business to which the first business transaction belongs. In another case, a unified sequence behavior detection model can be maintained for multiple types of business, and S1032 may include: determining a sequence behavior detection sub-model corresponding to the first type of transaction from the sequence behavior detection model, performing anomaly detection on the first API sequence based on the sequence behavior detection sub-model, and obtaining the sequence behavior detection result.
[0151] In the first possible implementation manner, if the sequence behavior detection result indicates that the first API sequence does not match the API call sequence in the first business transaction, then it is determined that the anomaly detection result indicates that the first API sequence behavior is abnormal; if the sequence behavior detection result indicates that the first API sequence matches the API call sequence in the first business transaction, then it is determined that the anomaly detection result indicates that the first API sequence behavior is normal.
[0152] In a second possible implementation, for a solution of detecting only the flow behavior of the first business transaction, S103 may include: based on the first API message and the at least one second API message, performing anomaly detection on the flow behavior of the first business transaction, obtaining a flow behavior detection result, and the flow behavior detection result can be used as the anomaly detection result of the first business transaction. The flow behavior detection result is used to indicate whether the traffic statistics results of the first API message and the at least one second API message meet the traffic statistics characteristics of the first business transaction.
[0153] As an example, S103 may include: S1031, based on the traffic information of the first API message and the traffic information of each second API message in the at least one second API message, determine the traffic statistics result of the first business transaction; S1032, according to the traffic statistics result of the first business transaction, use a parameter configuration template or a flow behavior detection model to perform anomaly detection on the flow behavior of the first business transaction to obtain the flow behavior detection result. The parameter configuration template is used to indicate the traffic statistics characteristics of the first business transaction, and the flow behavior detection model is used to detect whether the traffic statistics results of multiple API messages belonging to the first business transaction meet the traffic statistics characteristics of the first business transaction.
[0154] Among them, the traffic information of the API message may include any information that can indicate the characteristics of the API message, for example, whether it is an uplink API message, whether it is a downlink API message, the length of the API message, the time of the API message, whether there is an abnormal response, whether it is an http request (other protocol types can also be specified according to the configuration), whether it is a post method (other method types can also be specified according to the configuration), the type of API to which the API message belongs (such as an authentication API, a login API, or a data acquisition API), whether it is a referer (i.e., a reference), etc. The above-mentioned "uplink" and "downlink" are relative to the business. The uplink can refer to the direction from the client to the server, and the downlink can refer to the direction from the server to the client. The value of the above-mentioned refer can refer to whether the API message is an API message that is triggered to jump to based on the page corresponding to the previous API.
[0155] The traffic statistics of a business transaction may include the statistics of the traffic information of multiple API messages of the business transaction, indicating the traffic behavior of the business transaction. For example, the traffic statistics of a business transaction may include, but are not limited to: the total number of API messages of the business transaction, the total number of API messages in the uplink and downlink directions of the business transaction, the total number of bytes in the uplink and downlink directions of the business transaction, the total number of syn (used to create a link) packets in the uplink and downlink directions of the business transaction, the total number of fin (used to close a link) packets in the uplink and downlink directions of the business transaction, the duration of the entire transaction, the proportion of status codes corresponding to abnormal responses, the proportion of non-http requests, the proportion of non-post methods, the number of API types involved in the business transaction, the number of calls to a specific API type (such as the number of API calls for authentication, the number of API calls for login, or the number of API calls for data acquisition), the referer null value rate, etc. Among them, the traffic statistics result of the business transaction can be determined based on the traffic information of multiple API messages of the business transaction and the relevant protocol messages of each API message (such as the Transmission Control Protocol (TCP)). For example, the total number of syn packets in the uplink and downlink directions of the business transaction can be determined based on the number of syns in the first three TCP messages of the uplink and downlink API messages included in the business transaction; for another example, the total number of fin packets in the uplink and downlink directions of the business transaction can be determined based on the number of fins in the last four TCP messages of the uplink and downlink API messages included in the business transaction. The refer null rate can refer to the probability that refer is equal to 1. The refer in the API message constructed by the attacker is 0. Then, for the 10 API messages constructed by the attacker, the refer null rate is 100%. However, if it is 10 API messages generated by a main page jumping to other 9 sub-pages (including an API message corresponding to a main page and an API message corresponding to 9 sub-pages), the refer null rate is 10%.
[0156] As an example, S103 can be implemented with the help of a preconfigured parameter configuration template corresponding to the first business transaction. In this implementation, before S103, parameter configuration templates corresponding to possible business transactions in various types of businesses can be maintained in advance, and the parameter configuration template corresponding to any business transaction can include: the correspondence between the traffic statistics items corresponding to any business transaction and the normal value range of each traffic statistics item, wherein the normal value range of any traffic statistics item can be determined based on the value and / or experience of the traffic statistics item of multiple API messages under the business transaction. Then, S1032 may include: obtaining the parameter configuration template corresponding to the first business transaction, the parameter configuration template including the correspondence between the traffic statistics items corresponding to the first business transaction and the normal value range of each traffic statistics item; based on the traffic statistics result of the first business transaction and the parameter configuration template, determining the flow behavior detection result of the first business transaction. Among them, if the value of any traffic statistics item in the traffic statistics result of the first business transaction does not match the corresponding normal value range in the parameter configuration template, then it can be determined that the traffic behavior of the first business transaction is abnormal. Only when the values of all traffic statistics items in the traffic statistics result of the first business transaction match the corresponding normal value range in the parameter configuration template, can it be determined that the traffic behavior of the first business transaction is normal. When determining that the traffic behavior of the first business transaction is abnormal, the abnormal detection result of the first business transaction may also include the cause of the abnormality. For example, the abnormal detection result of the first business transaction may include: traffic statistics items that do not match the normal value range.
[0157] For example, for the above-mentioned service of users paying phone bills, assuming that for a business transaction of this type of service, the number of API calls corresponding to the step of querying the amount of arrears in the account is set to no more than 10 times, then, if an attacker queries the arrears of each account of the user in a traversal manner, a large number of API messages calling the API will be generated in this business transaction (such as 500 API messages calling the API). Then, the flow behavior detection provided in the embodiment of the present application can determine that the flow behavior of this business transaction is abnormal, discover the attacker's attack, and thereby improve network security.
[0158] As another example, S103 can be implemented with the help of a trained flow behavior detection model corresponding to the first business transaction. In this implementation, before S103, flow behavior detection models corresponding to various types of businesses can be obtained in advance, and the flow behavior detection model is used to perform flow behavior anomaly detection on possible business transactions of the corresponding business type. The flow behavior detection model may, for example, include an unsupervised autoencoder or a deep support vector data description (Deep Support Vector Data Description, Deep-SVDD) model. For the specific implementation of the flow behavior detection model and the training process of the model under each specific implementation, please refer to the following Figure 6 The embodiment shown.
[0159] In this example, S103 may include: obtaining a flow behavior detection model corresponding to the first type of business; inputting the traffic statistics result of the first business transaction into the flow behavior detection model, and determining the flow behavior detection result of the first business transaction based on the output result of the flow behavior detection model. Taking the flow behavior detection model including an unsupervised autoencoder as an example, in one case, if the flow behavior detection model only includes an unsupervised autoencoder, then, in S103, determining the flow behavior detection result of the first business transaction based on the output result of the flow behavior detection model may include: calculating the difference between the output result and the traffic statistics result of the first business transaction, comparing whether the difference is less than or equal to the first baseline value of the flow behavior detection model, if so, determining that the flow behavior of the first business transaction is normal, otherwise, determining that the flow behavior of the first business transaction is abnormal. In another case, if the flow behavior detection model includes an unsupervised autoencoder and a computing module, then the output result of the flow behavior detection model in S103 may be the difference between the traffic statistics of the first business transaction calculated by the computing module and the output result of the unsupervised autoencoder, and determining the flow behavior detection result of the first business transaction based on the output result of the flow behavior detection model in S103 may include: comparing whether the difference is less than or equal to a first baseline value of the flow behavior detection model; if so, determining that the flow behavior of the first business transaction is normal; otherwise, determining that the flow behavior of the first business transaction is abnormal. In another case, if the flow behavior detection model includes an unsupervised autoencoder, a calculation module and a comparison module, then the output result of the flow behavior detection model in S103 may be a comparison result obtained by comparing the difference between the traffic statistics result of the first business transaction and the output result of the unsupervised autoencoder by the comparison module; determining the flow behavior detection result of the first business transaction based on the output result of the flow behavior detection model in S103 may include: if the output result indicates that the difference is less than or equal to the first baseline value of the flow behavior detection model, then determining that the flow behavior of the first business transaction is normal; otherwise, determining that the flow behavior of the first business transaction is abnormal. Among them, the first baseline value is a value determined when training the flow behavior detection model, which cooperates with the flow behavior detection model to perform anomaly detection. The specific determination method can be found in Figure 6 Description of the illustrated embodiment.
[0160] For example, taking the case where the flow behavior detection model only includes the unsupervised autoencoder, the flow behavior detection model corresponding to the first business transaction is the unsupervised autoencoder 1, and the first baseline value corresponding to the unsupervised autoencoder 1 is 5%. If the traffic statistics result of the first business transaction is A, A is input into the unsupervised autoencoder 1, and the output result of the unsupervised autoencoder 1 is B, then the flow behavior detection result of the first business transaction can be determined by judging whether the difference between A and B is less than or equal to 5%. If the judgment result is yes, then it is determined that the abnormal detection result of the first business transaction indicates that the flow behavior of the first business transaction is normal. If the judgment result is no, then the abnormal detection result of the first business transaction indicates that the flow behavior of the first business transaction is abnormal. The difference between A and B can be understood as the ratio of the difference between B and A to the information of A itself after the unsupervised autoencoder 1 compresses A and then restores it to B.
[0161] In a third possible implementation, for a solution that detects both the sequence behavior and the flow behavior of the first business transaction, there is no limitation on the order of detecting the sequence behavior and the flow behavior in S103. The sequence behavior detection may be performed first and then the flow behavior detection may be performed when the sequence behavior detection result is normal; or the flow behavior detection may be performed first and then the sequence behavior detection may be performed when the flow behavior detection result is normal; or the flow behavior detection may be performed simultaneously and the abnormal detection result of S103 may be determined based on the detection results of both.
[0162] Taking the example of first performing sequence behavior detection and then performing flow behavior detection when the sequence behavior detection result is normal, S103 may include, for example: S1301, based on the first API message and the at least one second API message, performing anomaly detection on the sequence behavior of the first business transaction to obtain a sequence behavior detection result, and determining to execute S1032 or S1033 based on the sequence behavior detection result; S1302, if the sequence behavior detection result indicates that the first API sequence does not match the API call sequence in the first business transaction, then determining that the anomaly detection result indicates that the first API sequence behavior is abnormal; S1033, if the If the sequence behavior detection result indicates that the first API sequence matches the API call sequence in the first business transaction, then, based on the first API message and the at least one second API message, an anomaly detection is performed on the flow behavior of the first business transaction to obtain a flow behavior detection result, and the anomaly detection result of the first business transaction is determined based on the flow behavior detection result, wherein, if the flow behavior detection result indicates that the flow behavior of the first business transaction is normal, then it is determined that the anomaly detection result indicates that the first business transaction is normal; if the flow behavior detection result indicates that the flow behavior of the first business transaction is abnormal, then it is determined that the anomaly detection result indicates that the flow behavior of the first business transaction is abnormal.
[0163] After S103, the method 100 may further include: abnormal detection result confirmation and abnormal blocking operations. The abnormal detection result confirmation can be understood as the confirmation of whether the abnormal detection result outputted by the sequence behavior detection model and / or the flow behavior detection model (or parameter configuration template) is accurate. For example, the abnormal detection result can be displayed on the interface (such as Figure 1 The configuration interface 300 shown in FIG. Figure 1 The abnormality detection result can be displayed on any display interface connected to the device 100 in the middle), and the staff can view the abnormality detection result on the interface and confirm whether the abnormality detection result is wrong through experience or other means. Abnormal blocking can be understood as blocking the first business transaction when the staff determines on the interface that the abnormality detection result indicates that the first business transaction is abnormal, so as to protect the network from attack as much as possible and improve network security.
[0164] As an example, if an error is found in the anomaly detection result, for example, the staff checks the displayed anomaly detection result on the interface and finds that the first business transaction is actually normal but the anomaly detection result indicates that the first business transaction is abnormal, or finds that the first business transaction is actually abnormal but the anomaly detection result indicates that the first business transaction is normal, then the method 100 may also include: updating the corresponding sequence behavior detection model and / or flow behavior detection model (or parameter configuration template) based on the error that occurred. For example, if the error in the anomaly detection result is found to be an error in the sequence behavior detection result, then the sequence behavior detection model corresponding to the first business transaction may be updated; for another example, if the error in the anomaly detection result is found to be an error in the flow behavior detection result, then the flow behavior detection model (or parameter configuration template) corresponding to the first business transaction may be updated. Wherein, updating the sequence behavior detection model and / or flow behavior detection model (or parameter configuration template) corresponding to the first business transaction may include, for example: updating the transaction fingerprint of the first business transaction; and / or updating the training samples of the sequence behavior detection model and / or flow behavior detection model (or parameter configuration template) corresponding to the first business transaction, and retraining to obtain the sequence behavior detection model and / or flow behavior detection model (or parameter configuration template).
[0165] It can be seen that in the method 100, anomaly detection is performed on the first business transaction based on multiple API messages of the first business transaction, for example, it is determined whether the occurrence order of the multiple API messages of the first business transaction matches the normal sequence behavior of the first business transaction, and for another example, it is determined whether the traffic statistics results of the multiple API messages of the first business transaction meet the normal traffic statistics characteristics of the first business transaction. In this way, accurate and comprehensive anomaly detection of business transactions is achieved, thereby improving the security of the network.
[0166] In addition, in method 100, by pre-learning the multi-dimensional association of parameters of multiple API messages under various types of businesses, the transaction fingerprint of the type of business is determined. When performing anomaly detection, the first transaction fingerprint corresponding to the first API message can be quickly determined, so that the API message with the same value of the first transaction fingerprint as the value of the first transaction fingerprint in the first API message is recorded as the second API message associated with the first API message. In this way, it is possible to mine multiple API messages belonging to the first business transaction, which prepares for the execution of method 100.
[0167] Figure 3 1 is a flow chart of an anomaly detection method 200 provided in an embodiment of the present application. The method 200 illustrates the method of training a sequence behavior detection model. The method 200 may be, for example, Figure 1 The sequence behavior training module 231 in the training module 230 in the analysis platform 200 is executed. Figure 3 As shown, the method 200 may include, for example, the following S201 to S202.
[0168] S201, obtaining multiple training samples, where a first training sample among the multiple training samples is a first API sequence corresponding to a first business transaction, where the first API sequence is obtained by sorting multiple API messages with the same value of a first transaction fingerprint in time, and the value of the first transaction fingerprint in the multiple API messages is used to indicate the first business transaction.
[0169] Before S201, it is necessary to maintain the transaction fingerprints of various businesses and the API sequence corresponding to each possible value of each transaction fingerprint. An API sequence of each business transaction may correspond to one training sample among the multiple training samples in S201.
[0170] In one case, the sequence behavior detection model in method 200 is applicable to a type of business. Then, the multiple training samples in S201 are obtained based on API messages belonging to this type of business, and each of the multiple training samples corresponds to an API sequence of a possible business transaction in this type of business.
[0171] In another case, the sequence behavior detection model in method 200 can be applicable to multiple types of businesses. Then, the multiple training samples in S201 can be divided into different training sample sets according to the business type. Each training sample set corresponds to a type of business. Each training sample set is obtained based on the API message belonging to this type of business. A training sample in a training sample set corresponds to an API sequence of a possible business transaction in this type of business.
[0172] Taking the application of the sequence behavior detection model to the first type of business as an example, the training samples in the embodiment of the present application are introduced. Acquiring multiple training samples in S201 may include: acquiring multiple API messages including the first business identifier from the collected multiple API messages; determining the value set of the first transaction fingerprint from the multiple API messages including the first business identifier; for any value in the determined value set: sorting the multiple API messages whose values of the first transaction fingerprint are any of the values by time to obtain API sequence 1, searching the API asset corresponding to each API message in API sequence 1 from the API asset library, arranging the identifiers of the API assets corresponding to the API messages according to the order of the API messages in API sequence 1, and obtaining API sequence 2, so as to obtain a training sample corresponding to any of the values. When any of the values is the value of the first transaction fingerprint in the first API message in S101, the training sample obtained through the above process is the first training sample mentioned in S201.
[0173] S202: Determine a sequence behavior detection model based on the multiple training samples, where the sequence behavior detection model is used to detect whether an API sequence matches an API call sequence in a corresponding business transaction.
[0174] As an example, each of the multiple training samples corresponds to a first type of business, and the first business transaction belongs to the first type of business. S202 may include: constructing the sequence behavior detection model applicable to the first type of business based on the multiple training samples.
[0175] As another example, the multiple training samples include training samples corresponding to multiple types of business, and the multiple types of business include the first type of business to which the first business transaction belongs. S202 may, for example, include: grouping the multiple training samples according to business type to obtain multiple training sample sets, each sequence sample set in the multiple training sample sets corresponding to a type of business; for any training sample set in the multiple training sample sets, based on the training samples in the any training sample set, constructing a sequence behavior detection sub-model applicable to the business type corresponding to the any training sample set; based on the sequence behavior detection sub-model applicable to the multiple types of business, constructing the sequence behavior detection model.
[0176] The following article takes the sequence behavior detection model corresponding to the first type of business, where the API sequence is an ordered set of identifiers of API assets, as an example to introduce the sequence behavior detection model and its training process.
[0177] If the sequence behavior detection model is a deterministic model, the implementation method of S202 may include: S2021, extracting the API sequence in each training sample; S2022, building a deterministic model based on the API sequence corresponding to each training sample. Taking the API sequence of {ID_1, ID_3, ID_2} as an example, S2022 may include: obtaining the identifier ID_1 of the first API asset in the API sequence, querying in the deterministic model whether the child nodes of the root node include ID_1, if not, creating a branch of ID_1→ID_3→ID_2 under the root node; if yes, obtaining the identifier ID_3 of the next API asset of ID_1, querying in the deterministic model whether ID_1 is used as a parent node and its child nodes include ID_3, if not, creating a branch of ID_3→ID_2 under ID_1; if yes, obtaining the identifier ID_2 of the next API asset of ID_3, querying in the deterministic model whether ID_3 is used as a parent node and its child nodes include ID_2, if not, creating a branch of ID_2 under ID_3, if yes, completing the construction of the deterministic model based on the API sequence {ID_1, ID_2, ID_2}.
[0178] The deterministic model can be expressed as Figure 4 The tree structure shown reflects that Figure 4 API assets are identified by numbers. Figure 4 If the tree structure is applicable to the first type of business, then each branch under the root node can be understood as an API sequence corresponding to a possible business transaction of the first type of business. Figure 4 The figure shows the API sequences corresponding to 14 possible business transactions in the first category of business, which are: 7-1-6-12-32, 7-6-2, 7-6-12, 1-10-20, 1-10-13-2, 24-1-6-2, 2-13, 2-1-6-47, 2-1-12, 9-2-13, 9-1-5, 11-10-1, 11-10-6-2, and 11-9.
[0179] The deterministic model can be represented by a table as shown in Table 3 below. Table 3 uses numbers as identifiers for API assets and shows the Figure 4 The same API sequence in:
[0180] Table 3
[0181]
[0182] The sequence number in Table 3 refers to the position where the API asset identifier appears in the API sequence. The identifier of an API asset in the previous sequence number corresponds to a pair of API asset identifiers in the curly brackets in the next sequence number. For example, the next possible API asset identifiers of the API asset with identifier 7 in sequence number 1 are 1 and 6; the next possible API asset identifiers of the first {1,6} API asset with identifier 1 in sequence number 2 are 6 and 0, and the next possible API asset identifiers of the first {1,6} API asset with identifier 6 in sequence number 2 are 2 and 12. 0 in Table 3 indicates that there is no corresponding API asset. For example, the next possible API asset of the first {1,6} API asset with identifier 6 in sequence number 2 only includes the API asset with identifier 6 but not other API assets. Through the sequence behavior model shown in Table 3, we can get Figure 4 The sequence behavior model shown.
[0183] In this implementation, the method 200 may also include a process of performing anomaly detection on the first business transaction to which the first API belongs, and the process may include, for example: S203, obtaining the first transaction fingerprint of the first API message; S204, obtaining at least one second API message associated with the first API message based on the first transaction fingerprint, wherein the first transaction fingerprint in the first API message and the at least one second API message is the same; S205, sorting the first API message and the at least one second API message by time to obtain a second API sequence; S206, determining the sequence behavior detection result of the first business transaction based on the second API sequence and the deterministic model. For the relevant descriptions of S203 to S205, refer to the relevant descriptions in the method 100. S206 may, for example, include: obtaining a deterministic model applicable to the first category of transactions to which the first business transaction belongs, and searching in the obtained deterministic model whether there is a sequence matching the second API sequence; if so, it is considered that the second API sequence conforms to a reasonable API call sequence in the first category of business, thereby determining that the sequence behavior of the first business transaction is normal; otherwise, it is considered that the second API sequence does not conform to a reasonable API call sequence in the first category of business, thereby determining that the sequence behavior of the first business transaction is abnormal.
[0184] If the sequence behavior detection model is a probability model, the implementation of S202 may include: S2021, extracting the API sequence in each training sample; S2022, based on the API sequence corresponding to each training sample, calculating the conditional probability of the identification of the API asset, thereby constructing a probability model. Taking the API sequence as {ID_1, ID_3, ID_2} as an example, S2022 may include: calculating the conditional probability of ID_3 or ID_2 occurring when ID_1 occurs; similarly, calculating the conditional probability of ID_2 occurring when ID_1 and ID_3 occur; judging whether the calculated conditional probabilities are less than a preset probability threshold (such as 0.15), and if so, adding an abnormal indication to the relationship where the conditional probability is less than the preset probability threshold. For conditional probability, the conditional probability of ID_2 occurring under the condition that ID_1 occurs is equal to the probability that both ID_1 and ID_2 occur, and there is no other API message between the API message corresponding to ID2 and the API message corresponding to ID1 divided by the probability of ID_1 occurring. Assuming that among 10,000 API message sequences, the number of API sequences containing API messages corresponding to ID_1 is 1,000, and the number of API message sequences containing API messages corresponding to ID_1 and ID_2, and there is no other API message between the API message corresponding to ID2 and the API message corresponding to ID1 is 50, then the conditional probability of ID_2 occurring under the condition that ID_1 occurs can be equal to [(50 / 10000) / (1000 / 10000)] = 5%.
[0185] The probability model can be obtained by Figure 5 The directed graph shown shows that Figure 5 The probability between ID_1, ID_2 and ID_3 in the probability model is used as an example to illustrate. Figure 5, showing at least 13 possible API sequences as follows: ID_1→ID_2, ID_2→ID_1, ID_2→ID_2, ID_3→ID_1, ID_3→ID_2, ID_1→ID_2→ID_3, ID_1→ID_2→ID_2, ID_2→ID_1→ID_1, ID_2→ID_3→ID_1, ID_3→ID_2→ID_1, ID_3→ID_1→ID_2, ID_3→ID_2→ID_2, ID_3→ID_1→ID_1. Among them, the conditional probability of ID_1→ID_2 is 0.3, the conditional probability of ID_2→ID_1 is 0.2, the conditional probability of ID_1→ID_1 is 0.6, the conditional probability of ID_2→ID_2 is 0.3, the conditional probability of ID_2→ID_3 is 0.5, the conditional probability of ID_3→ID_3 is 0.5, the conditional probability of ID_3→ID_2 is 0.1, and the conditional probability of ID_3→ID_1 is 0.4. Assuming the preset probability threshold is 0.15, then, if Figure 5 As shown, an abnormal indication is added at the position where the conditional probability is marked on ID_3→ID_2.
[0186] In this implementation, the method 200 may also include a process of performing anomaly detection on the first business transaction to which the first API belongs, and the process may include, for example: S203, obtaining the first transaction fingerprint of the first API message; S204, obtaining at least one second API message associated with the first API message based on the first transaction fingerprint, wherein the first transaction fingerprint in the first API message and the at least one second API message is the same; S205, sorting the first API message and the at least one second API message by time to obtain a second API sequence; S206, determining the sequence behavior detection result of the first business transaction based on the second API sequence and the probability model. For the relevant descriptions of S203 to S205, refer to the relevant descriptions in the method 100. S206 may, for example, include: obtaining a probability model applicable to the first category of transactions to which the first business transaction belongs, and searching in the obtained probability model whether the path passed by the API sequence includes an abnormal indication; if not, it is considered that the second API sequence complies with a reasonable API call sequence in the first category of business, thereby determining that the sequence behavior of the first business transaction is normal; otherwise, it is considered that the second API sequence does not comply with a reasonable API call sequence in the first category of business, thereby determining that the sequence behavior of the first business transaction is abnormal.
[0187] It can be seen that in the method 200, the sequence behavior detection model is trained through the API sequences corresponding to multiple business transactions, thus providing a tool for realizing the detection of the sequence behavior of business transactions. After mining multiple API messages belonging to the first business transaction, it is possible to determine whether the occurrence order of the multiple API messages of the first business transaction matches the normal sequence behavior of the first business transaction through the trained sequence behavior detection model, thereby making it possible to realize accurate and comprehensive anomaly detection of business transactions, thereby improving the security of the network.
[0188] Figure 6 1 is a flow chart of an anomaly detection method 300 provided in an embodiment of the present application. The method 300 takes the flow behavior detection model applicable to the first type of business as an example to illustrate the method of training the flow behavior detection model corresponding to any type of business. The method 300 can be, for example, Figure 1 The flow behavior training module 232 of the training module 230 in the analysis platform 200 is executed. Figure 6 As shown, the method 300 may include, for example, the following S301 to S302.
[0189] S301, obtaining multiple training samples, each of the multiple training samples corresponds to a first category of business, a first training sample among the multiple training samples is a traffic statistics result of multiple API messages of a first business transaction belonging to the first category of business, values of first transaction fingerprints in the multiple API messages are the same, and the values of the first transaction fingerprints in the multiple API messages are used to indicate the first business transaction.
[0190] Before S301, the transaction fingerprints corresponding to various businesses that need to be maintained and the methods for obtaining the transaction fingerprints corresponding to various businesses can refer to the relevant description of S101.
[0191] Before S301, it is also necessary to collect multiple API messages belonging to the first type of business, process each of the multiple API messages, and obtain the traffic information corresponding to the API message; group the multiple API messages according to the business transaction to obtain an API message set corresponding to each business transaction. Then, obtaining the first training sample corresponding to the first business transaction in S301 may include, for example: aggregating the traffic information of the multiple API messages corresponding to the first business transaction to obtain the traffic statistics result of the first business transaction, and recording the traffic statistics result of the first business transaction to the first training sample.
[0192] For example, if the first business transaction involves the above-mentioned API message 1, API message 2 and API message 3, and the first business transaction is indicated by the first transaction fingerprint {code, token}=bb, then the first training sample can be shown in Table 4:
[0193] Table 4
[0194]
[0195] It should be noted that in the training samples in method 300, the API messages involved in the training samples are optional content. The API messages involved in the training samples can be a collection of API messages themselves, or a collection of identifiers of API assets corresponding to the API messages. The collection can be an ordered collection sorted by time (see the above method 200), or it can be unsorted, which does not affect the implementation of the embodiment of the present application. Method 200 and method 300 can use the same training sample. The format of the training sample can be shown in Table 5 below, for example. When method 200 and method 300 are executed, the required content can be filtered out respectively:
[0196] Table 5
[0197]
[0198]
[0199] S302, based on the multiple training samples, determine a flow behavior detection model, the flow behavior detection model is used to detect whether the traffic statistics result of any business transaction among multiple business transactions belonging to the first category of business meets the traffic statistics characteristics of the first category of business, and the first business transaction belongs to the first category of business.
[0200] If the collected training samples meet the start conditions of the training, the preset flow behavior detection model can be trained according to the service type to obtain a flow behavior detection model corresponding to each type of service that can be used in the anomaly detection method provided in the embodiment of the present application. The flow behavior detection model corresponding to the first type of service is obtained as an example in the embodiment of the present application. The training process of the flow behavior detection model corresponding to other service types can refer to the implementation of S302.
[0201] For example, the start condition of training may include: the collection time of training samples reaches a preset time (such as 1 week), or the number of business types reaches a preset number (such as 10).
[0202] The flow behavior detection model can be a neural network model.
[0203] In some possible implementations, the flow behavior detection model may include an unsupervised autoencoder, which can be understood as a neural network that uses a back propagation algorithm to make the output value as close to the input value as possible. Figure 7 As shown, the unsupervised autoencoder may include two parts: an encoder 701 and a decoder 702. The encoder 701 compresses the input X1 into a potential space annotation Z (also called a hidden code), and the learning process is the process of the encoder 701 performing dimensionality reduction encoding on X1; the decoder 702 reconstructs Z to output X2, and the reconstruction process is the process of the decoder 702 performing dimensionality increase decoding on Z. X1 can be expressed as [x11, x12, ..., x1n], and X2 can be expressed as [x21, x22, ..., x2n], where n is an integer greater than 1, and the value of n is consistent with the number of statistical items included in the traffic statistics result. x1i is the value of the i-th statistical item in the traffic statistics result of the first type of service, i = 1, 2, ..., n, and x2i is the restoration result of the unsupervised autoencoder on X1i. Taking the first training sample shown in Table 4 as an example, n=16, X1 can be [x11, x12, ..., x116], and X2 can be [x21, x22, ..., x216].
[0204] It can be understood that the training of the unsupervised autoencoder is to make the input and output closer to each other, so as to learn a mapping relationship. That is to say, through the association learning of the values of multiple traffic statistics items in the traffic statistics results of each business transaction of the first category of business, the unsupervised autoencoder learns the mapping relationship between the multiple traffic statistics items in the traffic statistics results of each business transaction of the first category of business and the normal value combination of the multiple traffic statistics items. The unsupervised autoencoder can restore the value combination of the multiple traffic statistics items in the traffic statistics results of each business transaction of the first category of business well. If the value combination of each traffic statistics item in the traffic statistics results corresponding to a normal business transaction is input to the unsupervised autoencoder, since the unsupervised autoencoder has learned the mapping relationship between the multiple traffic statistics items in the traffic statistics results corresponding to such normal business transactions and the normal value combination of the multiple traffic statistics items, the unsupervised autoencoder can restore the value combination of the multiple traffic statistics items in the traffic statistics results corresponding to the business transaction well. If the input to the unsupervised autoencoder is a combination of values of each traffic statistical item in the traffic statistical result extracted from an abnormal business transaction, the unsupervised autoencoder cannot restore the combination of values of each traffic statistical item in the traffic statistical result corresponding to the business transaction, or in other words, the output result of the unsupervised autoencoder deviates greatly from the input. The deviation between the input and output of the unsupervised autoencoder can be represented by the distance between X1 and X2, and the following formula (3) can be used to determine whether the deviation D(X1,X2) between the input and output of the unsupervised autoencoder is normal:
[0205]
[0206] Among them, f(X1, X2) can also be understood as the judgment condition for the training convergence of the unsupervised autoencoder.
[0207] The training samples corresponding to each type of business can be divided into three parts: training samples for training, training samples for verification, and training samples for testing. Taking the training samples corresponding to the first type of business as an example, they can be divided into: first training samples, first verification samples, and first test samples according to their functions in training. The above-mentioned execution of S302 training is to make the output and input of the flow behavior detection model as close as possible; the method 300 may also include determining a first baseline value of the flow behavior detection model based on the first verification sample, and a reasonable first baseline value can enable the flow behavior detection model to achieve a preset standard for the accuracy of input restoration (such as 95% accuracy in input restoration). In order to determine whether the flow behavior detection model can achieve a preset standard for the restoration of the input, the method 300 may also include testing whether the flow behavior detection model meets the use standard of the anomaly detection method in the embodiment of the present application based on the first test sample and the first baseline value.
[0208] As an example, after S302, the method 300 may also include: S303, obtaining multiple first verification samples, each of the first verification samples being a traffic statistics result of multiple API messages of a business transaction belonging to the first category of business; S304, determining a first baseline value of the flow behavior detection model based on the multiple first verification samples and the flow behavior detection model, the probability that the difference between the output result of each first verification sample in the multiple first verification samples after the flow behavior detection model and the corresponding first verification sample is less than or equal to the first baseline value is greater than or equal to a preset value (such as 95%), and the first baseline value is used to cooperate with the flow behavior detection model to detect anomalies of any business transaction under the first category of business.
[0209] For example, the first baseline value can be calculated based on the mean square error (MSE) of each value in X4 restored by the unsupervised autoencoder of the first verification sample X3 and X3, and the fluctuation of MSE. If X3 is {x31, x32, ..., x3n}, and X4 is {x41, x42, ..., x4n}, then the MSE of X3 and X4 can be calculated by the following formula (4):
[0210]
[0211] Wherein, MSE(X3,X4) is the MSE of X3 and X4, i=1, 2, ..., n. The first baseline value can be calculated based on the following formula (5), for example:
[0212] θ=AVE(MSE(Xopt))+N*STD(MSE(Xopt))…Formula (5)
[0213] Among them, θ is used to represent the first baseline value, AVE() is the average function, STD() is the standard deviation function, STD(MSE()) can also be understood as the fluctuation of MSE(), MSE() is the mean square error function, and Xopt is an array consisting of at least one first verification sample and the restoration result of the first verification sample after the unsupervised autoencoder. For example, Xopt can be the above-mentioned array (X3, X4).
[0214] As an example, after S304, the method 300 may further include: S305, obtaining multiple first test samples, each of the first test samples being a traffic statistics result of multiple API messages of a business transaction belonging to the first category of business; S306, testing the flow behavior detection model based on the multiple first test samples to determine the test result of the flow behavior detection model, and the probability that the difference between the output result of each first test sample in the multiple first test samples after the flow behavior detection model and the corresponding first test sample is less than or equal to the first baseline value θ is greater than or equal to the preset value, then, the test result indicates that the flow behavior detection model is qualified. The flow behavior detection model that has passed the test determined by this example can be used to execute S103 in method 100, for example, can be obtained from Figure 1 The analysis platform 200 in the flow is sent to the device 100, and the device 100 can complete the anomaly detection of any business transaction based on the method 100 and with the help of the flow behavior detection model.
[0215] In this implementation, after obtaining the flow behavior detection model and the first baseline value according to method 300, anomaly detection can be performed on each business transaction belonging to a business type. For example, the method 300 may also include: S307, obtaining the first transaction fingerprint of the first API message; S308, obtaining at least one second API message associated with the first API message based on the first transaction fingerprint, and the first transaction fingerprint in the first API message and the at least one second API message has the same value; S309, determining the traffic statistics result of the first business transaction according to the traffic information of the first API message and the traffic information of each second API message in the at least one second API message; S310, using the flow behavior detection model and the traffic statistics result of the first business transaction, determining the flow behavior detection result of the first business transaction. S307 to S310 can refer to the relevant description in the above method 100.
[0216] In some other possible implementations, the preset detection model may also be a Deep-SVDD model. The basic principle of the Deep-SVDD model is as follows: Figure 8 As shown in Figure 2, the Deep-SVDD model maps multiple first training samples to a hypersphere with c as the center and R as the radius, ensuring that the first training samples corresponding to normal business transactions are all within Figure 8 Within the sphere shown on the right, the first training samples corresponding to the abnormal business transactions all fall outside the sphere, so that the Deep-SVDD model can implement the anomaly detection of the embodiment of the present application. n ={x1,…,x n}, in order to realize the function of mapping all sample points to the hypersphere, the loss function of the Deep-SVDD model can be seen in the following formula (6):
[0217]
[0218] Among them, φ(x i ,W) is the feature mapping function of the Deep-SVDD model, W={W 1 ,…,W L} is the weight of the Deep-SVDD model, Represents the distance from the first training sample to the center of the hypersphere after mapping. Since we hope that the volume of the established hypersphere is as small as possible and the sample points are as close together as possible in the mapping space, the above formula (6) can be understood as minimizing the distance from each point to the center c, and does not involve the process of optimizing the radius of the hypersphere.
[0219] When searching for abnormal points (i.e., testing phase), the distance from each point to the center of the sphere can be calculated and sorted by distance, with anomalies with larger distances being given larger scores. For example, the anomaly score can be calculated based on the following formula (7):
[0220]
[0221] Where s represents the anomaly score, W * Represents the weights in the trained Deep-SVDD model.
[0222] In this implementation, after the flow behavior detection model is obtained according to method 300, anomaly detection can be performed on each business transaction belonging to the first category of business. For example, the method 300 may also include the above-mentioned S307 to S310. It should be noted that if the traffic statistics corresponding to the first API message and at least one second API message of the first business transaction are mapped by the flow behavior detection model and the point obtained falls inside the hypersphere, then the flow behavior detection result indicates that the first business transaction is normal. Conversely, if the traffic statistics corresponding to the first API message and at least one second API message of the first business transaction are mapped by the flow behavior detection model and the point obtained falls outside the hypersphere, then the flow behavior detection result indicates that the first business transaction is abnormal.
[0223] In order to improve the performance of the anomaly detection method, the staff can also confirm the flow behavior detection results of the business transaction, and introduce a feedback mechanism for the wrong flow behavior detection results, that is, the method 300 can also include: in response to determining that the flow behavior detection result of the first API message is wrong, updating the multiple training samples and / or the transaction fingerprints of each business transaction, and retraining the flow behavior detection model. In this way, more reasonable transaction fingerprints and flow behavior detection models of business transactions are obtained, making the anomaly detection of business transaction granularity more accurate.
[0224] The above method 300 is illustratively described by taking the flow behavior detection model of the first type of service as an example. For the training process of the flow behavior detection model of other types of services, reference may be made to the relevant description of the method 300 .
[0225] It should be noted that the neural network types used in the flow behavior detection models corresponding to different business types can be the same or different; alternatively, a flow behavior detection model can be used for anomaly detection for some business types, while a parameter configuration template can be used for anomaly detection for other business types.
[0226] It can be seen that in the method 300, based on multiple training samples of various types of business, a flow behavior detection model corresponding to the business type is trained, which provides a tool for realizing the detection of business transactions in terms of flow behavior. After mining multiple API messages belonging to the first business transaction, the trained flow behavior detection model can be used to detect whether the traffic statistics results of the multiple API messages of the first business transaction match the normal traffic statistics characteristics of the first business transaction, making it possible to realize accurate and comprehensive anomaly detection of business transactions, thereby improving the security of the network.
[0227] Accordingly, the embodiment of the present application also provides an abnormality detection device 900, such as Fig. 9 As shown, the device 900 may include an acquiring unit 901 and a determining unit 902 .
[0228] In some possible implementations, the anomaly detection device 900 may execute the method 100 .
[0229] The acquisition unit 901 is configured to acquire a first transaction fingerprint of a first application program interface (API) message, wherein the value of the first transaction fingerprint in the first API message is used to indicate a first business transaction. The acquisition unit 901 may execute Figure 2 S101 shown.
[0230] The acquisition unit 901 is further configured to acquire at least one second API message associated with the first API message based on the first transaction fingerprint, wherein the first transaction fingerprint in the first API message and the at least one second API message have the same value. The acquisition unit 901 may execute Figure 2 S102 shown.
[0231] A determination unit 902 is configured to determine an abnormality detection result of the first business transaction based on the first API message and the at least one second API message. The determination unit 902 may execute Figure 2 S103 shown.
[0232] In a possible implementation, the acquisition unit 901 is specifically used to: determine a first transaction fingerprint based on a first business identifier of the first API message and a transaction configuration library, the transaction configuration library including at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
[0233] In another possible implementation, the acquisition unit 901 may include: a first acquisition subunit, a first determination subunit, and a second determination unit. The first acquisition subunit is used to acquire multiple first API messages including a first business identifier, wherein the first business identifier is used to identify a first type of business, and the first business transaction belongs to the first type of business; the first determination subunit is used to determine the first value of any parameter among the multiple parameters included in the multiple first API messages based on the value of the parameter in the multiple first API messages, wherein the first value is used to indicate the uncertainty of the corresponding parameter; the second determination subunit is used to determine the first transaction fingerprint based on the first values of the multiple parameters, wherein the first transaction fingerprint belongs to the multiple parameters. As an example, the second determination subunit is specifically used to: determine the parameter whose first value among the multiple parameters meets the preset condition as the first transaction fingerprint.
[0234] In a possible implementation, the determination unit 902 may include: a first detection subunit and a third determination subunit. The first detection subunit is used to perform anomaly detection on the sequence behavior of the first business transaction based on the first API message and the at least one second API message to obtain a sequence behavior detection result; and the third determination subunit is used to determine the anomaly detection result of the first business transaction according to the sequence behavior detection result.
[0235] As an example, the first detection subunit may include: a sorting module and a detection module. The sorting module is used to sort the first API message and the at least one second API message according to time to obtain a first API sequence; the detection module is used to obtain the sequence behavior detection result based on the first API sequence and the sequence behavior detection model, and the sequence behavior model is used to detect whether the API sequence matches the API call sequence in the corresponding business transaction. For example, the sorting module may include: a sorting submodule and a conversion submodule. The sorting submodule is used to sort the first API message and the at least one second API message according to time to obtain a second API sequence; the conversion submodule is used to convert the second API sequence into the first API sequence according to the API assets matched by each API message in the second API sequence, and the first API sequence is an ordered set of identifiers of the API assets matched by each API message in the second API sequence. The sorting submodule is specifically used to: determine the first API asset corresponding to the first API message according to the first API message and the API asset library, and the first API asset includes multiple attributes of the first API message and the value of each of the multiple attributes.
[0236] As an example, the third determination subunit may include: a first determination module and a second determination module, wherein the first determination module is used to determine that the anomaly detection result indicates that the first API sequence behavior is abnormal if the sequence behavior detection result indicates that the first API sequence does not match the API call sequence in the first business transaction; and the second determination module is used to perform anomaly detection on the flow behavior of the first business transaction based on the first API message and the at least one second API message to obtain a flow behavior detection result if the sequence behavior detection result indicates that the first API sequence matches the API call sequence in the first business transaction, and determine the anomaly detection result of the first business transaction based on the flow behavior detection result, and the flow behavior detection result is used to indicate whether the traffic statistics results of the first API message and the at least one second API message meet the traffic statistics characteristics of the first business transaction. Among them, the second determination module performs anomaly detection on the flow behavior of the first business transaction based on the first API message and the at least one second API message to obtain the flow behavior detection result, specifically including: determining the flow statistics result of the first business transaction based on the flow information of the first API message and the flow information of each second API message in the at least one second API message; according to the flow statistics result of the first business transaction, a parameter configuration template or a flow behavior detection model is used to perform anomaly detection on the flow behavior of the first business transaction to obtain the flow behavior detection result, the parameter configuration template is used to indicate the flow statistical characteristics of the first business transaction, and the flow behavior detection model is used to detect whether the flow statistics results of multiple API messages belonging to the first business transaction meet the flow statistical characteristics of the first business transaction.
[0237] In a possible implementation, the determination unit 902 may include: a second detection subunit and a fourth determination subunit. The second detection subunit is used to perform anomaly detection on the flow behavior of the first business transaction based on the first API message and the at least one second API message to obtain a flow behavior detection result; and the fourth determination subunit is used to determine the anomaly detection result of the first business transaction according to the flow behavior detection result.
[0238] It should be noted that for the specific implementation method and technical effect achieved when the device 900 provided in the embodiment of the present application executes the method 100, please refer to the relevant description of the method 100.
[0239] In some possible implementations, the anomaly detection device 900 may execute the method 200 .
[0240] The acquisition unit 901 is used to acquire multiple training samples, wherein the first training sample among the multiple training samples is a first application program interface API sequence corresponding to a first business transaction, wherein the first API sequence is obtained by sorting multiple API messages having the same value of a first transaction fingerprint in time, and the value of the first transaction fingerprint in the multiple API messages is used to indicate the first business transaction. The acquisition unit 901 can execute Figure 3 S201 shown.
[0241] A determination unit 902 is configured to determine a sequence behavior detection model based on the plurality of training samples, wherein the sequence behavior detection model is configured to detect whether the API sequence matches the API call sequence in the corresponding business transaction. The determination unit 902 may execute Figure 3 S202 shown.
[0242] In a possible implementation, each of the multiple training samples corresponds to a first type of business, the first business transaction belongs to the first type of business, and the determination unit 902 is specifically used to: construct the sequence behavior detection model applicable to the first type of business based on the multiple training samples.
[0243] In another possible implementation, the multiple training samples include training samples corresponding to multiple categories of business, and the multiple categories of business include the first category of business to which the first business transaction belongs. The determination unit 902 is specifically used to: group the multiple training samples according to business type to obtain multiple training sample sets, and each sequence sample set in the multiple training sample sets corresponds to a category of business; for any training sample set in the multiple training sample sets, based on the training samples in the any training sample set, construct a sequence behavior detection sub-model applicable to the business type corresponding to the any training sample set; and construct the sequence behavior detection model based on the sequence behavior detection sub-model applicable to the multiple categories of business.
[0244] In a possible implementation, in the device 900, the acquisition unit 901 is also used to acquire the first transaction fingerprint of the first API message; the acquisition unit 901 is also used to obtain at least one second API message associated with the first API message based on the first transaction fingerprint, and the value of the first transaction fingerprint in the first API message and the at least one second API message is the same; the acquisition unit 901 is also used to sort the first API message and the at least one second API message in time to obtain a second API sequence; the determination unit 902 is also used to determine the sequence behavior detection result of the first business transaction based on the second API sequence and the sequence behavior detection model.
[0245] As an example, the acquisition unit 901 executes the acquisition of the first transaction fingerprint of the first API message, which may include: determining the first transaction fingerprint based on the first business identifier and the transaction configuration library of the first API message, the transaction configuration library including at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
[0246] As an example, the acquisition unit 901 performs the acquisition of the first transaction fingerprint of the first API message, which may include: acquiring multiple first API messages including a first business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business; for any parameter among the multiple parameters included in the multiple first API messages, based on the value of the any parameter in the multiple first API messages, determining the first value of the any parameter, the first value is used to indicate the uncertainty of the corresponding parameter; determining the first transaction fingerprint based on the first values of the multiple parameters, the first transaction fingerprint belongs to the multiple parameters. Wherein, determining the first transaction fingerprint based on the first values of the multiple parameters may include: determining the parameter whose first value among the multiple parameters meets the preset condition as the first transaction fingerprint.
[0247] It should be noted that the specific implementation method and technical effect achieved by the device 900 provided in the embodiment of the present application can refer to the relevant description of the method 200.
[0248] In some possible implementations, the anomaly detection device 900 may execute the method 300 .
[0249] The acquisition unit 901 is used to acquire multiple training samples, each of which corresponds to a first type of business, and the first training sample in the multiple training samples is a traffic statistics result of multiple API messages of a first business transaction belonging to the first type of business, and the values of the first transaction fingerprints in the multiple API messages are the same, and the values of the first transaction fingerprints in the multiple API messages are used to indicate the first business transaction. The acquisition unit 901 can be executed Figure 6 S301 shown.
[0250] A determination unit 902 is configured to determine a flow behavior detection model based on the multiple training samples, wherein the flow behavior detection model is configured to detect whether a traffic statistics result of any one of multiple business transactions belonging to a first type of business meets the traffic statistics characteristics of the first type of business, and the first business transaction belongs to the first type of business. The determination unit 902 may be executed Figure 6 S302 shown.
[0251] In a possible implementation, in the device 900, the acquisition unit 901 is also used to acquire the first transaction fingerprint of the first API message; the acquisition unit 901 is also used to obtain at least one second API message associated with the first API message based on the first transaction fingerprint, and the value of the first transaction fingerprint in the first API message and the at least one second API message is the same; the determination unit 902 is also used to determine the traffic statistics result of the first business transaction based on the traffic information of the first API message and the traffic information of each second API message in the at least one second API message; the determination unit 902 is also used to determine the traffic behavior detection result of the first business transaction by using the traffic behavior detection model and the traffic statistics result of the first business transaction.
[0252] As an example, the acquisition unit 901 executes the acquisition of the first transaction fingerprint of the first API message, which may include: determining the first transaction fingerprint based on the first business identifier and the transaction configuration library of the first API message, the transaction configuration library including at least one business identifier and a transaction fingerprint corresponding to each business identifier in the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
[0253] As an example, the acquisition unit 901 executes the acquisition of the first transaction fingerprint of the first API message, which may include: acquiring multiple first API messages including a first service identifier, the first service identifier is used to identify the first type of service; for any parameter among multiple parameters included in the multiple first API messages, based on the value of the any parameter in the multiple first API messages, determining the first value of the any parameter, the first value is used to indicate the uncertainty of the corresponding parameter; determining the first transaction fingerprint based on the first values of the multiple parameters, the first transaction fingerprint belonging to the multiple parameters. Wherein, determining the first transaction fingerprint based on the first values of the multiple parameters may include: determining the parameter whose first value among the multiple parameters meets the preset condition as the first transaction fingerprint.
[0254] It should be noted that the specific implementation method and technical effect achieved by the device 900 provided in the embodiment of the present application can refer to the relevant description of the method 300.
[0255] See also Fig.10 , the present application embodiment provides a communication device 1000. The communication device 1000 may be any communication unit capable of executing the method provided in the present application embodiment, for example, Figure 1The communication device 100 or analysis platform 200 in the embodiment of the present invention comprises at least one processor 1001, a bus system 1002, a memory 1003 and at least one communication interface 1004.
[0256] The communication device 1000 is a hardware structure device that can be used to implement Fig. 9 The functional modules in the abnormality detection device 900 shown in the figure are implemented by, for example, the at least one processor 1001 calling the code in the memory 1003 Fig. 9 The acquisition unit 901 or the determination unit 902 in the abnormality detection device 900 shown.
[0257] Optionally, the communication device 1000 may also be used to implement the functions of the network device in any of the above embodiments.
[0258] Optionally, the processor 1001 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0259] The bus system 1002 may include pathways for transmitting information between the components.
[0260] The communication interface 1004 is used to communicate with other devices or communication networks.
[0261] The memory 1003 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0262] The memory 1003 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 1001. The processor 1001 is used to execute the application code stored in the memory 1003, so as to realize the functions in the method of the present application.
[0263] In a specific implementation, as an embodiment, the processor 1001 may include one or more CPUs, such as Fig.10 CPU0 and CPU1 in.
[0264] In a specific implementation, as an embodiment, the communication device 1000 may include multiple processors, such as Fig.10 1001 and 1007 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0265] Fig.11 is a schematic diagram of the structure of another communication device 1100 provided in an embodiment of the present application. The communication device 1100 may be any communication unit capable of executing the method provided in an embodiment of the present application, for example, Figure 1 The communication device 1100 or the analysis platform 200 in the embodiment. The communication device 1100 can implement the functions of various network devices or servers in the above embodiments.
[0266] The communication device 1100 includes a main control board 1110 and an interface board 1130 .
[0267] The main control board 1110 is also called a main processing unit (MPU) or a route processor card. The main control board 1110 controls and manages various components in the communication device 1100, including route calculation, device management, device maintenance, and protocol processing functions. The main control board 1110 includes: a central processing unit 1111 and a memory 1112.
[0268] The interface board 1130 is also called a line processing unit (LPU), a line card or a service board. The interface board 1130 is used to provide various service interfaces and realize the forwarding of data packets. The service interface includes but is not limited to an Ethernet interface, a POS (Packet over SONET / SDH) interface, etc., and the Ethernet interface is, for example, a Flexible Ethernet Service Interface (Flexible Ethernet Clients, FlexE Clients). The interface board 1130 includes: a central processing unit 1131, a network processor 1132, a forwarding table entry memory 1134 and a physical interface card (Ph11sical interface card, PIC) 1133.
[0269] The central processing unit 1131 on the interface board 1130 is used to control and manage the interface board 1130 and communicate with the central processing unit 1111 on the main control board 1110 .
[0270] The network processor 1132 is used to implement message forwarding processing. The network processor 1132 may be in the form of a forwarding chip. Specifically, the processing of uplink messages includes: message inbound interface processing, forwarding table search; the processing of downlink messages: forwarding table search, etc.
[0271] The physical interface card 1133 is used to implement the docking function of the physical layer, from which the original traffic enters the interface board 1130, and the processed message is sent from the physical interface card 1133. The physical interface card 1133 includes at least one physical interface, which is also called a physical port. The physical interface card 1133 corresponds to the FlexE physical interface in the system architecture. The physical interface card 1133, also known as a daughter card, can be installed on the interface board 1130, and is responsible for converting the optical signal into a message and forwarding the message to the network processor 1132 for processing after performing a validity check on the message. In some embodiments, the central processor 1131 of the interface board 1130 can also perform the functions of the network processor 1132, such as implementing software forwarding based on a general-purpose CPU, so that the network processor 1132 is not required in the physical interface card 1133.
[0272] Optionally, the communication device 1100 includes a plurality of interface boards. For example, the communication device 1100 further includes an interface board 1140 . The interface board 1140 includes a central processor 1141 , a network processor 1142 , a forwarding table entry memory 1144 , and a physical interface card 1143 .
[0273] Optionally, the communication device 1100 further includes a switching fabric board 1120. The switching fabric board 1120 may also be referred to as a switch fabric unit (SFU). When the communication device 1100 has multiple interface boards 1130, the switching fabric board 1120 is used to complete data exchange between the interface boards. For example, the interface board 1130 and the interface board 1140 may communicate through the switching fabric board 1120.
[0274] The main control board 1110 is coupled to the interface board 1130. For example, the main control board 1110, the interface board 1130, the interface board 1140, and the switching network board 1120 are connected to the system backplane through a system bus to achieve intercommunication. In a possible implementation, an inter-process communication (IPC) channel is established between the main control board 1110 and the interface board 1130, and the main control board 1110 and the interface board 1130 communicate through the IPC channel.
[0275] Logically, the communication device 1100 includes a control plane and a forwarding plane. The control plane includes a main control board 1110 and a central processor 1131. The forwarding plane includes various components for performing forwarding, such as a forwarding table entry memory 1134, a physical interface card 1133, and a network processor 1132. The control plane performs functions such as a router, generating a forwarding table, processing signaling and protocol messages, and configuring and maintaining the status of the device. The control plane sends the generated forwarding table to the forwarding plane. On the forwarding plane, the network processor 1132 forwards the message received by the physical interface card 1133 based on the forwarding table sent by the control plane. The forwarding table sent by the control plane can be stored in the forwarding table entry memory 1134. In some embodiments, the control plane and the forwarding plane can be completely separated and not on the same device.
[0276] If the communication device 1100 is configured as a device for executing method 100, the central processor 1111 can obtain a first transaction fingerprint of a first API message, and obtain at least one second API message associated with the first API message based on the first transaction fingerprint, thereby determining an anomaly detection result of the first business transaction based on the first API message and the at least one second API message.
[0277] If the communication device 1100 is configured as an analysis platform for executing the method 200 , the central processor 1111 may obtain a plurality of training samples and determine a sequence behavior detection model based on the plurality of training samples.
[0278] If the communication device 1100 is configured as an analysis platform for executing the method 300 , the central processor 1111 may obtain a plurality of training samples, and determine a flow behavior detection model based on the plurality of training samples.
[0279] It should be understood that the acquisition unit 901 and the determination unit 902 in the abnormality detection device 900 may be equivalent to the central processing unit 1111 or the central processing unit 1131 in the communication device 1100 .
[0280] It should be understood that the communication device 1100 of this embodiment may correspond to the anomaly detection device 900 in the above-mentioned embodiments. The main control board 1110, the interface board 1130 and / or the interface board 1140 in the communication device 1100 may implement the functions and / or the various steps implemented in the anomaly detection device 900 in the above-mentioned embodiments. For the sake of brevity, they will not be repeated here.
[0281] It should be understood that the operation on the interface board 1140 in the embodiment of the present application is consistent with the operation of the interface board 1130, and for the sake of brevity, it will not be repeated. It should be understood that the main control board 1110, the interface board 1130 and / or the interface board 1140 in the communication device 1100 of this embodiment can implement the functions and / or various steps implemented in the communication device 1000 in the above-mentioned various embodiments, and for the sake of brevity, it will not be repeated here.
[0282] It should be understood that there may be one or more main control boards, and when there are multiple boards, they may include a primary main control board and a backup main control board. There may be one or more interface boards. The stronger the data processing capability of the network device, the more interface boards are provided. There may also be one or more physical interface cards on the interface board. There may be no switching network board, or there may be one or more switching network boards. When there are multiple switching network boards, they can jointly realize load sharing and redundant backup. Under a centralized forwarding architecture, the network device may not need a switching network board, and the interface board is responsible for the processing function of the business data of the entire system. Under a distributed forwarding architecture, the network device may have at least one switching network board, and the switching network board is used to realize data exchange between multiple interface boards, providing large-capacity data exchange and processing capabilities. Therefore, the data access and processing capabilities of network devices with a distributed architecture are greater than those of devices with a centralized architecture. Optionally, the network device may have only one board, that is, no switching board, and the functions of the interface board and the main control board are integrated on the board. In this case, the central processor on the interface board and the central processor on the main control board can be combined into one central processor on the board to perform the functions of the two. This type of device has low data exchange and processing capabilities (for example, low-end switches or routers and other network devices). The specific architecture to be adopted depends on the specific networking deployment scenario.
[0283] In some possible embodiments, each of the above-mentioned network devices or network devices can be implemented as a virtualized device. For example, a virtualized device can be a virtual machine (English: Virtual Machine, VM) running a program for sending message functions, and the virtual machine is deployed on a hardware device (for example, a physical server). A virtual machine refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment. The virtual machine can be configured as each network device or server in the embodiments of the present application. For example, each network device or network device can be implemented based on a general physical server in combination with network function virtualization (NFV) technology. Each network device or network device is a virtual host, a virtual router or a virtual switch. Those skilled in the art can virtualize each network device or network device with the above-mentioned functions on a general physical server in combination with NFV technology by reading this application, which will not be repeated here.
[0284] It should be understood that the network devices in the above-mentioned various product forms have any functions of the network devices or communication devices in the above-mentioned method embodiments, which will not be repeated here.
[0285] The embodiment of the present application also provides a chip, including a processor and an interface circuit, the interface circuit is used to receive instructions and transmit them to the processor; the processor, for example, can be a specific implementation form of the message processing device in the embodiment of the present application, and can be used to execute the above-mentioned routing method. Wherein, the processor is coupled with a memory, and the memory is used to store programs or instructions. When the program or instruction is executed by the processor, the chip system implements the method in any of the above-mentioned method embodiments.
[0286] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0287] Optionally, the memory in the chip system may be one or more. The memory may be integrated with the processor or may be separately provided with the processor, which is not limited in the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be provided on different chips. The present application does not specifically limit the type of memory and the arrangement of the memory and the processor.
[0288] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0289] In addition, the embodiment of the present application also provides an anomaly detection system, which includes a device and an analysis platform. The device is used to execute the method of any implementation of method 100; the analysis platform is used to execute the method of any implementation of method 200 or method 300.
[0290] In addition, the embodiment of the present application further provides a storage medium, in which program codes or instructions are stored, and when the program codes or instructions are run on a processor, the above Figure 2 , Figure 3 or Figure 6 A method under any one of the implementation modes in the illustrated embodiments.
[0291] In addition, an embodiment of the present application also provides a program product, which, when running on a processor, executes a method of any one of the implementation modes of the aforementioned method 100, method 200 or method 300.
[0292] It should be understood that "based on determining B according to A" mentioned in the embodiments of the present application does not mean that B is determined only according to A, but B can also be determined according to A and / or other information.
[0293] In the embodiments of the present application, the parameters or fields in the API message refer to the same meaning and can be understood and used interchangeably.
[0294] The "first" in the names of "first business transaction", "first API message" and the like mentioned in this application is only used as a name identifier and does not mean the first in order. The same rule applies to "second" and the like.
[0295] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.
[0296] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for system embodiments and device embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, in which the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0297] The above is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. It should be noted that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the present application, and these improvements and modifications should also be regarded as the protection scope of the present application.
Claims
1. An anomaly detection method, It is characterized in that include: Obtaining a first transaction fingerprint of a first application programming interface (API) message, wherein a value of the first transaction fingerprint in the first API message is used to indicate a first business transaction; obtaining, based on the first transaction fingerprint, at least one second API message associated with the first API message, wherein the first transaction fingerprint in the first API message and the at least one second API message has the same value; Based on the first API message and the at least one second API message, an anomaly detection result of the first business transaction is determined.
2. The method according to claim 1, It is characterized in that The step of obtaining a first transaction fingerprint of a first application program interface (API) message includes: The first transaction fingerprint is determined based on the first business identifier of the first API message and a transaction configuration library, the transaction configuration library including at least one business identifier and a transaction fingerprint corresponding to each business identifier of the at least one business identifier, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
3. The method according to claim 1, It is characterized in that The step of obtaining a first transaction fingerprint of a first application program interface (API) message includes: Acquire a plurality of first API messages including a first service identifier, where the first service identifier is used to identify a first category of service, and the first service transaction belongs to the first category of service; For any parameter among the multiple parameters included in the multiple first API messages, determine a first value of the any parameter based on the value of the any parameter in the multiple first API messages, where the first value is used to indicate uncertainty of the corresponding parameter; The first transaction fingerprint is determined based on first values of the plurality of parameters, the plurality of parameters including the first transaction fingerprint.
4. The method according to claim 3, It is characterized in that The determining the first transaction fingerprint based on the first values of the plurality of parameters comprises: A parameter whose first value among the multiple parameters meets a preset condition is determined as the first transaction fingerprint.
5. The method according to any one of claims 1 to 4, It is characterized in that The determining, based on the first API message and the at least one second API message, an abnormality detection result of the first business transaction includes: Based on the first API message and the at least one second API message, perform anomaly detection on the sequence behavior of the first business transaction to obtain a sequence behavior detection result; The abnormality detection result of the first business transaction is determined according to the sequence behavior detection result.
6. The method according to claim 5, It is characterized in that The performing anomaly detection on the sequence behavior of the first business transaction based on the first API message and the at least one second API message to obtain a sequence behavior detection result includes: Sort the first API message and the at least one second API message by time to obtain a first API sequence; The sequence behavior detection result is obtained based on the first API sequence and the sequence behavior detection model, and the sequence behavior detection model is used to detect whether the API sequence matches the API call sequence of the corresponding business transaction.
7. The method according to claim 6, It is characterized in that The step of sorting the first API message and the at least one second API message according to time to obtain a first API sequence includes: Sort the first API message and the at least one second API message by time to obtain a second API sequence; According to the API assets matched by each API message in the second API sequence, the second API sequence is converted into the first API sequence, where the first API sequence is an ordered set of identifiers of the API assets matched by each API message in the second API sequence.
8. The method according to claim 7, It is characterized in that The converting the second API sequence into the first API sequence according to the API asset matched by each API message in the second API sequence includes: Determine, according to an API asset library, an API asset corresponding to each API message in the second API sequence, wherein the API asset library includes API assets corresponding to multiple API messages, and each API asset includes multiple attributes of the corresponding API message and a value of each of the multiple attributes; The determined API assets are sorted according to the order of the API messages in the second API sequence to obtain the first API sequence.
9. The method according to any one of claims 5 to 8, It is characterized in that The determining, according to the sequence behavior detection result, the abnormality detection result of the first business transaction includes: If the sequence behavior detection result indicates that the first API sequence does not match the API call sequence of the first business transaction, then determining that the anomaly detection result indicates that the first API sequence behavior is abnormal; If the sequence behavior detection result indicates that the first API sequence matches the API call order of the first business transaction, then, based on the first API message and the at least one second API message, anomaly detection is performed on the flow behavior of the first business transaction to obtain a flow behavior detection result, and the anomaly detection result of the first business transaction is determined based on the flow behavior detection result, and the flow behavior detection result is used to indicate whether the traffic statistics results of the first API message and the at least one second API message meet the traffic statistics characteristics of the first business transaction.
10. The method according to claim 9, It is characterized in that The performing anomaly detection on the flow behavior of the first business transaction based on the first API message and the at least one second API message to obtain a flow behavior detection result includes: Determine a traffic statistics result of the first business transaction based on the traffic information of the first API message and the traffic information of each second API message in the at least one second API message; According to the traffic statistics result of the first business transaction, a parameter configuration template or a traffic behavior detection model is used to perform anomaly detection on the traffic behavior of the first business transaction to obtain the traffic behavior detection result. The parameter configuration template is used to indicate the traffic statistics characteristics of the first business transaction, and the traffic behavior detection model is used to detect whether the traffic statistics results of multiple API messages belonging to the first business transaction meet the traffic statistics characteristics of the first business transaction.
11. The method according to any one of claims 1 to 4, It is characterized in that The determining, based on the first API message and the at least one second API message, an abnormality detection result of the first business transaction includes: Based on the first API message and the at least one second API message, perform anomaly detection on the flow behavior of the first business transaction to obtain a flow behavior detection result; The abnormality detection result of the first business transaction is determined according to the flow behavior detection result.
12. An anomaly detection method, It is characterized in that include: Acquire multiple training samples, where a first training sample among the multiple training samples is a first application program interface API sequence corresponding to a first business transaction, where the first API sequence is obtained by sorting multiple API messages having the same value of a first transaction fingerprint in time, and the value of the first transaction fingerprint in the multiple API messages is used to indicate the first business transaction; Based on the multiple training samples, a sequence behavior detection model is determined, where the sequence behavior detection model is used to detect whether an API sequence matches an API call sequence of a corresponding business transaction.
13. The method according to claim 12, It is characterized in that Each of the multiple training samples corresponds to a first type of business, the first business transaction belongs to the first type of business, and determining the sequence behavior detection model based on the multiple training samples includes: Based on the multiple training samples, the sequence behavior detection model applicable to the first type of business is constructed.
14. The method according to claim 12, It is characterized in that The multiple training samples include training samples corresponding to multiple types of business, the multiple types of business include a first type of business to which the first business transaction belongs, and determining a sequence behavior detection model based on the multiple training samples includes: Grouping the multiple training samples according to business type to obtain multiple training sample sets, each sequence sample set in the multiple training sample sets corresponding to a type of business; For any training sample set among the multiple training sample sets, based on the training samples in the any training sample set, construct a sequence behavior detection sub-model applicable to the business type corresponding to the any training sample set; The sequence behavior detection model is constructed based on the sequence behavior detection sub-models applicable to the multiple types of services.
15. The method according to any one of claims 12 to 14, It is characterized in that The first transaction fingerprint is determined based on a service identifier of a first type of service to which the first service transaction belongs and a transaction configuration library, wherein the transaction configuration library includes at least one service identifier and a transaction fingerprint corresponding to each of the at least one service identifier.
16. The method according to any one of claims 12 to 14, It is characterized in that The first transaction fingerprint is determined based on first values of multiple parameters included in multiple first API messages including a first business identifier, the first value is used to indicate uncertainty of the parameter, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
17. An anomaly detection method, It is characterized in that include: Acquire multiple training samples, each of the multiple training samples corresponds to a first type of business, a first training sample among the multiple training samples is a traffic statistics result of multiple API messages of a first business transaction belonging to the first type of business, values of first transaction fingerprints in the multiple API messages are the same, and values of the first transaction fingerprints in the multiple API messages are used to indicate the first business transaction; Based on the multiple training samples, a flow behavior detection model is determined, where the flow behavior detection model is used to detect whether a flow statistics result of any business transaction belonging to the first category of business meets the flow statistics characteristics of the first category of business.
18. The method according to claim 17, It is characterized in that The first transaction fingerprint is determined based on first values of multiple parameters included in multiple first API messages including a first business identifier, the first value is used to indicate uncertainty of the parameter, the first business identifier is used to identify a first category of business, and the first business transaction belongs to the first category of business.
19. An abnormality detection device, It is characterized in that The device comprises: An acquisition unit, configured to perform an acquisition operation in the method according to any one of claims 1 to 18; A determination unit, used to perform the determination operation in the method described in any one of claims 1-18.
20. A computer device, It is characterized in that The computer device includes a processor and a memory; The processor is configured to execute instructions stored in the memory so that the computer device executes the method according to any one of claims 1 to 18.
21. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a processor, the method according to any one of claims 1 to 18 is executed.
22. A program product, It is characterized in that The program product comprises a program, and when the program is run on a processor, the method according to any one of claims 1 to 18 is executed.
