Software development kit behavior control method and device
By establishing the corresponding relationship between the virtual interface and the hook function and detecting the calling behavior, the security issues caused by integrating third-party SDKs are solved, ensuring the safe access of the software development tool kit to the system server interface, and reducing information security risks.
Patent Information
- Application Number
- CN202011461451.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-12-08
AI Technical Summary
Application products that integrate third-party SDKs have uncontrollable security issues, such as accessing illegal network addresses and user privacy data, resulting in information security risks and affecting product sales and promotion.
By establishing the corresponding relationship between the virtual interface and the hook function, it detects whether the target software development tool kit calls these interfaces, determines the interface security through the target hook function, and controls its call to the system server interface to ensure security.
The monitoring and management of the virtual interface calling process of the software development tool kit is realized to ensure its safe access to the system server interface and reduce information security risks.
Smart Images

Figure CN112463128B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software toolkit behavior control, and in particular to a method and device for software development toolkit behavior control. Background Art
[0002] With the rapid development of mobile Internet technology, more and more enterprises and mobile developers will integrate third-party SDKs (Software Development Kits) when developing application products to facilitate their development or improve the functional experience of application products.
[0003] However, the problem that follows is that third-party SDKs will bring uncontrollable security issues, such as whether the SDK will access illegal network addresses, whether the SDK will access user privacy data such as address books and media libraries, thereby causing user privacy data to be stolen. Therefore, application products that integrate SDKs have information security risks, which is not conducive to the sales and promotion of application products. Summary of the invention
[0004] In view of this, an object of the present invention is to provide a software development toolkit behavior control method and device to improve the above technical problems.
[0005] In a first aspect, an embodiment of the present invention provides a method for controlling behavior of a software development toolkit, the method comprising the following steps:
[0006] Establishing a correspondence between a virtual interface and a hook function, wherein the virtual interface is a secure virtual interface or an unsecure virtual interface;
[0007] Detecting whether there is a target virtual interface in the virtual interface called by a target software development kit;
[0008] If yes, determining whether the target virtual interface is safe through the corresponding target hook function;
[0009] If yes, then the target software development kit continues to call the system server interface.
[0010] In combination with the first aspect, an embodiment of the present invention provides a first possible implementation manner of the first aspect, wherein the application includes an original application thread and the target software development kit thread, wherein the target software development kit thread is marked with a thread ID;
[0011] Before the step of detecting whether there is a target software development kit calling a target virtual interface in the virtual interface, the method includes:
[0012] Check whether the thread is marked with a thread ID;
[0013] If yes, the thread is a target software development kit thread corresponding to the target software development kit, wherein each target software development kit thread includes a target software development kit.
[0014] In combination with the first aspect, an embodiment of the present invention provides a second possible implementation of the first aspect, wherein, before the step of determining whether the target virtual interface is safe by using the corresponding target hook function if yes, the method further includes:
[0015] The target software development kit is controlled to send an interface call request to the target virtual interface.
[0016] In combination with the first aspect, the embodiment of the present invention provides a third possible implementation manner of the first aspect, wherein the step of establishing a correspondence between the virtual interface and the hook function includes:
[0017] The correspondence between the virtual interface and the hook function is established through dynamic proxy.
[0018] In combination with the first aspect, an embodiment of the present invention provides a fourth possible implementation of the first aspect, wherein the virtual interface is an application programming interface.
[0019] In a second aspect, an embodiment of the present invention further provides a software development kit behavior control device, the device comprising:
[0020] A relationship establishing module, used to establish a corresponding relationship between a virtual interface and a hook function, wherein the virtual interface is a secure virtual interface or an unsecure virtual interface;
[0021] An interface calling module, used for detecting whether there is a target virtual interface called by a target software development kit in the virtual interface;
[0022] A first determination module, configured to determine whether the target virtual interface is safe through a corresponding target hook function if yes;
[0023] The continuing calling module is used for continuing to call the system server interface through the target software development kit if yes.
[0024] In combination with the second aspect, an embodiment of the present invention provides a first possible implementation of the second aspect, wherein the application includes an original application thread and the target software development kit thread, wherein the target software development kit thread is marked with a thread ID;
[0025] Before the interface calling module, the device further includes:
[0026] A detection module, used to detect whether a thread is marked with a thread ID;
[0027] The second determining module is configured to determine that if yes, the thread is a target software development kit thread corresponding to the target software development kit, wherein each target software development kit thread includes a target software development kit.
[0028] In combination with the second aspect, an embodiment of the present invention provides a second possible implementation of the second aspect, wherein, before the first determining module, the device further includes:
[0029] The control module is used to control the target software development kit to send an interface call request to the target virtual interface.
[0030] In combination with the second aspect, the embodiment of the present invention provides a third possible implementation of the second aspect, wherein the relationship establishment module is used to:
[0031] The correspondence between the virtual interface and the hook function is established through dynamic proxy.
[0032] In combination with the second aspect, an embodiment of the present invention provides a fourth possible implementation of the second aspect, wherein the virtual interface is an application programming interface.
[0033] The embodiment of the present invention brings the following beneficial effects: the embodiment of the present invention provides a method and device for controlling the behavior of a software development kit, firstly establishes a corresponding relationship between a virtual interface and a hook function; then detects whether there is a target virtual interface in the virtual interface called by a target software development kit; and then if so, determines whether the target virtual interface is safe through the corresponding target hook function; finally, if so, continues to call the system server interface through the target software development kit. The method and device for controlling the behavior of a software development kit in the embodiment of the present invention achieves the technical effect of enabling the software development kit to securely access the system server interface by monitoring and managing the virtual interface calling process of the software development kit.
[0034] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained in the structures particularly pointed out in the description, claims and drawings.
[0035] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0037] Figure 1 A flowchart of a software development toolkit behavior control method provided by an embodiment of the present invention;
[0038] Figure 2 A flowchart of another software development kit behavior control method provided by an embodiment of the present invention;
[0039] Figure 3 A structural block diagram of a software development toolkit behavior control device provided by an embodiment of the present invention;
[0040] Figure 4 A schematic diagram of the structure of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0042] With the rapid development of mobile Internet technology, more and more enterprises and mobile developers will integrate third-party SDKs when developing application products to facilitate their development or improve the functional experience of application products. However, the problem that follows is that third-party SDKs will bring uncontrollable security issues, such as whether the SDK will access illegal network addresses, whether the SDK will access user privacy data such as address books and media libraries, thereby causing user privacy data to be stolen. Therefore, application products that integrate SDKs have information security risks, which is not conducive to the sales and promotion of application products. Based on this, an embodiment of the present invention provides a software development kit behavior control method and device to alleviate the above problems.
[0043] In order to facilitate understanding of this embodiment, a software development toolkit behavior control method disclosed in an embodiment of the present invention is first introduced in detail.
[0044] In a possible implementation, the present invention provides a method for controlling the behavior of a software development toolkit. Figure 1FIG. 1 is a flow chart of a method for controlling a behavior of a software development toolkit provided by an embodiment of the present invention, the method comprising the following steps:
[0045] Step S102: Establishing a correspondence between the virtual interface and the hook function.
[0046] The virtual interface is a secure virtual interface or an unsecure virtual interface.
[0047] Step S104: Detect whether there is a target virtual interface in the virtual interface called by the target software development kit.
[0048] Step S106: If yes, determine whether the target virtual interface is safe through the corresponding target hook function.
[0049] Furthermore, if not, there is no need to monitor and manage the process of calling the target virtual interface.
[0050] Step S108: If yes, continue to call the system server interface through the target software development kit.
[0051] Further, if not, further calling to the system server interface through the target software development kit is not allowed.
[0052] It should be further explained that the system server interface is replaced with a virtual interface at the beginning of the function operation. Therefore, when the target software development kit calls the virtual interface, the corresponding target hook function is used to determine whether the target virtual interface is safe, and when it is determined that the target virtual interface is safe, the target software development kit continues to call the system server interface. In other words, the virtual interface is the intermediate interface used before the final system server interface.
[0053] The embodiment of the present invention brings the following beneficial effects: the embodiment of the present invention first establishes a correspondence between a virtual interface and a hook function through a software development kit behavior control method; then detects whether there is a target virtual interface in the virtual interface called by a target software development kit; and then if so, determines whether the target virtual interface is safe through the corresponding target hook function; and finally, if so, continues to call the system server interface through the target software development kit. The software development kit behavior control method and device of the embodiment of the present invention achieves the technical effect of enabling the software development kit to safely access the system server interface by monitoring and managing the virtual interface calling process of the software development kit.
[0054] In actual use, in order to describe the process of the present invention in more detail, the embodiment of the present invention is Figure 2FIG. 4 is a flowchart of another software development kit behavior control method provided by an embodiment of the present invention, the method comprising the following steps:
[0055] Step S202: establishing a correspondence between a virtual interface and a hook function through a dynamic proxy method.
[0056] The virtual interface is a secure virtual interface or an unsecure virtual interface. Meanwhile, the virtual interface is an application programming interface.
[0057] It should be further explained that the dynamic proxy method is a common method for establishing corresponding relationships in Java programming.
[0058] In addition, since each application contains one or more original application threads and one or more target software development kit threads, only the process of the target software development kit thread calling the virtual interface needs to be monitored, while the process of the original application thread calling the virtual interface does not need to be monitored. Therefore, by marking the thread ID of the target software development kit thread contained in the application to distinguish it from the original application thread, the monitoring efficiency of the process of the target software development kit thread calling the virtual interface is greatly improved.
[0059] Therefore, specifically, the application comprises an original application thread and said target software development kit thread, wherein said target software development kit thread is marked with a thread ID;
[0060] Before the step of detecting whether there is a target software development kit calling a target virtual interface in the virtual interface, the method further includes:
[0061] Check whether the thread is marked with a thread ID;
[0062] If yes, the thread is a target software development kit thread corresponding to the target software development kit, wherein each target software development kit thread includes a target software development kit.
[0063] Step S204: Detect whether there is a target virtual interface in the virtual interface called by the target software development kit.
[0064] Step S206: Control the target software development kit to send an interface call request to the target virtual interface.
[0065] Step S208: If yes, determine whether the target virtual interface is safe through the corresponding target hook function.
[0066] Furthermore, if not, there is no need to monitor and manage the process of calling the target virtual interface.
[0067] Step S210: If yes, continue to call the system server interface through the target software development kit.
[0068] Further, if not, further calling to the system server interface through the target software development kit is not allowed.
[0069] In addition, the software development kit behavior control method of the present invention can also be applied to control and manage the calling process of the software development kit in a multi-threaded form. In the multi-threaded form, each process includes the original application thread and the software development kit thread, and can select whether to enable the access control function through the sequence switch to allow it to perform system interface calling operations in sequence.
[0070] In summary, the software development kit behavior control method and device of the present invention first establishes a corresponding relationship between a virtual interface and a hook function; then detects whether there is a target virtual interface in the virtual interface called by the target software development kit; and then if so, determines whether the target virtual interface is safe through the corresponding target hook function; and finally, if so, continues to call the system server interface through the target software development kit. The software development kit behavior control method and device of the embodiment of the present invention achieves the technical effect of enabling the software development kit to securely access the system server interface by monitoring and managing the virtual interface calling process of the software development kit.
[0071] In another possible implementation, corresponding to the software development kit behavior control method provided in the above implementation, an embodiment of the present invention further provides a software development kit behavior control device, Figure 3 A structural block diagram of a software development toolkit behavior control device provided by an embodiment of the present invention. Figure 3 As shown, the device comprises:
[0072] A relationship establishing module 301, used to establish a corresponding relationship between a virtual interface and a hook function, wherein the virtual interface is a secure virtual interface or an unsecure virtual interface;
[0073] An interface calling module 302 is used to detect whether there is a target virtual interface called by a target software development kit in the virtual interface;
[0074] A first determination module 303, for determining whether the target virtual interface is safe through a corresponding target hook function if yes;
[0075] The continuing calling module 304 is used to continue calling the system server interface through the target software development kit if yes.
[0076] In actual use, in order to describe the device of the present invention in more detail, the embodiments of the present invention are described in Figure 4 4 shows a structural block diagram of another software development kit behavior control device provided by an embodiment of the present invention, wherein the software development kit behavior control device further includes a detection module 401 and a control module 402.
[0077] Specifically, in actual use, the application includes an original application thread and the target software development kit thread, wherein the target software development kit thread is marked with a thread ID;
[0078] Before the interface calling module 302, the device further includes:
[0079] A detection module 401 is used to detect whether a thread is marked with a thread ID;
[0080] The second determining module is configured to determine that if yes, the thread is a target software development kit thread corresponding to the target software development kit, wherein each target software development kit thread includes a target software development kit.
[0081] In actual use, before the first determining module 303, the device further includes:
[0082] The control module 402 is used to control the target software development kit to send an interface call request to the target virtual interface.
[0083] In actual use, the relationship establishment module 301 is used to:
[0084] The correspondence between the virtual interface and the hook function is established through dynamic proxy.
[0085] In actual use, the virtual interface is an application programming interface.
[0086] The software development kit behavior control device provided in the embodiment of the present invention has the same technical features as the software development kit behavior control method provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.
[0087] The computer program product of the software development toolkit behavior control method and device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0088] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0089] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0090] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RanDom Access Memory), disk or optical disk, and other media that can store program codes.
[0091] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0092] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A software development toolkit behavior control method, characterized in that: The method comprises the following steps: Establishing a correspondence between a virtual interface and a hook function, wherein the virtual interface is a secure virtual interface or an unsecure virtual interface; Detecting whether there is a target virtual interface in the virtual interface called by a target software development kit; If yes, determining whether the target virtual interface is safe through the corresponding target hook function; If yes, the target software development kit continues to call the system server interface, and the system server interface is replaced by the virtual interface at the beginning of the function operation.
2. The method according to claim 1, characterized in that The application includes an original application thread and the target software development kit thread, wherein the target software development kit thread is marked with a thread ID; Before the step of detecting whether there is a target software development kit calling a target virtual interface in the virtual interface, the method includes: Check whether the thread is marked with a thread ID; If yes, the thread is a target software development kit thread corresponding to the target software development kit, wherein each target software development kit thread includes a target software development kit.
3. The method according to claim 1, characterized in that Before the step of determining whether the target virtual interface is safe by using the corresponding target hook function, the method further includes: The target software development kit is controlled to send an interface call request to the target virtual interface.
4. The method according to claim 1, characterized in that: The step of establishing a correspondence between the virtual interface and the hook function includes: The correspondence between the virtual interface and the hook function is established through dynamic proxy.
5. The method according to claim 1, characterized in that The virtual interface is an application programming interface.
6. A software development kit behavior control device, characterized in that: The device comprises: A relationship establishing module, used to establish a corresponding relationship between a virtual interface and a hook function, wherein the virtual interface is a secure virtual interface or an unsecure virtual interface; An interface calling module, used for detecting whether there is a target virtual interface called by a target software development kit in the virtual interface; A first determination module, configured to determine whether the target virtual interface is safe through a corresponding target hook function if yes; The continuing calling module is used for, if yes, continuing to call the system server interface through the target software development kit, and the system server interface is replaced by the virtual interface at the beginning of the function operation.
7. The device according to claim 6, characterized in that The application includes an original application thread and the target software development kit thread, wherein the target software development kit thread is marked with a thread ID; Before the interface calling module, the device further includes: A detection module, used to detect whether a thread is marked with a thread ID; The second determining module is configured to determine that if yes, the thread is a target software development kit thread corresponding to the target software development kit, wherein each target software development kit thread includes a target software development kit.
8. The device according to claim 6, characterized in that Before the first determining module, the device further includes: The control module is used to control the target software development kit to send an interface call request to the target virtual interface.
9. The device according to claim 6, characterized in that The relationship building module is used for: The correspondence between the virtual interface and the hook function is established through dynamic proxy.
10. The device according to claim 6, characterized in that The virtual interface is an application programming interface.
Citation Information
Patent Citations
Interface control method and device, readable medium and electronic equipment
CN111400068A
