Application topology construction method and device based on code vaccine IAST probe

By installing probes in the program under test, monitoring requests and service call events in real time, and constructing an application topology map, it solves the problem of difficulty in analyzing taint propagation among multiple service nodes with traditional IAST tools, and improves vulnerability analysis efficiency.

CN117675593BActive Publication Date: 2024-10-01BEIJING ANPRO INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311656924.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2024-10-01
Estimated Expiration
2043-12-05

AI Technical Summary

Technical Problem

In the request-response processing process, it is difficult for traditional IAST tools to visually view the calling relationships and propagation paths of externally input taint among multiple service nodes, resulting in low vulnerability analysis efficiency.

Method used

By installing probes in the program under test, monitoring request acquisition and service invocation events in real time, creating initial nodes, call nodes and vulnerability nodes, and adding threat tags based on the exploit status of the vulnerability, building an application topology map to improve vulnerability analysis efficiency.

Benefits of technology

It realizes real-time updating and vulnerability analysis of the latest application topology map of the program under test, improves the efficiency of vulnerability analysis, and allows users to intuitively view stain propagation paths and vulnerability relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117675593B_ABST
    Figure CN117675593B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides an application topology construction method and device based on a code vaccine IAST probe, which relates to the field of network security technology. The method includes: installing a probe in the program under test, and pre-inserting the probe; when a request acquisition event is monitored, an initial node is created in the application topology map of the program under test according to the request; when a service call event of the request is monitored, a call node is created downstream of the initial node; when a vulnerability is detected in the call node, a vulnerability node is created under the call node; according to the exploitation status of the vulnerability, whether to add a threat tag to the vulnerability node is selected to obtain an updated application topology map. The embodiment of the present invention can provide users with the latest application topology map of the program under test and improve the efficiency of vulnerability analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network security technology, and in particular to a method and device for constructing application topology based on code vaccine IAST probe. Background Art

[0002] As the number of applications continues to increase and their functions continue to be enriched, the requests obtained by application servers such as browsers from any application may be called and circulated among multiple services. The calling relationship between each service is usually more complicated, and it is necessary to wait for each service to collaboratively process the request before returning a response.

[0003] Code vaccine technology injects code security capabilities into the application server like a vaccine, clearly sees the parsed traffic inside, perceives the context of the application running process, and can diagnose the location of vulnerabilities and causes of defects in the application itself while the application is running, realize autonomous detection and response, and actively defend against external dangers. Code vaccine technology includes IAST (Interactive Application Security Testing) technology.

[0004] However, when a vulnerability is detected in at least one node during the request-response processing, traditional IAST tools can only track the taint propagation path of the node based on a single service, making it impossible for staff to intuitively view all the service nodes that the external input taint passes through before reaching the node, the calling relationship between all service nodes, the propagation path of the taint within each service node, and other information, making it impossible to perform vulnerability analysis efficiently. Summary of the invention

[0005] The purpose of the embodiments of the present invention is to provide an application topology construction method and device based on the code vaccine IAST probe, so as to achieve the technical effect of providing users with the latest application topology map of the tested program and improving the efficiency of vulnerability analysis.

[0006] In a first aspect, an embodiment of the present invention provides an application topology construction method based on a code vaccine IAST probe, comprising:

[0007] Installing a probe in the program under test and pre-inserting the program through the probe;

[0008] When a request acquisition event is monitored, an initial node is created in the application topology graph of the program under test according to the request;

[0009] When a service call event of the request is monitored, a call node is created downstream of the initial node;

[0010] When a vulnerability is detected in the calling node, creating a vulnerability node under the calling node;

[0011] Whether to add a threat mark to the vulnerability node is selected according to the exploitation status of the vulnerability to obtain an updated application topology map.

[0012] In the above implementation process, when a request acquisition event is listened to, an initial node is created in the application topology map of the program under test according to the request; when a service call event of the request is listened to, a call node is created downstream of the initial node corresponding to the request, and a vulnerability node is created under the call node where the vulnerability exists. Whether to add a threat tag to the vulnerability node is selected according to the exploitation status of the vulnerability. This can provide users with the latest application topology map of the program under test and improve the efficiency of vulnerability analysis.

[0013] Further, the pre-insertion by the probe specifically includes:

[0014] Pre-inserting the request function in the program under test by using the probe to monitor the request acquisition event;

[0015] Pre-inserting the span call service trigger function in the tested program through the probe to monitor the service call event of the request;

[0016] The probe is used to pre-insert the taint source function, taint propagation function and taint aggregation function in the called service corresponding to the calling node, so as to intercept the taint information of the called service.

[0017] In the above implementation process, by using the probes in the program under test to pre-insert the request function, the span call service trigger function, and the taint source function, taint propagation function and taint aggregation function in the called service corresponding to each calling node, it is possible to ensure that during the running of the program under test, the request acquisition events, the requested service call events and the taint information of each called service are monitored in real time.

[0018] Further, when the service call event of the request is monitored, creating a call node downstream of the initial node specifically includes:

[0019] When the service call event of the request is monitored, the service call information is obtained, and it is determined whether the service call information is direct call information;

[0020] If it is determined that the service call information is direct call information, then creating the call node under the initial node;

[0021] If it is determined that the current service call information is not direct call information, the upper-level call node is located according to the current service call information, and the call node is created under the upper-level call node.

[0022] In the above implementation process, when a requested service call event is monitored, the creation position of the call node in the application topology map is determined according to the type of the service call information, so that the call node can be accurately created in the application topology map of the program under test.

[0023] Furthermore, the obtaining of the service call information specifically includes:

[0024] Determine the called service according to the service calling event of the request;

[0025] Obtaining service calling information from the called service;

[0026] Among them, the service call information includes the request packet of the request received by the called service and the span identification code of the request for the called service; the request packet of the request includes the tracking identification code of the request, or the request packet of the request includes the tracking identification code of the request and the span identification code of the request in the last called service.

[0027] In the above implementation process, by obtaining the service call information from the called service when the requested service call event is monitored, it is possible to ensure that the service call information is obtained quickly and accurately.

[0028] Further, the determining whether the service call information is direct call information specifically includes:

[0029] Parsing the service call information;

[0030] If the current service call information does not contain the span identification code of the service called last time, then the current service call information is determined to be direct call information;

[0031] If the current service call information contains the span identification code of the service called last time by the request, it is determined that the current service call information is not direct call information.

[0032] In the above implementation process, the type of this service call information is determined by parsing whether there is a span identification code in the service called last time, and then the creation position of the call node in the application topology map is determined, which can ensure that the call node is accurately created in the application topology map of the program under test.

[0033] Further, locating the upper-level calling node according to the current service calling information specifically includes:

[0034] Determine the last called service according to the span identification code of the request in the current service call information in the last called service;

[0035] Based on the current application topology diagram, the calling node corresponding to the last called service is used as the upper-level calling node.

[0036] In the above implementation process, by indirectly calling the called service in the request, the last called service is determined according to the current service call information, and the calling node corresponding to the last called service in the application topology map is used as the parent calling node, which can ensure that the parent calling node is accurately located in the application topology map of the program under test.

[0037] Furthermore, when the service call event of the request is monitored, a call node is created downstream of the initial node, which specifically includes:

[0038] The current service calling information and the current service application information are used as the node information of the calling node.

[0039] In the above implementation process, by using the service call information and the service application information as the node information of the call node, the display information in the application topology diagram of the program under test can be enriched.

[0040] Furthermore, when a vulnerability is detected in the calling node, before creating a vulnerability node under the calling node, the method further includes:

[0041] According to the taint information of the called service corresponding to the calling node, it is detected whether the calling node has a vulnerability.

[0042] In the above implementation process, by detecting whether the calling node has a vulnerability based on the taint information of the called service corresponding to the calling node, it is possible to ensure that the vulnerability detection of the calling node is performed in real time and accurately.

[0043] Further, the detecting whether the calling node has a vulnerability according to the taint information of the called service corresponding to the calling node specifically includes:

[0044] Storing the hash value of the parameter of the tainted source function in the called service in the tainted pool of the called service;

[0045] Continue to determine whether there is a hash value of the parameter of the taint propagation function in the called service in the taint pool of the called service;

[0046] If yes, the hash value of the return value of the taint propagation function in the called service is stored in the taint pool of the called service;

[0047] Continue to determine whether there is a hash value of the parameter of the taint aggregation function in the called service in the taint pool of the called service;

[0048] If yes, it is determined that the calling node has a vulnerability.

[0049] In the above implementation process, vulnerability detection efficiency can be improved by performing vulnerability detection on the calling node based on the taint pool of the called service.

[0050] Further, when a vulnerability is detected in the calling node, creating a vulnerability node under the calling node specifically includes:

[0051] The vulnerability information of the vulnerability is used as the node information of the vulnerability node.

[0052] In the above implementation process, by using vulnerability information as node information of the vulnerability node, the display information in the application topology diagram of the program under test can be enriched.

[0053] Further, the selecting whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability to obtain an updated application topology map specifically includes:

[0054] Based on the current application topology, determine whether there is the initial node among all upstream nodes of the vulnerable node;

[0055] If yes, it is determined that the exploitation state of the vulnerability is an externally exploitable state, and the threat mark is added to the vulnerability node to obtain the updated application topology map.

[0056] In the above implementation process, by searching for all upstream nodes of the vulnerable node based on the current application topology map, and choosing whether to add a threat mark to the vulnerable node according to whether there is an initial node among all upstream nodes of the vulnerable node, it can be ensured that the vulnerable nodes corresponding to the externally exploitable vulnerabilities are accurately marked in the application topology map.

[0057] In a second aspect, an embodiment of the present invention provides an application topology construction device based on a code vaccine IAST probe, comprising:

[0058] A probe pre-insertion module is used to install a probe in the program under test and perform pre-insertion through the probe;

[0059] An initial node creation module is used to create an initial node in the application topology diagram of the program under test according to the request when a request acquisition event is monitored;

[0060] A calling node creation module, used for creating a calling node downstream of the initial node when monitoring the service calling event of the request;

[0061] A vulnerability node creation module, used for creating a vulnerability node under the calling node when a vulnerability is detected in the calling node;

[0062] The topology map updating module is used to select whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability to obtain an updated application topology map.

[0063] In the third aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor; the memory is coupled to the processor, and when the processor executes the computer program, it implements the application topology construction method based on the code vaccine IAST probe as described above.

[0064] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the application topology construction method based on the code vaccine IAST probe as described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments of the present invention are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0066] Figure 1 A schematic diagram of a flow chart of a method for constructing an application topology based on a code vaccine IAST probe provided in the first embodiment of the present invention;

[0067] Figure 2 A schematic diagram of a taint pool of the currently called service according to an optional embodiment of the first embodiment of the present invention;

[0068] Figure 3 A schematic diagram of an application topology diagram of an optional embodiment of the first embodiment of the present invention;

[0069] Figure 4 A schematic diagram of the structure of an application topology construction device based on a code vaccine IAST probe provided in the second embodiment of the present invention;

[0070] Figure 5A schematic structural diagram of an electronic device provided in the third embodiment of the present invention. DETAILED DESCRIPTION

[0071] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0072] It should be noted that in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance. At the same time, the step numbers in the text are only for the convenience of explaining the embodiments of the present invention and do not serve to limit the order of execution of the steps. The method provided in the embodiments of the present invention can be executed by the relevant terminal device, and the following description will be taken as an example of the server as the execution subject.

[0073] Please see Figure 1 , Figure 1 A schematic flow chart of a method for constructing an application topology based on a code vaccine IAST probe provided in the first embodiment of the present invention. The first embodiment of the present invention provides a method for constructing an application topology based on a code vaccine IAST probe, comprising steps S101 to S105:

[0074] S101, installing a probe in the program under test, and pre-inserting the program through the probe;

[0075] S102, when a request acquisition event is monitored, an initial node is created in the application topology diagram of the program under test according to the request;

[0076] S103, when a requested service call event is monitored, a call node is created downstream of the initial node;

[0077] S104, when a vulnerability is detected in the calling node, creating a vulnerability node under the calling node;

[0078] S105: Select whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability, and obtain an updated application topology map.

[0079] As an example, according to actual detection needs, before the program under test is run, a probe is installed in the program under test, and at least one bytecode is pre-inserted by the probe to enable monitoring of request-related functions, functions related to triggering span call services, and functions related to taint analysis within each service under the service architecture.

[0080] Instrumentation refers to the method of inserting bytecode, that is, detecting logic code, through probes in the program under test on the basis of ensuring the original logical integrity of the program under test, so that the detection logic code can be executed in the subsequent running process of the program under test to capture the program running data, analyze the program running data to obtain the control flow and data flow of the program under test, and then obtain dynamic information such as logic coverage, thereby achieving the detection purpose.

[0081] In practical applications, for the tested program written in Java (an object-oriented programming language), from source code to bytecode compilation and then to loading into JVM (Java Virtual Machine) at runtime, after compiling the bytecode, the bytecode of the class is modified to achieve bytecode enhancement. By not directly modifying the source code and inserting bytecode that does not affect the logic of the source code, the monitoring logic of the stub is implemented, thus ensuring the logical integrity of the source code.

[0082] According to actual display requirements, before the program under test is run, a blank application topology diagram is configured for the program under test, and the display form of elements such as initial nodes, call nodes, vulnerability nodes, threat tags, etc. in the application topology diagram of the program under test is configured.

[0083] During the running of the program under test, the bytecode pre-inserted for request-related functions is used to monitor request acquisition events in real time, the bytecode pre-inserted for functions related to triggering span calls is used to monitor service call events in real time, and the bytecode pre-inserted for functions related to taint analysis within each service is used to intercept the taint information of each service in real time.

[0084] When a request acquisition event is monitored, it can be determined that a new request has arrived, the application topology map of the program under test is obtained, and an initial node is created in the application topology map according to the request.

[0085] When the service call event of the request is monitored, it can be determined that the request has called the service specified in the service architecture, and the service called by the request this time is used as the called service. The initial node corresponding to the request is found in the application topology map, and a calling node is created downstream of the initial node.

[0086] For example, when the first service call event of the request is monitored, it can be determined that the request has called the first service from all services under the service architecture, and the first service is the service being called this time. The initial node corresponding to the request is found in the application topology map, and a call node is created under the initial node. When the next service call event of the request is monitored, it can be determined that the request continues to call the next service from all services under the service architecture, and the next service is the service being called this time. The initial node corresponding to the request is found in the application topology map, and a call node is created downstream of the initial node.

[0087] In real time, the calling node is detected for vulnerabilities based on the taint information of the called service. When a vulnerability is detected in the calling node, the calling node is searched in the application topology map, and a vulnerability node is created under the calling node.

[0088] Determine the exploitation status of the detected vulnerability, and choose whether to add a threat tag to the vulnerability node based on the exploitation status of the vulnerability. For example, if the exploitation status of the vulnerability is an externally exploitable state, it is considered that the vulnerability can be exploited externally and there is a network security threat. The vulnerability node is searched in the application topology map and a threat tag is added to the vulnerability node. If the exploitation status of the vulnerability is an externally unexploitable state, it is considered that the vulnerability cannot be exploited externally and there is no network security threat. The application topology map is not modified, and the currently obtained application topology map is used as the updated application topology map.

[0089] It can be understood that, during the running of the program under test, the request acquisition event is monitored in real time, and an initial node is created in the application topology map according to the request each time the request acquisition event is monitored, and the service call event of any request is monitored in real time, and a call node is created downstream of the initial node corresponding to the request in the application topology map each time the service call event of any request is monitored, and vulnerability detection is performed on all the created call nodes in real time. Whenever a vulnerability is detected in any call node, a vulnerability node is created under the call node in the application topology map, and whether to add a threat mark to the vulnerability node is selected according to the exploitation status of the vulnerability. During the whole process of the running of the program under test, the application topology map can be automatically updated according to the new situation of obtaining requests from the program under test, the call situation of any request between various services under the service architecture, and the vulnerability detection situation. For example, new initial nodes, call nodes, vulnerability nodes and other nodes are created in the application topology map, existing call nodes, vulnerability nodes and other nodes are deleted, and the threat mark of the vulnerability node is modified, etc., and the application topology map is automatically updated, so that users can intuitively view the latest application topology map of the program under test, and quickly and accurately extract various information from the latest application topology map of the program under test for vulnerability analysis.

[0090] The embodiment of the present invention creates an initial node in the application topology map of the program under test according to the request when a request acquisition event is monitored, creates a call node downstream of the initial node corresponding to the request when a service call event is monitored, and creates a vulnerability node under the call node where the vulnerability exists, and chooses whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability. This can provide the user with the latest application topology map of the program under test and improve the efficiency of vulnerability analysis.

[0091] In an optional embodiment, the pre-insertion by the probe specifically includes: pre-inserting the request function in the program under test by the probe to monitor the request acquisition event; pre-inserting the span call service trigger function in the program under test by the probe to monitor the requested service call event; pre-inserting the taint source function, taint propagation function and taint aggregation function in the called service corresponding to the calling node by the probe to intercept the taint information of the called service.

[0092] As an example, according to the actual detection requirements, in order to monitor the arrival of requests in real time, it is necessary to set the insertion point at the request function in the program under test, that is, the request-related function. Among them, the request-related function includes the entry method of Http (HyperText Transfer Protocol) request processing, the related methods of Request object to obtain external parameters, and the related methods of Response object to set the returned data.

[0093] In order to monitor in real time whether the request has a service call and whether the current service call of the request can generate a downstream service call, it is necessary to set the insertion point at the span call service trigger function in the program under test, that is, the trigger span call service related function. The trigger span call service related function is mainly set by the service architecture, usually the trigger span call service related function of the request sending and receiving node under the service architecture.

[0094] For example, Apache Dubbo is a Java RPC (Remote Procedure Call) service development framework. In the Apache Dubbo service architecture, the probes in the program under test can be used to pre-insert methods related to monitoring service calls, such as the org.apache.dubbo.monitor.support.MonitorFilter#invoke(org.apache.dubbo.rpc.Invoker,org.apache.dubbo.rpc.Invocation) method, and the call information can be intercepted using the pre-inserted bytecode, thereby monitoring the requested service call events.

[0095] In order to perform taint propagation analysis on each called service, it is necessary to set the instrumentation point at the taint analysis related functions in each called service. The taint analysis related functions in the called service mainly include the taint source function, taint propagation function and taint aggregation function in the called service.

[0096] Among them, the taint source functions in the called service include the entry method of Http request processing, the related methods of Request object to obtain external parameters, and the related methods of Response object to set return data, such as ServletRequest.getParameter(). The taint propagation functions in the called service include string operations such as string concatenation, string interception, and string reversal, Java collection type operations, file IO (Input / Output, input / output) operations, network IO operations, and Java IO operations, Base64 encryption and decryption, AES / DES encryption and decryption, RSA encryption and decryption methods, such as String.substring(). The taint aggregation functions in the called service include SMTP operation methods, methods related to sending HTTP requests, methods related to XML decoding, methods related to executing system commands, methods related to executing LDAP queries, methods related to executing XPATH queries, methods related to file operations, methods related to JSON deserialization, etc., such as Runtime.getRuntime().exec().

[0097] The embodiment of the present invention uses probes in the program under test to pre-insert request functions, span call service trigger functions, and taint source functions, taint propagation functions, and taint aggregation functions in the called services corresponding to each calling node, thereby ensuring real-time monitoring of request acquisition events, requested service call events, and interception of taint information of each called service during the running of the program under test.

[0098] In an optional embodiment, when a requested service call event is monitored, a call node is created downstream of the initial node, specifically including: when a requested service call event is monitored, the service call information is obtained, and it is determined whether the service call information is direct call information; if it is determined that the service call information is direct call information, a call node is created under the initial node; if it is determined that the service call information is not direct call information, the upper-level call node is located according to the service call information, and a call node is created under the upper-level call node.

[0099] As an example, when a service call event of a request is monitored, it can be determined that the request has called the service specified under the service architecture, and the service requested to be called this time is used as the called service, the service call information of this time is obtained, and it is determined whether the service call information of this time is direct call information. If it is determined that the service call information of this time is direct call information, it is considered that the request does not need to call other services to call the called service this time, and the request directly calls the called service this time. The initial node corresponding to the request is found in the application topology map, and a call node is created under the initial node; if it is determined that the service call information of this time is not direct call information, it is considered that the request needs to call other services to call the called service this time, and the request indirectly calls the called service this time. The upper-level call node is located in the application topology map according to the service call information this time, and a call node is created under the upper-level call node.

[0100] The embodiment of the present invention can ensure accurate creation of the calling node in the application topology map of the program under test by determining the creation position of the calling node in the application topology map according to the type of the service calling information when monitoring the requested service calling event.

[0101] In an optional embodiment, the obtaining of the service call information specifically includes: determining the called service based on the requested service call event; obtaining the service call information from the called service; wherein the service call information includes the request packet of the request received by the called service and the span identification code of the request in the called service; the request packet includes the requested tracking identification code, or the request packet includes the requested tracking identification code and the span identification code of the request in the last called service.

[0102] As an exemplary example, when a request acquisition event is monitored, it can be determined that a new request has arrived. In order to avoid confusion between the request acquired this time and the request acquired previously, a globally unique tracking identification code is allocated to the request acquired this time.

[0103] When a service call event of a request is monitored, it can be determined that the request has called a service specified in the service architecture, and the service requested to be called this time is used as the called service.

[0104] When the request calls the first called service, the first called service is used as the called service this time. The called service receives the request packet of the request, and the tracking identification code of the request is added to the request packet of the request. The tracking identification code of the request is extracted from the request packet of the request, and a unique span identification code is assigned to the request to obtain the span identification code of the request in the called service this time. Among them, the tracking identification code of the request can be added to the HTTP request header of the request or the metadata of the RPC call. The called service this time can only ensure that the span identification code assigned to the request by this service call is unique under the same request.

[0105] When the request continues to call the second called service, the currently called service is updated to the second called service. At this time, the first called service becomes the last called service. The currently called service receives the request packet of the request transmitted by the last called service. The request packet contains the tracking identification code of the request and the span identification code of the request in the last called service. The tracking identification code of the request and the span identification code of the request in the last called service are extracted from the request packet of the request, and a unique span identification code is assigned to the request to obtain the span identification code of the request in the currently called service. Among them, the tracking identification code of the request and the span identification code of the request in the last called service can be added to the HTTP request header of the request or the metadata of the RPC call.

[0106] Similarly, when the request continues to call the next called service, the currently called service is updated to the next called service. At this time, the previously called service becomes the last called service. The currently called service receives the request package of the request transmitted by the last called service. The request package includes the tracking identification code of the request and the span identification code of the request in the last called service. The tracking identification code of the request and the span identification code of the request in the last called service are extracted from the request package of the request, and a unique span identification code is assigned to the request to obtain the span identification code of the request in the currently called service.

[0107] Therefore, the service calling information can be directly obtained from the called service.

[0108] The embodiment of the present invention can ensure that the service calling information is obtained quickly and accurately by obtaining the service calling information from the called service when a requested service calling event is monitored.

[0109] In an optional embodiment, the determination of whether the service call information is direct call information specifically includes: parsing the service call information; if the service call information does not contain a span identification code requesting a service that was called last time, determining that the service call information is direct call information; if the service call information contains a span identification code requesting a service that was called last time, determining that the service call information is not direct call information.

[0110] As an example, when the service call information is obtained from the service being called this time, the service call information is parsed. If the service call information does not contain the span identification code of the request for the service being called last time, it is considered that the request at this time is a direct call to the service being called this time, and the service call information is determined to be direct call information. If the service call information contains the span identification code of the request for the service being called last time, it is considered that the request at this time is an indirect call to the service being called this time, and the service call information is determined not to be direct call information.

[0111] The embodiment of the present invention determines the type of the current service call information by parsing whether there is a span identification code requesting the last called service in the current service call information, and then determines the creation position of the call node in the application topology map, which can ensure that the call node is accurately created in the application topology map of the program under test.

[0112] In an optional embodiment, locating the upper-level calling node according to the current service call information specifically includes: determining the last called service according to the span identification code of the request in the current service call information in the last called service; based on the current application topology map, using the calling node corresponding to the last called service as the upper-level calling node.

[0113] As an example, when it is determined that the service call information is not a direct call information, the span identification code of the request for the last called service is extracted from the service call information, and the last called service is determined based on the span identification code of the request for the last called service. The call node corresponding to the last called service is searched in the current application topology diagram of the program under test, and the call node corresponding to the last called service is used as the parent call node.

[0114] The embodiment of the present invention determines the last called service according to the current service call information when requesting an indirect call to the currently called service, and uses the calling node corresponding to the last called service in the application topology map as the upper-level calling node, thereby ensuring that the upper-level calling node is accurately located in the application topology map of the program under test.

[0115] In an optional embodiment, when a requested service call event is monitored, a call node is created downstream of the initial node, which specifically includes: using the service call information and the service application information as the node information of the call node.

[0116] As an example, when a requested service call event is monitored, the service call information and service application information are obtained, and the service call information and service application information are added as node information of the call node in the application topology map. Among them, the service application information includes the name of the program under test, the name of the service framework, the IP address of the caller service, the name of the called service, the call start time, the call end time, the cumulative call time, and whether the call generates an exception, an error, and other detailed information.

[0117] The embodiment of the present invention can enrich the display information in the application topology diagram of the tested program by using the current service call information and the current service application information as the node information of the call node.

[0118] In an optional embodiment, when a vulnerability is detected in the calling node, before creating a vulnerability node under the calling node, the method further includes: detecting whether the calling node has a vulnerability based on taint information of the called service corresponding to the calling node.

[0119] As an example, for each call node created, the probes in the tested program are used to insert probes at the taint source function, taint propagation function, and taint aggregation function in the called service corresponding to the call node, and the taint information of the called service is intercepted in real time. Based on the taint information of the called service, it is detected whether the call node has a vulnerability.

[0120] The embodiment of the present invention can ensure real-time and accurate vulnerability detection of the calling node by detecting whether the calling node has a vulnerability according to the taint information of the called service corresponding to the calling node.

[0121] In an optional embodiment, the method of detecting whether a calling node has a vulnerability based on the taint information of the called service corresponding to the calling node specifically includes: storing the hash value of the parameters of the taint source function in the called service in the taint pool of the called service; continuing to determine whether the taint pool of the called service contains the hash value of the parameters of the taint propagation function in the called service; if so, storing the hash value of the return value of the taint propagation function in the called service in the taint pool of the called service; continuing to determine whether the taint pool of the called service contains the hash value of the parameters of the taint aggregation function in the called service; if so, determining that the calling node has a vulnerability.

[0122] As an exemplary example, when a requested service call event is monitored, it can be determined that the request has called a service specified in the service architecture, and the service requested to be called this time is used as the called service this time.

[0123] When the service being called is requested, the service being called will create a taint pool. For example, the taint pool of the service being called is Figure 2 shown.

[0124] The probe in the program under test inserts the bytecode at the taint source function in the called service to monitor the taint source function in real time. Once the parameters of the taint source function are obtained, it is considered that there are tainted parameters passed to the called service and there is a taint source. The parameters of the taint source function are hashed and the hash values ​​of the parameters of the taint source function are stored in the taint pool of the called service to complete the taint source marking. The probe in the program under test continues to insert the bytecode at the taint propagation function in the called service to monitor the taint propagation function in real time, obtain the parameters of the taint propagation function, perform hash calculation on the obtained parameters of the taint propagation function, query the taint pool of the called service to see if the hash value of the parameters of the taint propagation function exists. If it exists, it is considered that the taint has propagated inside the called service, and the return value of the taint propagation function is hashed and the hash value of the return value of the taint propagation function is stored in the taint pool of the called service to complete the taint propagation marking. Continue to use the probe in the tested program to insert the bytecode at the taint aggregation function in the called service, monitor the taint aggregation function inside the called service in real time, obtain the parameters of the taint aggregation function, perform hash calculation on the obtained parameters of the taint aggregation function, and query whether the hash value of the parameters of the taint aggregation function exists in the taint pool of the called service. If so, it is determined that there is a vulnerability in the called service, and then it is determined that there is a vulnerability in the calling node.

[0125] The embodiment of the present invention can improve the vulnerability detection efficiency by performing vulnerability detection on the calling node based on the taint pool of the called service.

[0126] In an optional embodiment, when a vulnerability is detected in a calling node, a vulnerability node is created under the calling node, which specifically includes: using vulnerability information of the vulnerability as node information of the vulnerability node.

[0127] As an example, when a vulnerability is detected in a calling node, the probe in the tested program is used to insert bytecodes into the taint source function, taint propagation function, and taint aggregation function in the called service corresponding to the calling node, and the function information of the taint source function, the function information of the taint propagation function, and the function information of the taint aggregation function in the called service are intercepted. The parameters and return value of the taint source function are extracted from the function information of the taint source function, the parameters and return value of the taint propagation function are extracted from the function information of the taint propagation function, and the parameters and return value of the taint aggregation function are extracted from the function information of the taint aggregation function. The parameters and return value of the taint source function, the parameters and return value of the taint propagation function, and the parameters and return value of the taint aggregation function are integrated to obtain vulnerability information.

[0128] The vulnerability information is added as the node information of the vulnerability node in the application topology map.

[0129] The embodiment of the present invention can enrich the display information in the application topology diagram of the tested program by using the vulnerability information as the node information of the vulnerability node.

[0130] In an optional embodiment, the method of selecting whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability to obtain an updated application topology map specifically includes: based on the current application topology map, determining whether there is an initial node among all upstream nodes of the vulnerability node; if so, determining that the exploitation status of the vulnerability is an externally exploitable state, adding a threat mark to the vulnerability node, and obtaining an updated application topology map.

[0131] As an example, after creating a vulnerability node, at least one link with the endpoint being the vulnerability node is formed in the current application topology map. Starting from the vulnerability node, the link is traced upward to obtain all upstream nodes of the vulnerability node, and it is determined whether there is an initial node among all upstream nodes of the vulnerability node. If so, it is considered that the vulnerability can be exploited externally and there is a network security threat. The vulnerability exploitation status is determined to be an externally exploitable state. The vulnerability node is searched in the application topology map, and a threat tag is added to the vulnerability node. If not, it is considered that the vulnerability cannot be exploited externally and there is no network security threat. The vulnerability exploitation status is determined to be an externally unexploitable state, and the application topology map is not modified.

[0132] For example, application topology diagrams such as Figure 3 As shown, Figure 3 If there is an initial node among all upstream nodes of vulnerable node 1, a threat mark needs to be added to vulnerable node 1. Similarly, if there is an initial node among all upstream nodes of vulnerable node 2, a threat mark needs to be added to vulnerable node 2.

[0133] The embodiment of the present invention searches for all upstream nodes of the vulnerability node based on the current application topology map, and chooses whether to add a threat mark to the vulnerability node according to whether there is an initial node among all upstream nodes of the vulnerability node. This can ensure that the vulnerability nodes corresponding to externally exploitable vulnerabilities are accurately marked in the application topology map.

[0134] Please see Figure 4 , Figure 4A schematic diagram of the structure of an application topology construction device based on a code vaccine IAST probe provided for the second embodiment of the present invention. The second embodiment of the present invention provides an application topology construction device based on a code vaccine IAST probe, including: a probe pre-insertion module 201, which is used to install the probe in the program under test and pre-insert the probe; an initial node creation module 202, which is used to create an initial node in the application topology map of the program under test according to the request when a request acquisition event is monitored; a call node creation module 203, which is used to create a call node downstream of the initial node when a requested service call event is monitored; a vulnerability node creation module 204, which is used to create a vulnerability node under the call node when a vulnerability is detected in the call node; a topology map update module 205, which is used to select whether to add a threat tag to the vulnerability node according to the exploitation status of the vulnerability to obtain an updated application topology map.

[0135] In an optional embodiment, the pre-insertion by the probe specifically includes: pre-inserting the request function in the program under test by the probe to monitor the request acquisition event; pre-inserting the span call service trigger function in the program under test by the probe to monitor the requested service call event; pre-inserting the taint source function, taint propagation function and taint aggregation function in the called service corresponding to the calling node by the probe to intercept the taint information of the called service.

[0136] In an optional embodiment, when a requested service call event is monitored, a call node is created downstream of the initial node, specifically including: when a requested service call event is monitored, the service call information is obtained, and it is determined whether the service call information is direct call information; if it is determined that the service call information is direct call information, a call node is created under the initial node; if it is determined that the service call information is not direct call information, the upper-level call node is located according to the service call information, and a call node is created under the upper-level call node.

[0137] In an optional embodiment, the obtaining of the service call information specifically includes: determining the called service based on the requested service call event; obtaining the service call information from the called service; wherein the service call information includes the request packet of the request received by the called service and the span identification code of the request in the called service; the request packet includes the requested tracking identification code, or the request packet includes the requested tracking identification code and the span identification code of the request in the last called service.

[0138] In an optional embodiment, the determination of whether the service call information is direct call information specifically includes: parsing the service call information; if the service call information does not contain a span identification code requesting a service that was called last time, determining that the service call information is direct call information; if the service call information contains a span identification code requesting a service that was called last time, determining that the service call information is not direct call information.

[0139] In an optional embodiment, locating the upper-level calling node according to the current service call information specifically includes: determining the last called service according to the span identification code of the request in the current service call information in the last called service; based on the current application topology map, using the calling node corresponding to the last called service as the upper-level calling node.

[0140] In an optional embodiment, when a requested service call event is monitored, a call node is created downstream of the initial node, which specifically includes: using the service call information and the service application information as the node information of the call node.

[0141] In an optional embodiment, the vulnerability node creation module 204 is also used to detect whether the calling node has a vulnerability based on the taint information of the called service corresponding to the calling node before creating the vulnerability node under the calling node when a vulnerability is detected in the calling node.

[0142] In an optional embodiment, the method of detecting whether the calling node has a vulnerability based on the taint information of the called service corresponding to the calling node specifically includes: determining whether there is a hash value of the parameters of the taint source function in the called service in the taint pool of the called service; if so, continuing to determine whether there is a hash value of the return value of the taint propagation function in the called service in the taint pool of the called service; if so, continuing to determine whether there is a hash value of the parameters of the taint aggregation function in the called service in the taint pool of the called service; if so, determining that the calling node has a vulnerability.

[0143] In an optional embodiment, when a vulnerability is detected in a calling node, a vulnerability node is created under the calling node, which specifically includes: using vulnerability information of the vulnerability as node information of the vulnerability node.

[0144] In an optional embodiment, the method of selecting whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability to obtain an updated application topology map specifically includes: based on the current application topology map, determining whether there is an initial node among all upstream nodes of the vulnerability node; if so, determining that the exploitation status of the vulnerability is an externally exploitable state, adding a threat mark to the vulnerability node, and obtaining an updated application topology map.

[0145] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0146] Please see Figure 5 , Figure 5 A schematic diagram of the structure of an electronic device provided in the third embodiment of the present invention. The third embodiment of the present invention provides an electronic device 30, including a processor 301, a memory 302, and a computer program stored in the memory 302 and configured to be executed by the processor 301; the memory 302 is coupled to the processor 301, and when the processor 301 executes the computer program, the application topology construction method based on the code vaccine IAST probe as described in the first embodiment of the present invention is implemented, and the same beneficial effects can be achieved.

[0147] Among them, when the processor 301 reads the computer program from the memory 302 through the bus 303 and executes the computer program, it can implement the method of any embodiment included in the application topology construction method based on the code vaccine IAST probe as described in the first embodiment of the present invention.

[0148] Processor 301 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 301 can be a microprocessor.

[0149] The memory 302 can be used to store instructions executed by the processor 301 or data related to the execution of the instructions. These instructions and / or data may include code to implement some functions or all functions of one or more modules described in the embodiments of the present invention. The processor 301 of the disclosed embodiment can be used to execute instructions in the memory 302 to implement the application topology construction method based on the code vaccine IAST probe as described in the first embodiment of the present invention. The memory 302 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memories known to those skilled in the art.

[0150] The fourth embodiment of the present invention provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the application topology construction method based on the code vaccine IAST probe as described in the first embodiment of the present invention, and can achieve the same beneficial effects.

[0151] In summary, the embodiment of the present invention provides an application topology construction method and device based on the code vaccine IAST probe, the method comprising: installing the probe in the program under test, and pre-inserting the probe; when a request acquisition event is monitored, creating an initial node in the application topology map of the program under test according to the request; when a service call event of the request is monitored, creating a call node downstream of the initial node; when a vulnerability is detected in the call node, creating a vulnerability node under the call node; according to the exploitation status of the vulnerability, choose whether to add a threat mark to the vulnerability node to obtain an updated application topology map. The embodiment of the present invention creates an initial node in the application topology map of the program under test according to the request when a request acquisition event is monitored, creates a call node downstream of the initial node corresponding to the request when a service call event of the request is monitored, and creates a vulnerability node under the call node where the vulnerability exists, and chooses whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability, so as to provide the user with the latest application topology map of the program under test and improve the efficiency of vulnerability analysis.

[0152] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0153] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0154] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0155] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for constructing application topology based on code vaccine IAST probe, characterized in that: include: Installing a probe in the program under test and pre-inserting the program through the probe; When a request acquisition event is monitored, an initial node is created in the application topology graph of the program under test according to the request; When the service call event of the request is monitored, the called service is determined according to the service call event of the request, the service call information of the current call is obtained from the service called this time, and it is determined whether the service call information of the current call is direct call information; wherein the service call information of the current call includes the request packet of the request received by the service called this time and the span identification code of the request for the service called this time; the tracking identification code of the request is added to the request packet of the request, or the tracking identification code of the request and the span identification code of the request in the last called service are added to the request packet of the request; If it is determined that the service call information is direct call information, a call node is created under the initial node; If it is determined that the service call information of this time is not direct call information, the last called service is determined according to the span identification code of the request in the service call information of this time in the last called service, and based on the current application topology map, the calling node corresponding to the last called service is used as the upper calling node, and the calling node is created under the upper calling node; According to the taint information of the called service corresponding to the calling node, detecting whether the calling node has a vulnerability, and when detecting that the calling node has a vulnerability, creating a vulnerability node under the calling node; Whether to add a threat mark to the vulnerability node is selected according to the exploitation status of the vulnerability to obtain an updated application topology map.

2. The application topology construction method based on the code vaccine IAST probe according to claim 1, characterized in that, The pre-insertion by the probe specifically includes: Pre-inserting the request function in the program under test by using the probe to monitor the request acquisition event; Pre-inserting the span call service trigger function in the tested program through the probe to monitor the service call event of the request; The probe is used to pre-insert the taint source function, taint propagation function and taint aggregation function in the called service corresponding to the calling node, so as to intercept the taint information of the called service.

3. The application topology construction method based on the code vaccine IAST probe according to claim 1 is characterized in that, The determining whether the service call information is direct call information specifically includes: Parsing the service call information; If the current service call information does not contain the span identification code of the service called last time, then the current service call information is determined to be direct call information; If the current service call information contains the span identification code of the service called last time by the request, it is determined that the current service call information is not direct call information.

4. The application topology construction method based on the code vaccine IAST probe according to claim 1 is characterized in that, When the service call event of the request is monitored, a call node is created downstream of the initial node, which specifically includes: The current service calling information and the current service application information are used as the node information of the calling node.

5. The application topology construction method based on the code vaccine IAST probe according to claim 1 is characterized in that, The detecting whether the calling node has a vulnerability according to the taint information of the called service corresponding to the calling node specifically includes: Storing the hash value of the parameter of the tainted source function in the called service in the tainted pool of the called service; Continue to determine whether there is a hash value of the parameter of the taint propagation function in the called service in the taint pool of the called service; If yes, the hash value of the return value of the taint propagation function in the called service is stored in the taint pool of the called service; Continue to determine whether there is a hash value of the parameter of the taint aggregation function in the called service in the taint pool of the called service; If yes, it is determined that the calling node has a vulnerability.

6. The application topology construction method based on the code vaccine IAST probe according to claim 1 is characterized in that, When a vulnerability is detected in the calling node, creating a vulnerability node under the calling node specifically includes: The vulnerability information of the vulnerability is used as the node information of the vulnerability node.

7. The application topology construction method based on the code vaccine IAST probe according to claim 1 is characterized in that, The step of selecting whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability to obtain an updated application topology map specifically includes: Based on the current application topology, determine whether there is the initial node among all upstream nodes of the vulnerable node; If yes, it is determined that the exploitation state of the vulnerability is an externally exploitable state, and the threat mark is added to the vulnerability node to obtain the updated application topology map.

8. An application topology construction device based on code vaccine IAST probe, characterized in that: include: A probe pre-insertion module is used to install a probe in the program under test and perform pre-insertion through the probe; An initial node creation module is used to create an initial node in the application topology diagram of the program under test according to the request when a request acquisition event is monitored; A calling node creation module, used for: when monitoring the service calling event of the request, determining the called service according to the service calling event of the request, obtaining the service calling information from the called service, and judging whether the service calling information is direct calling information; wherein the service calling information includes the request packet of the request received by the called service and the span identification code of the request for the called service; the request packet of the request has the tracking identification code of the request added, or the request packet of the request has the tracking identification code of the request and the span identification code of the request in the last called service added; If it is determined that the service call information is direct call information, a call node is created under the initial node; If it is determined that the service call information of this time is not direct call information, the last called service is determined according to the span identification code of the request in the service call information of this time in the last called service, and based on the current application topology map, the calling node corresponding to the last called service is used as the upper calling node, and the calling node is created under the upper calling node; A vulnerability node creation module, used to detect whether the calling node has a vulnerability according to the taint information of the called service corresponding to the calling node, and create a vulnerability node under the calling node when it is detected that the calling node has a vulnerability; The topology map updating module is used to select whether to add a threat mark to the vulnerability node according to the exploitation status of the vulnerability to obtain an updated application topology map.

9. An electronic device, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor; the memory is coupled to the processor, and when the processor executes the computer program, it implements the application topology construction method based on the code vaccine IAST probe according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the application topology construction method based on the code vaccine IAST probe according to any one of claims 1 to 7.