System framework interface permission vulnerability detection method and device, equipment and storage medium
By obtaining and analyzing the interface path and calling function information of the service interface, and using the detection model to perform permission and function detection, the problem of inaccurate detection results in the existing technology is solved, and more efficient and universal service interface vulnerability detection is achieved.
Patent Information
- Application Number
- CN202411231475.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-06
AI Technical Summary
The existing system framework service interface permission vulnerability detection method relies on a regular verification rule library, resulting in inaccurate detection results and poor universality.
By obtaining the interface path of the service interface, extracting the call function information, and performing permission control and function detection based on the interface code and function information, the pre-trained detection model is used to determine permission vulnerabilities, and avoiding dependence on the regular verification rule base.
It improves the accuracy and universality of system framework service interface detection, and improves the efficiency and accuracy of permission vulnerability detection.
Smart Images

Figure CN119089453A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a system framework interface permission vulnerability detection method, device, equipment and storage medium. Background Art
[0002] With the rapid development of the Internet, electronic devices have become an indispensable part of people's lives, bringing convenience to users while also increasing information security risks. Among them, the system framework is a necessary part of every electronic device, and the system framework service interface permission vulnerability has become a major hidden danger to terminal security.
[0003] The traditional method for detecting permission vulnerabilities in system framework service interfaces is to obtain the code segments of each service interface in the system framework, and then perform regular expression verification on the code segments of each service interface. This method relies on the verification rules of the regular expression verification rule library, resulting in inaccurate permission vulnerability detection results for the service interface. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a system framework interface permission vulnerability detection method, device, equipment and storage medium to accurately and quickly detect permission vulnerabilities in the service interface of the system framework.
[0005] In a first aspect, an embodiment of the present application provides a method for detecting a system framework interface permission vulnerability, the method comprising:
[0006] Obtaining an interface path of at least one service interface in the system framework to be detected;
[0007] For each service interface of the at least one service interface, extracting the calling function information of the service interface according to the interface path of the service interface;
[0008] According to the interface code of the service interface and the calling function information, the authority control and function of the service interface are detected respectively, and the authority control detection result and function detection result of the service interface are obtained respectively;
[0009] According to the permission control detection result and the function detection result of the service interface, the permission vulnerability detection result of the service interface in the system framework to be detected is determined.
[0010] In a second aspect, an embodiment of the present application provides a system framework interface permission vulnerability detection device, the device comprising:
[0011] A first acquisition module is used to acquire an interface path of at least one service interface in the system framework to be detected;
[0012] A second acquisition module is used to extract the calling function information of each service interface of the at least one service interface according to the interface path of the service interface;
[0013] A detection module, used to detect the authority control and function of the service interface according to the interface code of the service interface and the calling function information, and obtain the authority control detection result and function detection result of the service interface respectively;
[0014] The first determination module is used to determine the permission vulnerability detection result of the service interface in the system framework to be detected according to the permission control detection result and the function detection result of the service interface.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0016] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0017] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0018] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0019] In an embodiment of the present application, for each service interface in at least one service interface in the system framework to be detected, compared with the prior art of detecting the service interface using the verification rules in the regular verification rule library, the scheme of the embodiment of the present application extracts the calling function information of the service interface according to the interface path of the service interface obtained, and then detects the permission control and function of the service interface according to the interface code and the calling function information of the service interface, respectively, and obtains the permission control detection result and the function detection result of the service interface respectively, and then determines the permission vulnerability detection result of the service interface according to the permission control detection result and the function detection result of the service interface, so that there is no need to rely on the existing verification rules in the regular verification rule library, and avoids the problem of inaccurate detection results of the service interface caused by the lack of rules in the regular verification rule library for verifying a certain detection item of the service interface. Therefore, the scheme of the embodiment of the present application improves the detection accuracy of the system framework service interface. In addition, the detection scheme of the present application does not need to rely on the existing verification rules in the regular verification rule library, which improves the universality of service interface detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flowchart of a method for detecting system framework interface permission vulnerabilities provided by some embodiments of the present application;
[0021] Figure 2 It is a flowchart of a method for detecting system framework interface permission vulnerabilities provided by some embodiments of the present application;
[0022] Figure 3 It is a structural diagram of a system framework interface permission vulnerability detection device shown in some embodiments of the present application;
[0023] Figure 4 is a schematic diagram of the structure of an electronic device shown in some embodiments of the present application;
[0024] Figure 5 It is a schematic diagram of the hardware structure of an electronic device shown in some embodiments of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0026] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or N. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0027] Before introducing the technical solution of the embodiment of the present application, some professional terms involved in the embodiment of the present application are first introduced:
[0028] A function call chain refers to the sequence in which one function calls another during program execution.
[0029] Data flow: During program execution, when one function calls another function, the parameters of the called function and the data within the called function may be passed to the calling function. This flow of data forms the data flow between functions.
[0030] As described in the background technology, in the prior art, when detecting permission vulnerabilities in the service interface of the system framework, there is a problem of low detection accuracy. In order to solve the above problem, the embodiments of the present application provide a method, device, equipment and storage medium for detecting permission vulnerabilities in a system framework interface. For each service interface in at least one service interface in the system framework to be detected, compared with the prior art of using the verification rules in the regular verification rule library to detect the service interface, the scheme of the embodiments of the present application, based on the interface path of the service interface obtained, extracts the calling function information of the service interface, and then, based on the interface code and the calling function information of the service interface, respectively detects the permission management of the service interface. The permission control and function are detected to obtain the permission control detection result and function detection result of the service interface respectively, and then the permission vulnerability detection result of the service interface is determined according to the permission control detection result and function detection result of the service interface. In this way, there is no need to rely on the existing verification rules in the regular verification rule base, and the problem of inaccurate detection results of the service interface caused by the lack of rules in the regular verification rule base to verify a certain detection item of the service interface is avoided. Therefore, the scheme of the embodiment of the present application improves the detection accuracy of the system framework service interface. In addition, the detection scheme of the present application does not need to rely on the existing verification rules in the regular verification rule base, and improves the universality of service interface detection.
[0031] The technical solution of the embodiment of the present application can be applied to the permission vulnerability detection scenario of the service interface of the system framework.
[0032] The following is a detailed description of the system framework interface permission vulnerability detection method provided by the embodiment of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0033] Figure 1 It is a flow chart of a system framework interface permission vulnerability detection method provided in an embodiment of the present application. The executor of the system framework interface permission vulnerability detection method can be an electronic device, which can be but is not limited to a personal computer (PC), a smart phone, a tablet computer or a personal digital assistant (PDA), etc.
[0034] like Figure 1 As shown, the system framework interface permission vulnerability detection method provided in the embodiment of the present application may include steps 110 to 140.
[0035] Step 110: Obtain an interface path of at least one service interface in the system framework to be detected.
[0036] The system framework to be detected may be a system framework to be detected, for example, a system framework of an electronic device.
[0037] The service interface may be an interface for providing services in the system framework to be detected. For example, a taxi-hailing application may need to obtain the user's location information. The corresponding taxi-hailing application will have an interface that provides positioning services. This interface is called a service interface of the system framework to be detected.
[0038] The interface path may be a path of a service interface, and the relevant information of the service interface may be obtained through the interface path.
[0039] In some embodiments of the present application, when detecting a permission vulnerability of at least one service interface in a system framework to be detected, it is first necessary to obtain the interface path of at least one service interface in the system framework to be detected. Specifically, the interface path of at least one service interface in the system framework to be detected can be obtained by using an interface acquisition command.
[0040] In an example, taking the Android system framework as the system framework to be detected, all service interfaces and interface paths of all service interfaces in the current Android system framework may be obtained through the "adb shellservice list" command.
[0041] Step 120: For each service interface of the at least one service interface, extract the calling function information of the service interface according to the interface path of the service interface.
[0042] The calling function information may be information related to the calling function of the service interface, such as a function calling chain between the calling functions of the service interface and a data stream transmitted between the calling functions. The function calling chain here may be a calling chain between the calling functions involved in the service interface.
[0043] In some embodiments of the present application, for each service interface, the function call chain between each calling function of the service interface and the data flow transmitted between each calling function can be extracted according to the interface path of the service interface.
[0044] In some embodiments of the present application, in order to accurately extract the calling function information of the service interface, before step 120, the above method may further include:
[0045] Get the target framework file of the system framework to be detected;
[0046] Decompile the target framework file to obtain the decompiled code file of the target framework file;
[0047] Step 120 may specifically include:
[0048] According to the interface path of the service interface, the calling function information of the service interface is extracted from the decompiled code file.
[0049] The target framework file may be a framework file of the system framework to be detected, and specifically the framework file may be a jar file.
[0050] In some embodiments of the present application, for the system framework, each system framework has its corresponding framework file, there may be multiple framework files, and each framework file may include at least one service interface of the system framework.
[0051] The decompiled code file may be a code file formed after decompilation of the target framework file.
[0052] In some embodiments of the present application, by decompiling the target framework file of the system framework to be detected, a decompiled code file of the target framework file can be obtained, and then according to the interface path of the service interface, the calling function information of the service interface can be extracted from the decompiled code file.
[0053] In some embodiments of the present application, since there may be multiple framework files of the system frame, there may be multiple target framework files obtained for the system framework to be detected. Before decompiling the target framework file, it is first necessary to integrate the multiple target framework files obtained into one file. Specifically, the multiple target framework files can be integrated into a jar file through the "jar cvf" command, and then the integrated jar file is decompiled to obtain a decompiled code file.
[0054] In an embodiment of the present application, by decompiling the target framework file of the system framework to be detected, a decompiled code file of the target framework file can be obtained, and then according to the interface path of the service interface, the calling function information of the service interface can be extracted from the decompiled code file, so that the calling function information of the service interface can be accurately obtained.
[0055] In some embodiments of the present application, in order to improve the efficiency of obtaining the target framework file, the obtaining of the target framework file of the system framework to be detected may specifically include:
[0056] Get the target system framework type of the system framework to be detected;
[0057] According to the target system framework type and the correspondence between the preset system framework type and the framework file storage path, determine the target storage path of the target framework file corresponding to the system framework to be detected;
[0058] Get the target framework file according to the target storage path.
[0059] The target system framework type may be the framework type of the system framework to be detected, for example, whether the system framework to be detected is an Android system framework or an iOS system framework.
[0060] The target storage path may be a storage path of a target framework file corresponding to the system framework to be detected.
[0061] In some embodiments of the present application, the target storage path of the target framework file corresponding to the system framework to be detected can be determined based on the target system framework type of the system framework to be detected and the correspondence between the pre-set system framework type and the framework file storage path, and then the target framework file can be directly and quickly acquired based on the target storage path.
[0062] In some embodiments of the present application, when the target framework file is obtained according to the target storage path, it can be obtained by physical transmission.
[0063] In an example, taking the system framework to be detected as the system framework of the mobile phone, and the executor of the embodiment of the present application as a computer, a USB cable can be used to connect the computer and the mobile phone, and then the framework jar file of the mobile phone system can be automatically dragged to the computer according to the target storage path. Specifically, the framework jar file of the mobile phone system can be dragged to the computer by using the command "adb pull mobile phone path target storage path".
[0064] In an embodiment of the present application, the target storage path of the target framework file corresponding to the system framework to be detected can be quickly determined based on the target system framework type of the system framework to be detected and the correspondence between the pre-set system framework type and the framework file storage path, and then the target storage path can be used to obtain the target framework file, thereby improving the efficiency of obtaining the target framework file.
[0065] Step 130: According to the interface code and calling function information of the service interface, the authority control and function of the service interface are detected respectively, and the authority control detection result and function detection result of the service interface are obtained respectively.
[0066] Among them, permission control can be whether the service interface has permission control. For example, if a taxi-hailing software needs to obtain the user's location information, then the service interface for obtaining the location information in the taxi-hailing software is subject to permission control, that is, the service interface for obtaining the location information in the taxi-hailing software can obtain the user's location information only after obtaining the user's permission.
[0067] The permission control detection result may be a result obtained after detecting the permission control of the service interface.
[0068] The function test result may be a result obtained after testing the function of the service interface.
[0069] In some embodiments of the present application, the permission control and function of the service interface can be tested respectively according to the interface code and calling function information of the service interface, and then the permission control test results and function test results of the service interface can be obtained respectively.
[0070] It should be noted that in actual applications, when the permission control and functions of the service interface are tested separately, the permission control and functions of the service interface are tested separately based on the interface code, function call chain, data flow, each calling function and the function code of each calling function of the service interface.
[0071] In the prior art, when detecting permission vulnerabilities in service interfaces, regular expression verification is performed on the code segments of each service interface one by one, which is time-consuming.
[0072] In order to solve the above problems, in the embodiments of the present application, when detecting permission vulnerabilities in service interfaces, they can be detected through a pre-trained detection model, thereby improving the efficiency of detecting permission vulnerabilities in service interfaces.
[0073] Specifically, the permission control and functions of the service interface can be tested in the following ways:
[0074] In some embodiments of the present application, in order to improve the efficiency of the permission control detection of the service interface, the permission control of the service interface is detected according to the interface code and the calling function information of the service interface in step 130, and the permission control detection result of the service interface is obtained, which may specifically include:
[0075] Inputting the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function into the first permission control detection model;
[0076] The permission control of the service interface is detected based on the first permission control detection model to determine the permission control detection result of the service interface.
[0077] The first permission control detection model may be a pre-trained model for detecting permission control of a service interface. The first permission control detection model may be, but is not limited to, a support vector machine model, a decision tree model, or a neural network model.
[0078] In some embodiments of the present application, the interface code, function call chain, data flow, each calling function and the function code of each calling function of the service interface can be input into a first permission control detection model, and then the permission control of the service interface can be detected based on the first permission control detection model to determine the permission control detection result of the service interface. The permission control detection result here can be used to indicate whether there is permission control on the service interface.
[0079] It should be noted that when the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function are input into the first permission control detection model, the input format can be: [service interface name, interface code of the service interface, function call chain, [[calling function 1, function code of calling function 1], [calling function 2, function code of calling function 2], [calling function 3, function code of calling function 3], ... ], data flow].
[0080] In an embodiment of the present application, the permission control of the service interface is detected by the first permission control detection model to determine whether there is permission control on the service interface. In this way, the permission control is detected by the pre-trained first permission control detection model, thereby improving the efficiency of permission control detection.
[0081] In some embodiments of the present application, in order to improve the efficiency of permission control detection, the permission control of the service interface is detected based on the first permission control detection model to determine whether the service interface has permission control, which may specifically include:
[0082] Detecting whether there is a permission control code in the interface code of the service interface based on the first permission control detection model;
[0083] In the case where it is determined that the interface code of the service interface has a permission control code, determining that the service interface has permission control;
[0084] When it is determined that no permission control code exists in the interface code of the service interface, it is determined that no permission control exists on the service interface.
[0085] The permission control code may be a code contained in the interface code of the service interface and used to indicate whether the service interface has permission control.
[0086] In some embodiments of the present application, if a service interface is subject to permission control, a permission control code will be added to its interface code when the interface code of the service interface is written. Therefore, when detecting whether the service interface has permission control based on the first permission control detection model, it can be detected based on the first permission control detection model whether there is a permission control code in the interface code of the service interface. If it is determined that there is a permission control code in the interface code of the service interface, it is determined that there is permission control on the service interface. If it is determined that there is no permission control code in the interface code of the service interface, it is determined that there is no permission control on the service interface.
[0087] In some embodiments of the present application, when the first permission control detection model is used to detect whether there is a permission control code in the interface code of the service interface, the output result of the first permission control detection model can be in the following format: [service interface name, true / false], where "true" indicates that there is a permission control code in the interface code of the service interface, that is, the service interface has permission control, and "false" indicates that there is no permission control code in the interface code of the service interface, that is, the service interface does not have permission control.
[0088] In an embodiment of the present application, a first permission control detection model is used to detect whether there is permission control code in the interface code of the service interface to determine whether there is permission control on the service interface. In this way, it is only necessary to detect whether there is permission control code in the interface code of the service interface to determine whether there is permission control on the service interface, thereby improving the efficiency of permission control detection.
[0089] In some embodiments of the present application, before using the first permission control detection model, it is necessary to first construct the first permission control detection model. Specifically, the first permission control detection model may be constructed in the following manner: That is, before step 130, the above method may further include:
[0090] Obtaining a second permission control detection model;
[0091] Training the second permission control detection model based on the first data set to obtain a third permission control detection model;
[0092] The third permission control detection model is trained based on the second data set to obtain the first permission control detection model.
[0093] Among them, the second permission control detection model can be a pre-acquired model for detecting the permission control of the service interface, but the detection accuracy of the second permission control detection model for the permission control of the service interface is low. For example, the second permission control detection model can be a currently open source code detection model, such as CodeShell-7B, which has basic code detection capabilities.
[0094] It should be noted that, in the case where the second permission control detection model is a currently open source code detection model, since the currently open source code detection model may be a code detection model for service interfaces of all types of frameworks, not just a code detection model for service interfaces of the system framework, the currently open source code detection model may have weak code detection capabilities for service interfaces of the system framework. Therefore, in the embodiments of the present application, the second permission control detection model can also be a model that is pre-developed by the user and only performs code detection on the service interfaces of the system frame, but the model has insufficient detection capabilities for permission control code. Whether the specific second permission control detection model is an open source code detection model or a user-developed model can be selected according to user needs and is not limited in the embodiments of the present application.
[0095] The first data set may be a data set used to train a second permission control detection model. The first data set may include multiple groups of first training samples. The first training samples here may be training samples for training the second permission control detection model. Each group of first training samples may include an interface code of a training service interface and a permission control code corresponding to the training service interface.
[0096] The training service interface mentioned above may be a service interface used to construct the first permission control detection model, and specifically may be an interface that has been determined to be permission controlled.
[0097] The third permission control detection model can be a model obtained by training the second permission control detection model based on the first data set. The third permission control detection model has a higher recognition accuracy for permission control codes than the second permission control detection model. In other words, the model parameters of the second permission control detection model are fine-tuned using the first data set to obtain the third permission control detection model.
[0098] The second data set may be a data set for training a third permission control detection model. The second data set may include multiple groups of second training samples. The second training samples here may be training samples for training the third permission control detection model. Each group of second training samples may include a training function call chain between each calling function of the training service interface, each calling function of the training service interface, a function code of each calling function of the training service interface, and a permission control code label of the training service interface.
[0099] The training function call chain can be a function call chain between the calling functions of the training service interface. The permission control code label can be a label used to characterize whether the training service interface has a permission control code, that is, the permission control code label indicates that the training service interface has a permission control code or that the training service interface does not have a permission control code.
[0100] It should be noted that the training service interface used when training the second permission control detection model and the training service interface used when training the third permission control detection model can be the same or different. The specific one can be selected according to user needs and is not limited in the embodiments of the present application.
[0101] In some embodiments of the present application, the first step of fine-tuning the model parameters of the second permission control detection model can be performed by training the interface code of the service interface and the permission control code corresponding to the service interface to obtain a third permission control detection model, and then the call chain and code recognition ability of the third permission control detection model are further trained by using the training function call chain between the calling functions of the training service interface, the calling functions of the training service interface, the function codes of the calling functions of the training service interface, and the permission control code labels of the training service interface to obtain the first permission control detection model.
[0102] It should be noted that when training the third permission control detection model, the second data set in the format of [training function call chain, [[call function 1, call function 1's function code], [call function 2, call function 2's function code], [call function 3, call function 3's function code], ...], training service interface's permission control code label] can be used to train the third permission control detection model.
[0103] In an embodiment of the present application, the first step of fine-tuning the model parameters of the second permission control detection model is performed by training the interface code of the service interface and the permission control code corresponding to the service interface to obtain a third permission control detection model, and then the call chain and code recognition capabilities of the third permission control detection model are further trained by using the training function call chain between the calling functions of the training service interface, the calling functions of the training service interface, the function codes of the calling functions of the training service interface, and the permission control code labels of the training service interface to obtain the first permission control detection model. In this way, a first permission control detection model that can accurately detect the permission control of the service interface can be obtained.
[0104] In some embodiments of the present application, in order to improve the function detection efficiency of the service interface, the permission control of the service interface is detected according to the interface code and the calling function information of the service interface in step 130 to obtain the permission control detection result of the service interface, which may specifically include:
[0105] Inputting the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function into the first function detection model;
[0106] The function of the service interface is detected based on the first function detection model to determine the permission control detection result of the service interface.
[0107] The first function detection model may be a pre-trained model for detecting the function of the service interface. The first function detection model may include, but is not limited to, a support vector machine model, a decision tree model, a neural network model, and the like.
[0108] In some embodiments of the present application, the interface code, function call chain, data flow, each calling function and the function code of each calling function of the service interface can be input into a first function detection model, and then the function of the service interface can be detected based on the first function detection model to determine the permission control detection result of the service interface.
[0109] It should be noted that when the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function are input into the first function detection model, the input format can be: [service interface name, interface code of the service interface, function call chain, [[calling function 1, function code of calling function 1], [calling function 2, function code of calling function 2], [calling function 3, function code of calling function 3], ... ], data flow].
[0110] In an embodiment of the present application, the function of the service interface is detected by a first function detection model to determine the permission control detection result of the service interface. In this way, the function of the service interface is detected by a pre-trained first function detection model, thereby improving the efficiency of the function detection of the service interface.
[0111] In some embodiments of the present application, in order to improve the efficiency and accuracy of function detection, the function of the service interface is detected based on the first function detection model to determine the permission control detection result of the service interface, which may specifically include:
[0112] Based on the first function detection model, obtain a function description of the service interface;
[0113] In the case where it is determined that the function description is a preset function description, a permission control detection result of the service interface is determined to be that the service interface is a preset function interface.
[0114] The functional description of the service interface may be information used to describe the function of the service interface, such as text information.
[0115] The preset function description may be a function description of a preset service interface that is preset, and specifically the preset function description may be information for obtaining the user's private data.
[0116] The preset functional interface can be a pre-set interface with sensitive functions, such as an interface for obtaining the user's private data, such as an interface for the user to obtain the user's location information, the user's contact information, etc. It can also be a functional interface that should not be open to the outside world, such as an interface for pulling up any component, an interface for silently installing an application, etc.
[0117] In some embodiments of the present application, a functional description of a service interface can be obtained based on a first functional detection model, and then a determination can be made as to whether the functional description is a preset functional description. If it is determined to be a preset functional description, the service interface can be determined to be a preset functional interface.
[0118] It should be noted that after the interface code, function call chain, data flow, each calling function and the function code of each calling function of the service interface are input into the first function detection model, the format of the output result of the first function detection model can be: [service interface name, function description], where the function description can be the function description of the detected service interface.
[0119] In an embodiment of the present application, a functional description of a service interface can be obtained through a first functional detection model, and based on the functional description of the service interface, it can be determined whether the service interface is an interface of a sensitive function, thereby quickly and accurately determining whether the service interface is a sensitive interface.
[0120] In some embodiments of the present application, before using the first function detection model, it is necessary to first construct the first function detection model. Specifically, the first function detection model may be constructed in the following manner: That is, before step 130, the above method may further include:
[0121] Obtaining a second function detection model;
[0122] The second function detection model is trained based on the third data set to obtain a first function detection model.
[0123] Among them, the second function detection model can be a pre-acquired model for detecting the functions of the service interface, but the detection accuracy of the second function detection model for the functions of the service interface is low. For example, the second function detection model can be a currently open source code detection model, such as CodeShell-7B, which has basic code detection capabilities.
[0124] The third data set may be a data set for training the second function detection model. The third data set may include multiple groups of third training samples. The third training samples here may be training samples for training the second function detection model. Each group of third training samples may include the interface code, function description and label of the function description of the training service interface.
[0125] The label of the function description may be used to characterize whether the function description in the third training sample is the function description of the training service interface in the third training sample. Specifically, the label of the function description may be true or false, where "true" is used to indicate that the function description in the third training sample is the function description of the training service interface in the third training sample, and "false" is used to indicate that the function description in the third training sample is not the function description of the training service interface in the third training sample.
[0126] It should be noted that the training service interface used when training the second function detection model can be the same as or different from the training service interface used when training the second permission control detection model and the third permission control detection model. The specific one can be selected according to user needs and is not limited in the embodiments of the present application.
[0127] In some embodiments of the present application, since the current open source code detection model may be for code detection of service interfaces of all types of frameworks, rather than just for code detection of service interfaces of system frameworks, the current open source code detection model may have weak code detection capabilities for service interfaces of system frameworks. Therefore, the interface code, function description, and function description labels of the training service interface can be used as the corpus to fine-tune the open source code model to strengthen its understanding of the system framework functions.
[0128] In some embodiments of the present application, when training the second function detection model, the format of the third training sample used may be [interface code of the training service interface, function description, true / false].
[0129] In an embodiment of the present application, the interface code, function description and function description label of the training service interface are used to fine-tune the currently open source code detection model to obtain a first function detection model, rather than completely building the first function detection model from start to finish. This saves the R&D costs of R&D personnel and improves the construction efficiency of the first function detection model.
[0130] In some embodiments of the present application, in addition to using the open source code detection model to construct the first function detection model as described above, the first function detection model can also be constructed using a user-trained code detection model. The following describes in detail how to construct the first function detection model using a user-trained code detection model:
[0131] Before step 130, the above method may further include:
[0132] Get the target programming language type of the system framework to be detected;
[0133] Obtain multiple training service interfaces whose programming language type is the same as the target programming language type;
[0134] taking the interface codes of the plurality of training service interfaces, the training function call chains of the calling functions of the plurality of training service interfaces, and the functional descriptions of the plurality of training service interfaces as a fourth data set;
[0135] The third function detection model is trained based on the fourth data set to obtain a first function detection model.
[0136] The target programming language type may be the programming language type of the system framework to be detected.
[0137] The fourth data set may be a data set for training the third function detection model. The third function detection model here may be a user-developed model that performs function detection only on the service interface of the system frame, and the programming language type of the third function detection model is consistent with the target programming language type of the system framework to be detected, and the third function detection model is only for the service interface of the system framework, not for the service interfaces of all types of frameworks.
[0138] It should be noted that the function detection accuracy of the third function detection model for the training service interface is lower than that of the first function detection model.
[0139] The above-mentioned fourth data set can be composed of interface codes of multiple training service interfaces whose programming language type is the same as the target programming language type, training function call chains of each calling function of the multiple training service interfaces, and functional descriptions of multiple training service interfaces. Specifically, the interface code of a training service interface whose programming language type is the same as the target programming language type, the training function call chain and functional description of each calling function constitute a training sample, multiple training service interfaces whose programming language type is the same as the target programming language type constitute multiple training samples, and multiple training samples constitute the fourth data set.
[0140] In some embodiments of the present application, a data set of the corresponding programming language, i.e., a fourth data set, can be searched according to the target programming language type of the system framework to be detected, and then the interface code of a training service interface, the training function call chain of each calling function, and the functional description are used as training data to train the third function detection model.
[0141] In an embodiment of the present application, a first function detection model is obtained by training a third function detection model developed by a user according to the target programming language type of the system framework to be detected using a fourth data set of the same programming language type. Since the third function detection model is a function detection model developed by the user and is completely targeted at the same type of system framework to be detected and the same programming language type, the first function detection model obtained in this way is more consistent with the detection of the service interface of the system frame to be detected, thereby improving the detection accuracy of the first function detection model.
[0142] It should be noted that both of the above-mentioned two methods can obtain the first function detection model. In practical applications, any one of the two methods can be used to obtain the first function detection model, or both methods can be used to obtain the first function detection model. After obtaining the first function detection model through the above-mentioned two methods, the first function detection models obtained through the two methods can be evaluated, and the first function detection model finally used can be determined by judging the accuracy of the first function detection models obtained through the two methods.
[0143] Step 140: Determine the permission vulnerability detection result of the service interface in the system framework to be detected based on the permission control detection result and the function detection result of the service interface.
[0144] In some embodiments of the present application, after obtaining the permission control detection results and function detection results of the service interface, the permission vulnerability detection results of the service interface in the service framework to be detected can be determined based on the permission control detection results and function detection results of the service interface.
[0145] In some embodiments of the present application, in order to accurately determine the permission vulnerability detection result of the service interface, step 140 may specifically include:
[0146] When it is determined that the permission control detection result of the service interface is that the service interface has permission control, and the function detection result of the service interface is that the service interface is a preset function interface, it is determined that the service interface has a permission loophole.
[0147] In some embodiments of the present application, when the permission control detection result of the service interface is determined to be that the service interface has permission control, that is, the output result of the first permission control detection model is true, and the function detection result of the service interface is that the service interface is a preset function interface, that is, the function description in the output result of the first function detection model is the preset function description, then it is determined that the service interface has a permission vulnerability.
[0148] In the embodiment of the present application, by comprehensively considering the permission control detection results and function detection results of the service interface, it is determined whether the service interface has a permission vulnerability, thereby improving the accuracy of the service interface permission vulnerability detection.
[0149] In order to more clearly understand the technical solution of the embodiment of the present application, the system framework interface permission vulnerability detection method provided by the embodiment of the present application is described below with a specific scenario.
[0150] Figure 2 : is a flow chart of a method for detecting system framework interface permission vulnerabilities provided by an embodiment of the present application, such as Figure 2 As shown, the system framework interface permission vulnerability detection method provided in the embodiment of the present application may include steps 21 to 29.
[0151] Step 21: Obtain the target framework file of the system framework to be detected.
[0152] Step 22: Decompile the target framework file to obtain a decompiled code file of the target framework file.
[0153] Step 23: extract the function call chain between each calling function of the service interface and the data flow transmitted between each calling function from the decompiled code file according to the interface path of the service interface.
[0154] Step 24: Obtain a first function detection model.
[0155] Step 25: Obtain a first permission control detection model.
[0156] In step 24 and step 25, the function detection model and the authority control detection model may be trained using the training data set, so as to obtain the first function detection model and the first authority control detection model, respectively. The training data set here may be the first data set, the second data set, the third data set and the fourth data set in the above embodiment.
[0157] The specific implementation method of using the training data set to train the permission control detection model to obtain the first permission control detection model can refer to the above embodiment of using the first data set to train the second permission control detection model to obtain the third permission control detection model, and then using the second data set to train the third permission control detection model to obtain the first permission control detection model, which will not be repeated here.
[0158] The specific implementation method of using the training data sets to train the function detection models respectively to obtain the first function detection model can refer to the scheme of using the third data set to train the second function detection model to obtain the first function detection model, and using the fourth data set to train the third function detection model to obtain the first function detection model in the above embodiment, which will not be repeated here.
[0159] Step 26: Get the function test result.
[0160] In step 26, the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function may be input into the first function detection model to obtain the function detection result. Specifically, the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function may be input into the first function detection model. The process of obtaining the function detection result may refer to the process of determining the function detection result in the above embodiment, which will not be repeated here.
[0161] Step 27: Get the permission control detection result.
[0162] In step 27, the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function may be input into the first permission control detection model to obtain the permission control detection result. Specifically, the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function may be input into the first permission control detection model. The process of obtaining the permission control detection result may refer to the process of determining the permission control detection result in the above embodiment, which will not be repeated here.
[0163] Step 28: Determine the permission vulnerability detection result of the service interface based on the permission control detection result and function detection result of the service interface.
[0164] In step 28, the permission vulnerability detection result of the service interface is determined according to the permission control detection result and the function detection result of the service interface. The implementation process of the above embodiment can be referred to, and will not be repeated here.
[0165] The system framework permission vulnerability detection method provided in the embodiment of the present application can be executed by a system framework permission vulnerability detection device. In the embodiment of the present application, the system framework permission vulnerability detection method is executed by a system framework permission vulnerability detection device as an example to illustrate the system framework permission vulnerability detection device provided in the embodiment of the present application.
[0166] Figure 3 FIG. 1 is a schematic diagram showing a system framework permission vulnerability detection device according to an exemplary embodiment. Figure 3 As shown, the system framework permission vulnerability detection device 700 may include:
[0167] A first acquisition module 310 is used to acquire an interface path of at least one service interface in the system framework to be detected;
[0168] A second acquisition module 320 is used to extract the calling function information of each service interface of the at least one service interface according to the interface path of the service interface;
[0169] A detection module 330, configured to detect the authority control and function of the service interface according to the interface code and the calling function information of the service interface, and obtain the authority control detection result and the function detection result of the service interface respectively;
[0170] The first determination module 340 is used to determine the permission vulnerability detection result of the service interface in the system framework to be detected according to the permission control detection result and the function detection result of the service interface.
[0171] In an embodiment of the present application, for each service interface in at least one service interface in the system framework to be detected, compared with the prior art of detecting the service interface using the verification rules in the regular verification rule library, the scheme of the embodiment of the present application extracts the calling function information of the service interface according to the interface path of the service interface obtained, and then detects the permission control and function of the service interface according to the interface code and the calling function information of the service interface, respectively, and obtains the permission control detection result and the function detection result of the service interface respectively, and then determines the permission vulnerability detection result of the service interface according to the permission control detection result and the function detection result of the service interface, so that there is no need to rely on the existing verification rules in the regular verification rule library, and avoids the problem of inaccurate detection results of the service interface caused by the lack of rules in the regular verification rule library for verifying a certain detection item of the service interface. Therefore, the scheme of the embodiment of the present application improves the detection accuracy of the system framework service interface. In addition, the detection scheme of the present application does not need to rely on the existing verification rules in the regular verification rule library, and improves the universality of service interface detection.
[0172] In some embodiments of the present application, the above-mentioned device may further include:
[0173] A third acquisition module is used to acquire a target framework file of the system framework to be detected before extracting the calling function information of the service interface according to the interface path of the service interface;
[0174] A decompilation module, used for decompiling the target framework file to obtain a decompiled code file of the target framework file;
[0175] The second acquisition module 320 is specifically configured to extract the calling function information of the service interface from the decompiled code file according to the interface path of the service interface.
[0176] In some embodiments of the present application, the third acquisition module may be specifically used for:
[0177] Obtain the target system framework type of the system framework to be detected;
[0178] Determine the target storage path of the target framework file corresponding to the system framework to be detected according to the target system framework type and the preset correspondence between the system framework type and the framework file storage path;
[0179] According to the target storage path, the target framework file is obtained.
[0180] In some embodiments of the present application, the calling function information includes: a function calling chain between each calling function of the service interface and a data flow transmitted between each calling function; the detection module 330 may specifically include:
[0181] A first input unit, used for inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into a first permission control detection model;
[0182] The first detection unit is used to detect the permission control of the service interface based on the first permission control detection model, and determine the permission control detection result of the service interface.
[0183] In some embodiments of the present application, the permission control detection result is used to indicate whether the service interface has permission control; the first detection unit is specifically used to:
[0184] Detecting whether there is a permission control code in the interface code of the service interface based on the first permission control detection model;
[0185] In the case where it is determined that the permission control code exists in the interface code of the service interface, determining that permission control exists on the service interface;
[0186] When it is determined that the permission control code does not exist in the interface code of the service interface, it is determined that the service interface does not have permission control.
[0187] In some embodiments of the present application, the calling function information includes: a function calling chain between each calling function of the service interface and a data flow transmitted between each calling function; the detection module 330 may further include:
[0188] A second input unit, used for inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into the first function detection model;
[0189] The second detection unit is used to detect the function of the service interface based on the first function detection model, and determine the function detection result of the service interface.
[0190] In some embodiments of the present application, the second detection unit is specifically used for:
[0191] Based on the first function detection model, obtain a function description of the service interface;
[0192] In the case where it is determined that the function description is a preset function description, it is determined that the function detection result of the service interface is that the service interface is a preset function interface, wherein the preset function description is a description for obtaining the user's privacy data.
[0193] In some embodiments of the present application, the first determining module 340 is specifically used to:
[0194] When it is determined that the permission control detection result of the service interface is that the service interface has permission control, and the function detection result of the service interface is that the service interface is the preset function interface, it is determined that there is a permission vulnerability in the service interface in the system framework to be detected.
[0195] In some embodiments of the present application, the above-mentioned device may further include:
[0196] A fourth acquisition module, configured to acquire a second permission control detection model before inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into the first permission control detection model;
[0197] A first training module is used to train the second permission control detection model based on a first data set to obtain a third permission control detection model, wherein the third permission control detection model has a higher recognition accuracy for permission control codes than the second permission control detection model, and the first data set includes multiple groups of first training samples, each group of first training samples includes an interface code of a training service interface and a permission control code corresponding to the training service interface;
[0198] A second training module is used to train the third permission control detection model based on a second data set to obtain the first permission control detection model, wherein the second data set includes multiple groups of second training samples, each group of second training samples includes a training function call chain between each calling function of the training service interface, each calling function of the training service interface, the function code of each calling function of the training service interface and the permission control code label of the training service interface, and the permission control code label is used to characterize whether the training service interface has a permission control code.
[0199] In some embodiments of the present application, the above-mentioned device may further include:
[0200] A fifth acquisition module, used for acquiring a second function detection model before inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into the first function detection model;
[0201] A third training module is used to train the second function detection model based on a third data set to obtain the first function detection model, wherein the function detection accuracy of the second function detection model for the training service interface is lower than that of the first function detection model, and the third data set includes multiple groups of third training samples, each group of third training samples includes the interface code, function description and label of the function description of the training service interface, and the label of the function description is used to characterize whether the function description is the function description of the training service interface.
[0202] In some embodiments of the present application, the above-mentioned device may further include:
[0203] A sixth acquisition module, used for acquiring the target programming language type of the system framework to be detected before inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into the first function detection model;
[0204] A seventh acquisition module, configured to acquire a plurality of training service interfaces whose programming language type is the same as the target programming language type;
[0205] A second determining module, configured to use the interface codes of the plurality of training service interfaces, the training function call chains of the calling functions of the plurality of training service interfaces, and the functional descriptions of the plurality of training service interfaces as a fourth data set;
[0206] The fourth training module is used to train the third function detection model based on the fourth data set to obtain the first function detection model, wherein the function detection accuracy of the third function detection model for the training service interface is lower than that of the first function detection model.
[0207] The system framework interface permission vulnerability detection device in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmentedreality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobilepersonal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.
[0208] The system framework interface permission vulnerability detection device in the embodiment of the present application can be a device with an operating system. The operating system can be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0209] The system framework interface permission vulnerability detection device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0210] Alternatively, if Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401 and a memory 402, wherein the memory 402 stores programs or instructions that can be executed on the processor 401, and when the program or instructions are executed by the processor 401, the various steps of the above-mentioned system framework interface permission vulnerability detection method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.
[0211] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0212] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0213] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510.
[0214] Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 510 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0215] Among them, the processor 510 is used to obtain the interface path of at least one service interface in the system framework to be detected; for each service interface of the at least one service interface, according to the interface path of the service interface, the calling function information of the service interface is extracted; according to the interface code of the service interface and the calling function information, the permission control and function of the service interface are detected respectively, and the permission control detection result and function detection result of the service interface are obtained respectively; according to the permission control detection result and the function detection result of the service interface, the permission vulnerability detection result of the service interface in the system framework to be detected is determined.
[0216] In this way, for each service interface in at least one service interface in the system framework to be detected, compared with the prior art of detecting the service interface using the verification rules in the regular verification rule library, the scheme of the embodiment of the present application extracts the calling function information of the service interface according to the interface path of the service interface obtained, and then detects the permission control and function of the service interface according to the interface code and the calling function information of the service interface, respectively, and obtains the permission control detection result and the function detection result of the service interface respectively, and then determines the permission vulnerability detection result of the service interface according to the permission control detection result and the function detection result of the service interface. In this way, there is no need to rely on the existing verification rules in the regular verification rule library, and the problem of inaccurate detection results of the service interface caused by the lack of rules in the regular verification rule library to verify a certain detection item of the service interface is avoided. Therefore, the scheme of the embodiment of the present application improves the detection accuracy of the system framework service interface. In addition, the detection scheme of the present application does not need to rely on the existing verification rules in the regular verification rule library, and improves the universality of service interface detection.
[0217] Optionally, the processor 510 is also used to obtain a target framework file of the system framework to be detected before extracting the calling function information of the service interface according to the interface path of the service interface; decompile the target framework file to obtain a decompiled code file of the target framework file; and extract the calling function information of the service interface from the decompiled code file according to the interface path of the service interface.
[0218] In this way, by decompiling the target framework file of the system framework to be detected, the decompiled code file of the target framework file can be obtained, and then according to the interface path of the service interface, the calling function information of the service interface can be extracted from the decompiled code file, so that the calling function information of the service interface can be accurately obtained.
[0219] Optionally, the processor 510 is also used to obtain the target system framework type of the system framework to be detected; determine the target storage path of the target framework file corresponding to the system framework to be detected based on the target system framework type and the correspondence between the pre-set system framework type and the framework file storage path; and obtain the target framework file based on the target storage path.
[0220] In this way, by determining the target system framework type of the system framework to be detected and the correspondence between the pre-set system framework type and the framework file storage path, the target storage path of the target framework file corresponding to the system framework to be detected can be quickly determined, and then the target framework file can be obtained based on the target storage path, thereby improving the efficiency of obtaining the target framework file.
[0221] Optionally, the calling function information includes: a function call chain between each calling function of the service interface and a data flow transmitted between each calling function; the processor 510 is also used to input the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function into a first permission control detection model; based on the first permission control detection model, the permission control of the service interface is detected to determine the permission control detection result of the service interface.
[0222] In this way, the permission control of the service interface is detected through the first permission control detection model to determine the permission control detection result of the service interface. In this way, the permission control is detected through the pre-trained first permission control detection model, which improves the efficiency of permission control detection.
[0223] Optionally, the permission control detection result is used to indicate whether there is permission control on the service interface; the processor 510 is further used to detect whether there is permission control code in the interface code of the service interface based on the first permission control detection model; when it is determined that the permission control code exists in the interface code of the service interface, it is determined that there is permission control on the service interface; when it is determined that the permission control code does not exist in the interface code of the service interface, it is determined that there is no permission control on the service interface.
[0224] In this way, the first permission control detection model is used to detect whether there is permission control code in the interface code of the service interface to determine whether there is permission control in the service interface. In this way, it is only necessary to detect whether there is permission control code in the interface code of the service interface to determine whether there is permission control in the service interface, thereby improving the efficiency of permission control detection.
[0225] Optionally, the processor 510 is also used to input the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function into a first function detection model; based on the first function detection model, the function of the service interface is detected to determine the function detection result of the service interface.
[0226] In this way, the function of the service interface is detected by the first function detection model to determine the function detection result of the service interface. In this way, the function of the service interface is detected by the pre-trained first function detection model, which improves the efficiency of the function detection of the service interface.
[0227] Optionally, the processor 510 is also used to obtain a functional description of the service interface based on the first functional detection model; when it is determined that the functional description is a preset functional description, the functional detection result of the service interface is determined to be that the service interface is a preset functional interface, wherein the preset functional description is a description for obtaining the user's privacy data.
[0228] In this way, through the first function detection model, the functional description of the service interface can be obtained, and based on the functional description of the service interface, it can be determined whether the service interface is an interface with sensitive functions. In this way, it can be quickly and accurately determined whether the service interface is a sensitive interface.
[0229] Optionally, the processor 510 is also used to determine that there is a permission vulnerability in the service interface in the service framework to be detected when it is determined that the permission control test result of the service interface is that the service interface has permission control, and the function test result of the service interface is that the service interface is the preset function interface.
[0230] In this way, by comprehensively considering the permission control detection results and function detection results of the service interface, it is determined whether the service interface has a permission vulnerability, thereby improving the accuracy of the service interface permission vulnerability detection in the service framework to be detected.
[0231] Optionally, the processor 510 is further configured to obtain a second permission control detection model before inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into the first permission control detection model; train the second permission control detection model based on the first data set to obtain a third permission control detection model, wherein the third permission control detection model has a higher recognition accuracy for permission control codes than the second permission control detection model, and the first data set includes multiple groups of first training samples, each group of first training samples includes the interface code of the training service interface and the permission control code corresponding to the training service interface; train the third permission control detection model based on the second data set to obtain the first permission control detection model, wherein the second data set includes multiple groups of second training samples, each group of second training samples includes a training function call chain between each calling function of the training service interface, each calling function of the training service interface, the function code of each calling function of the training service interface and a permission control code label of the training service interface, and the permission control code label is used to characterize whether the training service interface has a permission control code.
[0232] In this way, the first step of fine-tuning the model parameters of the second permission control detection model is performed by training the interface code of the service interface and the permission control code corresponding to the service interface to obtain the third permission control detection model, and then the call chain and code recognition ability of the third permission control detection model are further trained by using the training function call chain between the calling functions of the training service interface, the calling functions of the training service interface, the function codes of the calling functions of the training service interface and the permission control code labels of the training service interface to obtain the first permission control detection model. In this way, the first permission control detection model that can accurately detect the permission control of the service interface can be obtained.
[0233] Optionally, the processor 510 is further used to obtain a second function detection model before inputting the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function into the first function detection model; train the second function detection model based on a third data set to obtain the first function detection model, wherein the function detection accuracy of the second function detection model for the training service interface is lower than that of the first function detection model, and the third data set includes multiple groups of third training samples, each group of third training samples includes the interface code, function description and label of the function description of the training service interface, and the label of the function description is used to characterize whether the function description is a function description of the training service interface.
[0234] In this way, the interface code, function description and function description label of the training service interface are used to fine-tune the current open source code detection model to obtain the first function detection model, rather than completely building the first function detection model from scratch. This saves the R&D costs of R&D personnel and improves the construction efficiency of the first function detection model.
[0235] Optionally, the processor 510 is further used to obtain the target programming language type of the system framework to be detected before inputting the interface code of the service interface, the function call chain, the data flow, each calling function and the function code of each calling function into the first function detection model; obtain multiple training service interfaces with the same programming language type as the target programming language type; use the interface codes of the multiple training service interfaces, the training function call chains of each calling function of the multiple training service interfaces and the functional descriptions of the multiple training service interfaces as a fourth data set; and train a third function detection model based on the fourth data set to obtain the first function detection model, wherein the function detection accuracy of the third function detection model for the training service interface is lower than that of the first function detection model.
[0236] In this way, by training the third function detection model developed by the user according to the target programming language type of the system framework to be detected and using the fourth data set of the same programming language type, the first function detection model is obtained. Since the third function detection model is a function detection model developed by the user and is completely targeted at the same type of system framework to be detected and the same programming language type, the first function detection model obtained in this way is more in line with the detection of the service interface of the system frame to be detected, thereby improving the detection accuracy of the first function detection model.
[0237] It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (Graphics Processing Unit, GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of the static picture or video obtained by the image capture device (such as a color camera) in the video capture mode or the image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes a touch panel 5071 and at least one of other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0238] The memory 509 can be used to store software programs and various data. The memory 509 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 509 may include a volatile memory or a non-volatile memory, or the memory 509 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 509 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0239] The processor 510 may include one or more processing units; optionally, the processor 510 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 510.
[0240] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned system framework permission vulnerability detection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0241] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0242] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned system framework permission vulnerability detection method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0243] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0244] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned system framework permission vulnerability detection method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0245] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0246] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0247] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A system framework permission vulnerability detection method, characterized in that: The method comprises: Obtaining an interface path of at least one service interface in the system framework to be detected; For each service interface of the at least one service interface, extracting the calling function information of the service interface according to the interface path of the service interface; According to the interface code of the service interface and the calling function information, the authority control and function of the service interface are detected respectively, and the authority control detection result and function detection result of the service interface are obtained respectively; According to the permission control detection result and the function detection result of the service interface, the permission vulnerability detection result of the service interface in the system framework to be detected is determined.
2. The method according to claim 1, characterized in that: Before extracting the calling function information of the service interface according to the interface path of the service interface, the method further includes: Obtain the target framework file of the system framework to be detected; Decompiling the target framework file to obtain a decompiled code file of the target framework file; The extracting the calling function information of the service interface according to the interface path of the service interface includes: According to the interface path of the service interface, the calling function information of the service interface is extracted from the decompiled code file.
3. The method according to claim 2, characterized in that The step of obtaining the target framework file of the system framework to be detected includes: Obtain the target system framework type of the system framework to be detected; Determine the target storage path of the target framework file corresponding to the system framework to be detected according to the target system framework type and the preset correspondence between the system framework type and the framework file storage path; According to the target storage path, the target framework file is obtained.
4. The method according to claim 1, characterized in that: The calling function information includes: a function calling chain between the calling functions of the service interface and a data stream transmitted between the calling functions; According to the interface code of the service interface and the calling function information, the permission control of the service interface is detected to obtain the permission control detection result of the service interface, including: Inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into a first permission control detection model; The permission control of the service interface is detected based on the first permission control detection model to determine the permission control detection result of the service interface.
5. The method according to claim 4, characterized in that The permission control detection result is used to indicate whether the service interface has permission control; The detecting the permission control of the service interface based on the first permission control detection model to determine the permission control detection result of the service interface includes: Detecting whether there is a permission control code in the interface code of the service interface based on the first permission control detection model; In the case where it is determined that the permission control code exists in the interface code of the service interface, determining that permission control exists on the service interface; When it is determined that the permission control code does not exist in the interface code of the service interface, it is determined that the service interface does not have permission control.
6. The method according to claim 1, characterized in that The calling function information includes: a function calling chain between the calling functions of the service interface and a data stream transmitted between the calling functions; According to the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions, the permission control of the service interface is detected to obtain the permission control detection result of the service interface, including: Inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into a first function detection model; The function of the service interface is detected based on the first function detection model to determine the function detection result of the service interface.
7. The method according to claim 6, characterized in that The detecting the function of the service interface based on the first function detection model to determine the function detection result of the service interface includes: Based on the first function detection model, obtain a function description of the service interface; In the case where it is determined that the function description is a preset function description, it is determined that the function detection result of the service interface is that the service interface is a preset function interface, wherein the preset function description is a description for obtaining the user's privacy data.
8. The method according to claim 7, characterized in that The step of determining the permission vulnerability detection result of the service interface in the system framework to be detected according to the permission control detection result and the function detection result of the service interface includes: When it is determined that the permission control detection result of the service interface is that the service interface has permission control, and the function detection result of the service interface is that the service interface is the preset function interface, it is determined that there is a permission vulnerability in the service interface in the system framework to be detected.
9. The method according to claim 4 or 5, characterized in that: Before inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into the first permission control detection model, the method further includes: Obtaining a second permission control detection model; The second permission control detection model is trained based on the first data set to obtain a third permission control detection model, wherein the third permission control detection model has a higher recognition accuracy for permission control codes than the second permission control detection model, and the first data set includes multiple groups of first training samples, each group of first training samples includes an interface code of a training service interface and a permission control code corresponding to the training service interface; The third permission control detection model is trained based on the second data set to obtain the first permission control detection model, wherein the second data set includes multiple groups of second training samples, each group of second training samples includes a training function call chain between each calling function of the training service interface, each calling function of the training service interface, the function code of each calling function of the training service interface and the permission control code label of the training service interface, and the permission control code label is used to characterize whether the training service interface has a permission control code.
10. The method according to claim 6 or 7, characterized in that: Before inputting the interface code of the service interface, the function call chain, the data flow, each of the calling functions and the function code of each of the calling functions into the first function detection model, the method further includes: Obtaining the target programming language type of the system framework to be detected; Acquire multiple training service interfaces whose programming language type is the same as the target programming language type; taking the interface codes of the plurality of training service interfaces, the training function call chains of the calling functions of the plurality of training service interfaces, and the functional descriptions of the plurality of training service interfaces as a fourth data set; The third function detection model is trained based on the fourth data set to obtain the first function detection model, wherein the function detection accuracy of the third function detection model for the training service interface is lower than that of the first function detection model.
11. A system framework interface permission vulnerability detection device, characterized in that: The device comprises: A first acquisition module is used to acquire an interface path of at least one service interface in the system framework to be detected; A second acquisition module is used to extract the calling function information of each service interface of the at least one service interface according to the interface path of the service interface; A detection module, used to detect the authority control and function of the service interface according to the interface code of the service interface and the calling function information, and obtain the authority control detection result and function detection result of the service interface respectively; The first determination module is used to determine the permission vulnerability detection result of the service interface in the system framework to be detected according to the permission control detection result and the function detection result of the service interface.
12. An electronic device, characterized in that: It includes a processor and a memory, the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the system framework interface permission vulnerability detection method as described in any one of claims 1-10 are implemented.
13. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the system framework interface permission vulnerability detection method as described in any one of claims 1-10 are implemented.
