Program vulnerability repair method, device and computer readable storage medium
By obtaining and replacing function identification information and patch list information in the application, dynamically loading and repairing application vulnerabilities solves the resource occupation and restart problems caused by overall replacement in the existing technology, and achieves efficient vulnerability repair.
Patent Information
- Application Number
- CN202010195033.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-18
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-03-18
AI Technical Summary
Existing application vulnerability repair methods require the entire application to be replaced, causing the upgrade package to occupy a large amount of memory and network resources, and the system needs to be restarted after the repair is completed, affecting normal operation.
By obtaining the function identification information and patch list information in the application, it detects and replaces the corresponding repair function, realizes dynamic loading and repair of application vulnerabilities, avoids overall replacement, and reduces the size of the patch repair file.
It realizes the repair of application vulnerabilities without restarting the system, reduces the memory size of patch repair files, improves repair efficiency, and reduces network resource usage.
Smart Images

Figure CN111324491B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a program vulnerability repair method, device and computer-readable storage medium. Background Art
[0002] Currently, the method to fix application vulnerabilities is to directly replace the application, which requires modifying the entire application and upgrading it completely; this repair method requires restarting the application after the repair is completed to take effect. When it is necessary to repair application defects or add functions to the application, the operation of the application and the operating system must be interrupted, affecting the normal operation of the application. The upgrade package occupies a large amount of memory and network resources. Summary of the invention
[0003] The main purpose of the present invention is to provide a program vulnerability repair method, device and computer-readable storage medium, aiming to repair application program vulnerabilities without overall replacement.
[0004] To achieve the above object, the present invention provides a method for repairing a program vulnerability, which comprises the following steps:
[0005] Obtain function identification information and patch list information of application functions in the application;
[0006] Detecting whether the function identification information is stored in the patch list information;
[0007] If the function identification information is stored in the patch list information, a corresponding repair operation is performed on the application function according to the function identification information and the patch list information.
[0008] Optionally, when the function type of the application function is a Java function type, the step of performing a corresponding repair operation on the application function according to the function identification information and the patch list information includes:
[0009] Determine the function identification information in the patch list information as repair identification information;
[0010] Determine the application function corresponding to the repair identification information as a repair function;
[0011] Acquire a patch function corresponding to the repair identification information according to the patch list information;
[0012] The repair function in the application program is replaced by the patch function.
[0013] Optionally, when the function type of the application function is a native function type, the step of performing a corresponding repair operation on the application function according to the function identification information and the patch list information further includes:
[0014] Determine the function identification information in the patch list information as repair identification information;
[0015] Determine the application function corresponding to the repair identification information as a repair function;
[0016] Acquire patch address information corresponding to the repair identification information according to the patch list information;
[0017] When the repair function is executed, the repair function is executed based on the patch address information.
[0018] Optionally, after the step of determining the application function corresponding to the repair identification information as the repair function, the method further comprises:
[0019] Acquire a patch offset address corresponding to the repair identification information according to the patch list information;
[0020] Obtaining a function memory address according to the repair identification information and the patch offset address;
[0021] The function memory address is replaced with the patch address information.
[0022] Optionally, the step of obtaining the function memory address according to the repair identification information and the patch offset address includes:
[0023] Acquire a function process number corresponding to the repair identification information according to the repair identification information;
[0024] Obtain the corresponding memory running address according to the function process number;
[0025] A calculation is performed based on the memory running address and the patch offset address to obtain a function memory address.
[0026] Optionally, when the repair function is executed, before the step of executing the repair function based on the patch address information, the step includes:
[0027] Preloading the repair function through the patch address information to obtain a preloading result;
[0028] Detecting whether the preloaded result is a normal execution result;
[0029] If the preloading result is a normal execution result, the process proceeds to the step of running the repair function based on the patch address information when the repair function is run.
[0030] Optionally, after the step of detecting whether the preloading result is a normal execution result, the following steps are included:
[0031] If the preloading result is an abnormal execution result, detecting whether the patch address information is normal address information;
[0032] If the patch address information is normal address information, a program repair failure instruction is generated and sent to the server.
[0033] Optionally, before the step of obtaining function identification information and patch list information of the application function in the application, the following steps are included:
[0034] Send patch file acquisition instructions to the server;
[0035] Receiving the patch repair file returned by the server according to the patch file acquisition instruction;
[0036] The patch list information is generated according to the patch repair file.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also provides a program vulnerability repair device, which includes: a memory, a processor, and a program vulnerability repair program stored in the memory and executable on the processor, and when the program vulnerability repair program is executed by the processor, the steps of the program vulnerability repair method described above are implemented.
[0038] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a program vulnerability repair program is stored, and when the program vulnerability repair program is executed by a processor, the steps of the program vulnerability repair method described above are implemented.
[0039] The present invention provides a method, device and computer-readable storage medium for repairing program vulnerabilities, which obtain function identification information and patch list information of an application function in an application; detect whether the function identification information is stored in the patch list information; if the function identification information is stored in the patch list information, perform corresponding repair operations on the application function according to the function identification information and the patch list information. Through the above-mentioned manner, the present invention can realize the function of reducing the memory size of the patch repair file, realize the function of repairing application vulnerabilities without overall replacement, realize the function of repairing application vulnerabilities through dynamic loading, and realize the function of repairing middleware programs without restarting. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a flow chart of a first embodiment of a method for repairing a program vulnerability of the present invention;
[0042] Figure 3 A schematic diagram of a flow chart of a second embodiment of a method for repairing a program vulnerability of the present invention;
[0043] Figure 4 A schematic diagram of a flow chart of a third embodiment of a method for repairing a program vulnerability of the present invention;
[0044] Figure 5 A flowchart of a fourth embodiment of a method for repairing a program vulnerability of the present invention;
[0045] Figure 6 A flowchart of a fifth embodiment of a method for repairing a program vulnerability of the present invention;
[0046] Figure 7 Schematic diagram of the sixth embodiment of the program vulnerability repairing method of the present invention.
[0047] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0049] The main solution of an embodiment of the present invention is: obtaining function identification information and patch list information of an application function in an application; detecting whether the function identification information is stored in the patch list information; if the function identification information is stored in the patch list information, performing corresponding repair operations on the application function according to the function identification information and the patch list information.
[0050] The existing method of repairing application vulnerabilities is to directly replace the application, which requires modifying the entire application and upgrading it completely; this repair method requires restarting the application after the repair is completed to take effect. When it is necessary to repair application defects or add functions to the application, the operation of the application and the operating system must be interrupted, affecting the normal operation of the application. The upgrade package occupies a large amount of memory and network resources.
[0051] The present invention aims to repair application program vulnerabilities without using a method of overall replacement.
[0052] like Figure 1 As shown, Figure 1It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention.
[0053] The terminal in the embodiment of the present invention may be a PC, or may be a mobile terminal device with a display function, such as a smart phone or a tablet computer.
[0054] like Figure 1 As shown, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0055] Preferably, the terminal may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the mobile terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal may also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.
[0056] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0057] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a program vulnerability repair program.
[0058] exist Figure 1 In the terminal shown, the network interface 1004 is mainly used to connect to the backend server and perform data communication with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and perform data communication with the client; and the processor 1001 can be used to call the program vulnerability repair program stored in the memory 1005 and perform the following operations:
[0059] Obtain function identification information and patch list information of application functions in the application;
[0060] Detecting whether the function identification information is stored in the patch list information;
[0061] If the function identification information is stored in the patch list information, a corresponding repair operation is performed on the application function according to the function identification information and the patch list information.
[0062] Further, the processor 1001 may call the program vulnerability repair program stored in the memory 1005, and further perform the following operations:
[0063] Determine the function identification information in the patch list information as repair identification information;
[0064] Determine the application function corresponding to the repair identification information as a repair function;
[0065] Acquire a patch function corresponding to the repair identification information according to the patch list information;
[0066] The repair function in the application program is replaced by the patch function.
[0067] Further, the processor 1001 may call the program vulnerability repair program stored in the memory 1005, and further perform the following operations:
[0068] Determine the function identification information in the patch list information as repair identification information;
[0069] Determine the application function corresponding to the repair identification information as a repair function;
[0070] Acquire patch address information corresponding to the repair identification information according to the patch list information;
[0071] When the repair function is executed, the repair function is executed based on the patch address information.
[0072] Further, the processor 1001 may call the program vulnerability repair program stored in the memory 1005, and further perform the following operations:
[0073] Acquire a patch offset address corresponding to the repair identification information according to the patch list information;
[0074] Obtaining a function memory address according to the repair identification information and the patch offset address;
[0075] The function memory address is replaced with the patch address information.
[0076] Further, the processor 1001 may call the program vulnerability repair program stored in the memory 1005, and further perform the following operations:
[0077] Acquire a function process number corresponding to the repair identification information according to the repair identification information;
[0078] Obtain the corresponding memory running address according to the function process number;
[0079] A calculation is performed based on the memory running address and the patch offset address to obtain a function memory address.
[0080] Further, the processor 1001 may call the program vulnerability repair program stored in the memory 1005, and further perform the following operations:
[0081] Preloading the repair function through the patch address information to obtain a preloading result;
[0082] Detecting whether the preloaded result is a normal execution result;
[0083] If the preloading result is a normal execution result, the process proceeds to the step of running the repair function based on the patch address information when the repair function is run.
[0084] Further, the processor 1001 may call the program vulnerability repair program stored in the memory 1005, and further perform the following operations:
[0085] If the preloading result is an abnormal execution result, detecting whether the patch address information is normal address information;
[0086] If the patch address information is normal address information, a program repair failure instruction is generated and sent to the server.
[0087] Further, the processor 1001 may call the program vulnerability repair program stored in the memory 1005, and further perform the following operations:
[0088] Send patch file acquisition instructions to the server;
[0089] Receiving the patch repair file returned by the server according to the patch file acquisition instruction;
[0090] The patch list information is generated according to the patch repair file.
[0091] Based on the above hardware structure, an embodiment of the program vulnerability repairing method of the present invention is proposed.
[0092] The present invention provides a method for repairing program vulnerabilities.
[0093] Reference Figure 2 , Figure 2 Schematic diagram of the process of the first embodiment of the program vulnerability repairing method of the present invention.
[0094] In an embodiment of the present invention, the program vulnerability repair method is applied to a program vulnerability repair device, and the program vulnerability repair method includes:
[0095] Step S10, obtaining function identification information and patch list information of the application function in the application program;
[0096] In this embodiment, before repairing the application, when the application is running, the program vulnerability repair device obtains function identification information and function address information of all application functions in the application, and the program vulnerability repair device obtains patch list information on the storage module of the program vulnerability repair device; wherein, the application can be an application running on a mobile terminal, a fixed terminal, or a tablet computer; the application can also be an application running on the framework layer of a television terminal; the application can be composed of several application categories, and the application category is composed of several application functions; the patch list information is stored on the storage module of the program vulnerability repair device; wherein, the function identification information is the identification name of the application function, which is used to distinguish the application function; wherein, the function address information is information about the address from which the function data is called when the application function is executed. The patch list information is that when the program vulnerability repair device detects that the patch file in the program vulnerability repair device needs to be updated, the program vulnerability repair device sends a patch file acquisition instruction to the cloud server, and the cloud server searches for the patch repair file corresponding to the patch file acquisition instruction according to the patch file acquisition instruction; the cloud server sends the found patch repair file to the program vulnerability repair device patch device, and the program vulnerability repair device receives the patch repair file returned by the cloud server according to the patch file acquisition instruction. After receiving the patch repair file, the program vulnerability repair device generates a patch repair file according to the patch repair file.
[0097] Step S20, detecting whether the function identification information is stored in the patch list information;
[0098] In this embodiment, after the program vulnerability repair device obtains the function identification information and the patch list information, the program vulnerability repair device reads the patch list information, and the program vulnerability repair device detects whether the function identification information is stored in the patch list information, that is, the program vulnerability repair device detects whether there is patch name information identical to the function identification information in the patch list information; wherein the patch list information is composed of a plurality of patch name information, a plurality of patch process information, a plurality of patch offset addresses, and a plurality of patch address information, and each patch name information, patch process information, patch offset address, and patch address information are stored in the form of a table on the storage module of the program vulnerability repair device, and the patch name information, patch process information, patch offset address, and patch address information have a corresponding relationship. wherein the patch name information is information about the name of the patch function, the patch process information is information about which running process the patch function is from, the patch offset address is the offset of the address of the execution patch function, and the patch address information is information about the address of the program that needs to be called when the patch function is executed. wherein the patch process information corresponds to a plurality of patch process information, the patch module information corresponds to a plurality of patch name information, and one patch name information corresponds to one patch address information.
[0099] Step S30: If the function identification information is stored in the patch list information, a corresponding repair operation is performed on the application function according to the function identification information and the patch list information.
[0100] In this embodiment, when the program vulnerability repairing device detects that function identification information is stored in the patch list information, that is, when the program vulnerability repairing device detects that the patch list information contains patch name information that is the same as the function identification information; the program vulnerability repairing device performs corresponding repair operations on the application function according to the function identification information and the patch list information.
[0101] This embodiment uses the above scheme to obtain the function identification information and patch list information of the application function in the application; detect whether the function identification information is stored in the patch list information; if the function identification information is stored in the patch list information, perform the corresponding repair operation on the application function according to the function identification information and the patch list information. Thus, the function of reducing the memory size of the patch repair file is realized, the function of repairing the application vulnerability without the method of overall replacement is realized, the function of repairing the application vulnerability by dynamic loading is realized, and the function of repairing the middleware program without restarting is realized.
[0102] Further, refer to Figure 3 , Figure 3 This is a flow chart of the second embodiment of the program vulnerability repair method of the present invention. Figure 2In the illustrated embodiment, when the function type of the application function is a Java function type, step S30 performs a corresponding repair operation on the application function according to the function identification information and the patch list information, which may include:
[0103] Step S31, determining the function identification information in the patch list information as repair identification information;
[0104] In this embodiment, when the function type of the application function is a Java function type and the program vulnerability repairing device detects that function identification information is stored in the patch list information, the program vulnerability repairing device determines the function identification information stored in the patch list information as the repair identification information.
[0105] As an implementation mode, in this embodiment, when the program vulnerability repair device detects that there is patch name information identical to the function identification information in the patch list information, the program vulnerability repair device finds out the patch identification information stored in the patch list information, and the program vulnerability repair device finds out the function identification information identical to the patch name information, and the function identification information found out by the program vulnerability repair device is determined as the repair identification information. Among them, the repair name information is the function identification information corresponding to the function that needs to be repaired in the application function. Among them, the patch list information is composed of a plurality of patch name information and a plurality of patch function data, and each patch name information and patch function data are stored in the form of a table on the storage module of the program vulnerability repair device, and the patch name information and the patch function data have a corresponding relationship. Among them, the patch name information is the information of the name of the patch function, and the patch function data is the code data that the patch function runs when it is executed or run. Among them, the patch name information and the patch function data have a one-to-one correspondence.
[0106] Step S32, determining the application function corresponding to the repair identification information as the repair function;
[0107] In this embodiment, after determining the repair identification information, the program vulnerability repairing apparatus determines the application function corresponding to the repair identification information as the repair function; wherein the repair function is a function in the application function that needs to be repaired.
[0108] Step S33, acquiring a patch function corresponding to the repair identification information according to the patch list information;
[0109] In this embodiment, after determining the repair function, the program vulnerability repair device searches the patch list information for a patch function corresponding to the repair identification information.
[0110] As an implementation mode, in this embodiment, after determining the repair function, the program vulnerability repair device searches for patch name information identical to the repair identification information in the patch list information, and then searches for the patch function corresponding to the patch name information according to the patch name information.
[0111] Step S34: replacing the repair function in the application with the patch function.
[0112] In this embodiment, after the program vulnerability repairing device obtains the patch function, the program vulnerability repairing device replaces the repair function in the application program with the patch function; when the program vulnerability repairing device detects that the repair function is running, the program vulnerability repairing device executes the patch function.
[0113] In this embodiment, after the program vulnerability repair device obtains the patch function corresponding to the repair identification information, the program vulnerability repair device replaces the repair function with the patch function and preloads it, and the program vulnerability repair device obtains the preload result. After the program vulnerability repair device obtains the preload result, the program vulnerability repair device detects whether the preload result is a normal execution result; when the middleware program repair device detects that the preload result is a normal execution result, step S34 is executed. Among them, preloading is to test run the repair function in the program vulnerability repair device. Among them, the normal execution result is that the program vulnerability repair device can run normally through the patch function without any error results.
[0114] This embodiment uses the above scheme to obtain the function identification information and patch list information of the application function in the application; detect whether the function identification information is stored in the patch list information; if the function identification information is stored in the patch list information, determine the function identification information in the patch list information as the repair identification information; determine the application function corresponding to the repair identification information as the repair function; obtain the patch function corresponding to the repair identification information according to the patch list information; replace the repair function in the application with the patch function. In this way, the function of reducing the memory size of the patch repair file is realized, the function of repairing the application vulnerability without the method of overall replacement is realized, the function of repairing the application vulnerability by dynamic loading is realized, and the function of repairing the middleware program without restarting is realized.
[0115] Further, refer to Figure 4 , Figure 4 This is a flow chart of the third embodiment of the program vulnerability repair method of the present invention. Figure 2In the illustrated embodiment, when the function type of the application function is a native function type, step S30 performs a corresponding repair operation on the application function according to the function identification information and the patch list information, and may further include:
[0116] Step S35, determining the function identification information in the patch list information as repair identification information;
[0117] In this embodiment, when the program vulnerability repairing device detects that function identification information is stored in the patch list information, the program vulnerability repairing device determines the function identification information stored in the patch list information as the repair identification information.
[0118] As an implementation mode, in this embodiment, when the program vulnerability repair device detects that there is patch name information identical to the function identification information in the patch list information, the program vulnerability repair device finds out the patch name information stored in the patch list information, and the program vulnerability repair device finds out the function identification information identical to the patch name information, and the function identification information found out by the program vulnerability repair device is determined as the repair identification information (which may be the repair process information). Among them, the repair identification information is the function identification information (which may be the function process information) corresponding to the function that needs to be repaired in the application function; wherein the function identification information may be the function process information (i.e., the native service name) of the application function, and the function process information is the information of which running process the application function is in. Among them, the patch list information is composed of a number of patch process information, a number of patch offset addresses, and a number of patch address information, and each patch process information, patch offset address, and patch address information are stored in the form of a table on the storage module of the program vulnerability repair device, and the patch process information, patch offset address, and patch address information have a corresponding relationship. The patch process information is information about which running process the patch function is in, the patch offset address (i.e., native service URL) is the offset of the patch function relative to the patch address information, and the patch address information is information about the address that needs to be called when executing the patch function. The patch process information, the patch offset address, and the patch address information have a one-to-one correspondence.
[0119] Step S36, determining the application function corresponding to the repair identification information as the repair function;
[0120] In this embodiment, after determining the repair identification information, the program vulnerability repairing apparatus determines the application function corresponding to the repair identification information as the repair function; wherein the repair function is a function in the application function that needs to be repaired.
[0121] Step S37, acquiring patch address information corresponding to the repair identification information according to the patch list information;
[0122] In this embodiment, after determining the repair function, the program vulnerability repair device searches the patch list information for patch address information corresponding to the repair identification information.
[0123] As an implementation method, in this embodiment, after the program vulnerability repairing device determines the repair function, the program vulnerability repairing device searches for patch process information that is the same as the repair identification information (which can be function process information) in the patch list information, and then searches for patch address information corresponding to the patch process information based on the patch process information.
[0124] Step S38: When the repair function is executed, the repair function is executed based on the patch address information.
[0125] In this embodiment, after the program vulnerability repairing device obtains the patch address information, the program vulnerability repairing device replaces the function address information that the repair function needs to call with the calling patch address information; when the program vulnerability repairing device detects that the repair function is running, the program vulnerability repairing device runs the repair function by calling the patch address information.
[0126] This embodiment uses the above scheme to obtain the function identification information and patch list information of the application function in the application; detect whether the function identification information is stored in the patch list information; if the function identification information is stored in the patch list information, determine the function identification information in the patch list information as the repair identification information; determine the application function corresponding to the repair identification information as the repair function; obtain the patch address information corresponding to the repair identification information according to the patch list information; when the repair function is running, run the repair function based on the patch address information. In this way, the function of reducing the memory size of the patch repair file is realized, the function of repairing the application vulnerability without overall replacement is realized, the function of repairing the application vulnerability through dynamic loading is realized, and the function of repairing the middleware program without restarting is realized.
[0127] Further, refer to Figure 5 , Figure 5 This is a flow chart of the fourth embodiment of the program vulnerability repair method of the present invention. Figure 4 In the illustrated embodiment, step S37 determines the application function corresponding to the repair identification information as the repair function, which may include:
[0128] Step S371, acquiring a patch offset address corresponding to the repair identification information according to the patch list information;
[0129] In this embodiment, after determining the repair function, the program vulnerability repair device searches the patch list information for a patch offset address corresponding to the repair identification information.
[0130] As an implementation method, in this embodiment, after the program vulnerability repairing device determines the repair function, the program vulnerability repairing device searches for patch process information that is the same as the repair identification information (which may be repair process information) in the patch list information, and then searches for the patch offset address corresponding to the patch process information based on the patch process information.
[0131] Step S372, obtaining a function memory address according to the repair identification information and the patch offset address;
[0132] In this embodiment, after obtaining the patch offset address, the program vulnerability repairing device obtains the function memory address through query and calculation in the system according to the repair identification information and the patch offset address.
[0133] Step S372 obtains the function memory address according to the repair identification information and the patch offset address, which may include:
[0134] Step a1, obtaining a function process number corresponding to the repair identification information according to the repair identification information;
[0135] Step a2, obtaining the corresponding memory running address according to the function process number;
[0136] Step a3, performing calculation based on the memory running address and the patch offset address to obtain the function memory address.
[0137] In this embodiment, the program vulnerability repairing device obtains the function process number corresponding to the repair identification information in the system of the program vulnerability repairing device according to the repair identification information; the program vulnerability repairing device obtains the memory running address corresponding to the repair identification information in the process subsystem of the program vulnerability repairing device according to the function process number, and the program vulnerability repairing device superimposes the memory running address corresponding to the repair identification information and the patch offset address to obtain the function memory address.
[0138] Step S373, replacing the function memory address with the patch address information.
[0139] In this embodiment, after obtaining the function memory address, the program vulnerability repairing device replaces the function memory address with the patch address information.
[0140] This embodiment uses the above scheme to obtain the function identification information and patch list information of the application function in the application; detect whether the function identification information is stored in the patch list information; if the function identification information is stored in the patch list information, determine the function identification information in the patch list information as the repair identification information; determine the application function corresponding to the repair identification information as the repair function; obtain the patch offset address corresponding to the repair identification information according to the patch list information; obtain the function memory address according to the repair identification information and the patch offset address; replace the function memory address with the patch address information; when the repair function is running, run the repair function based on the patch address information. In this way, the function of reducing the memory size of the patch repair file is realized, the function of repairing application vulnerabilities without overall replacement is realized, the function of repairing application vulnerabilities through dynamic loading is realized, and the function of repairing middleware programs without restarting is realized.
[0141] Further, refer to Figure 6 , Figure 6 This is a flow chart of the second embodiment of the program vulnerability repair method of the present invention. Figure 4 In the illustrated embodiment, step S38, when the repair function is executed, before the repair function is executed based on the patch address information, may include:
[0142] Step S41, preloading the repair function through the patch address information to obtain a preloading result;
[0143] In this embodiment, after the program vulnerability repair device obtains the patch address information corresponding to the repair identification information (which may be the repair process information), the program vulnerability repair device preloads the repair function through the patch address information, and the program vulnerability repair device obtains the preloading result of the repair function. Preloading is to test run the repair function in the program vulnerability repair device.
[0144] Step S42, detecting whether the preload result is a normal execution result;
[0145] In this embodiment, after the program vulnerability repairing device obtains the preloading result of preloading the repair function, the program vulnerability repairing device detects whether the preloading result is a normal execution result; wherein, the normal execution result is that the program vulnerability repairing device can preload the repair function normally through the patch address information without any erroneous result.
[0146] After step S42 detects whether the preload result is a normal execution result, it may include:
[0147] Step b1, if the preloading result is an abnormal execution result, detecting whether the patch address information is normal address information;
[0148] Step b2: If the patch address information is normal address information, a program repair failure instruction is generated and sent to the server.
[0149] In this embodiment, when the program vulnerability repair device detects that the preloading result is not a normal execution result, the program vulnerability repair device detects whether the patch address information is normal address information; when the program vulnerability repair device detects that the patch address information is normal address information, the reason for the failure of the application repair is that the patch address information is incorrect, the program vulnerability repair device generates a program repair failure instruction, the program vulnerability repair device sends the program repair failure instruction to the server, the server receives the program repair failure instruction, the administrator receives the message of the application repair failure through the server, and the administrator finds the reason for the failure of the application repair; wherein, the normal address information is the address information contained in the patch address information that the program vulnerability repair device can find, which is a real address, not an empty address information.
[0150] Step b2: if the preloading result is an abnormal execution result, after detecting whether the patch address information is normal address information, the following may be included:
[0151] Step c: if the patch address information is not normal address information, when the repair function is executed, the repair function is executed through the function address information corresponding to the function name information.
[0152] In this embodiment, when the program vulnerability repairing device detects that the patch address information is not normal address information, the program vulnerability repairing device determines that the reason for the failure of program preloading is that the patch function is abnormal. At this time, in order to avoid abnormal operation of the application, when the repair function is running, the program vulnerability repairing device runs the repair function through the function address information corresponding to the function identification information (which can be function process information); the program vulnerability repairing device generates a patch download exception instruction and sends the patch download exception instruction to the server.
[0153] Step S43: If the preloading result is a normal execution result, then go to the step of running the repair function based on the patch address information when the repair function is running.
[0154] In this embodiment, when the program vulnerability repairing device detects that the preloading result is a normal execution result, step S38 is executed.
[0155] This embodiment uses the above scheme to obtain the function identification information and patch list information of the application function in the application; detect whether the function identification information is stored in the patch list information; if the function identification information is stored in the patch list information, determine the function identification information in the patch list information as the repair identification information; determine the application function corresponding to the repair identification information as the repair function; obtain the patch address information corresponding to the repair identification information according to the patch list information; preload the repair function through the patch address information to obtain the preloading result; detect whether the preloading result is a normal execution result; if the preloading result is a normal execution result, execute: when the repair function runs, run the repair function based on the patch address information; when the repair function runs, run the repair function based on the patch address information. In this way, the function of reducing the memory size of the patch repair file is realized, the function of repairing application vulnerabilities without overall replacement is realized, the function of repairing application vulnerabilities through dynamic loading is realized, and the function of repairing middleware programs without restarting is realized.
[0156] Further, refer to Figure 7 , Figure 7 This is a flow chart of the second embodiment of the program vulnerability repair method of the present invention. Figure 2 , Figure 3 , Figure 4 , Figure 5 or Figure 6 In the illustrated embodiment, before step S10 obtains the function identification information and patch list information of the application function in the application program, the following may be included:
[0157] Step S50, sending a patch file acquisition instruction to the server;
[0158] In this embodiment, when the program vulnerability repairing device detects that the patch file in the application program repairing device needs to be updated, the program vulnerability repairing device sends a patch file acquisition instruction to the cloud server.
[0159] Step S60, receiving the patch repair file returned by the server according to the patch file acquisition instruction;
[0160] In this embodiment, the program vulnerability repairing device sends a patch file acquisition instruction to the cloud server, and the cloud server searches for the patch repair file corresponding to the patch file acquisition instruction according to the patch file acquisition instruction; the cloud server sends the found patch repair file to the program vulnerability repairing device, and the program vulnerability repairing device receives the patch repair file returned by the cloud server according to the patch file acquisition instruction.
[0161] Step S70: Generate the patch list information according to the patch repair file.
[0162] In this embodiment, after receiving the patch repair file, the program vulnerability repair device generates patch list information according to the patch repair file.
[0163] This embodiment uses the above scheme to send a patch file acquisition instruction to the server; receive the patch repair file returned by the server according to the patch file acquisition instruction; generate the patch list information according to the patch repair file; obtain the function identification information and patch list information of the application function in the application; detect whether the function identification information is stored in the patch list information; if the function identification information is stored in the patch list information, perform a corresponding repair operation on the application function according to the function identification information and the patch list information. In this way, the function of reducing the memory size of the patch repair file is realized, the function of repairing the application vulnerability without overall replacement is realized, the function of repairing the application vulnerability through dynamic loading is realized, and the function of repairing the middleware program without restarting is realized.
[0164] The invention also provides a program vulnerability repairing device.
[0165] The program vulnerability repairing device of the present invention comprises: a memory, a processor and a program vulnerability repairing program stored in the memory and executable on the processor. When the program vulnerability repairing program is executed by the processor, the steps of the program vulnerability repairing method described above are implemented.
[0166] Among them, the method implemented when the program vulnerability repair program running on the processor is executed can refer to the various embodiments of the program vulnerability repair method of the present invention, and will not be repeated here.
[0167] The present invention also provides a computer-readable storage medium.
[0168] The computer-readable storage medium of the present invention stores a program vulnerability repair program, and when the program vulnerability repair program is executed by a processor, the steps of the program vulnerability repair method described above are implemented.
[0169] Among them, the method implemented when the program vulnerability repair program running on the processor is executed can refer to the various embodiments of the program vulnerability repair method of the present invention, and will not be repeated here.
[0170] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0171] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0172] 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 invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0173] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for repairing a program vulnerability, characterized in that: The program vulnerability repair method comprises the following steps: Obtain function identification information and patch list information of application functions in the application; Detecting whether the function identification information is stored in the patch list information; If the function identification information is stored in the patch list information, performing a corresponding repair operation on the application function according to the function identification information and the patch list information; When the function type of the application function is a native function type, the step of performing a corresponding repair operation on the application function according to the function identification information and the patch list information further includes: Determine the function identification information in the patch list information as repair identification information; Determine the application function corresponding to the repair identification information as a repair function; After the step of determining the application function corresponding to the repair identification information as the repair function, the method further comprises: Acquire a patch offset address corresponding to the repair identification information according to the patch list information, wherein the patch list information is composed of a plurality of patch name information, a plurality of patch process information, a plurality of patch offset addresses and a plurality of patch address information, each patch name information, patch process information, patch offset address and patch address information is stored in a storage module of the program vulnerability repair device in the form of a table, and the patch name information, the patch process information, the patch offset address and the patch address information have a corresponding relationship; Obtaining a function memory address according to the repair identification information and the patch offset address; Replacing the function memory address with the patch address information; Acquire patch address information corresponding to the repair identification information according to the patch list information; When the repair function is executed, the repair function is executed based on the patch address information.
2. The program vulnerability repair method according to claim 1, characterized in that: When the function type of the application function is a Java function type, the step of performing a corresponding repair operation on the application function according to the function identification information and the patch list information includes: Determine the function identification information in the patch list information as repair identification information; Determine the application function corresponding to the repair identification information as a repair function; Acquire a patch function corresponding to the repair identification information according to the patch list information; The repair function in the application program is replaced by the patch function.
3. The program vulnerability repairing method according to claim 1, characterized in that: The step of obtaining the function memory address according to the repair identification information and the patch offset address includes: Acquire a function process number corresponding to the repair identification information according to the repair identification information; Obtain the corresponding memory running address according to the function process number; A calculation is performed based on the memory running address and the patch offset address to obtain a function memory address.
4. The program vulnerability repairing method according to any one of claims 1 or 3, characterized in that: When the repair function is executed, before the step of executing the repair function based on the patch address information, the method includes: Preloading the repair function through the patch address information to obtain a preloading result; Detecting whether the preloaded result is a normal execution result; If the preloading result is a normal execution result, the process proceeds to the step of running the repair function based on the patch address information when the repair function is run.
5. The program vulnerability repairing method according to claim 4, characterized in that: After the step of detecting whether the preloading result is a normal execution result, the method further comprises: If the preloading result is an abnormal execution result, detecting whether the patch address information is normal address information; If the patch address information is normal address information, a program repair failure instruction is generated and sent to the server.
6. The program vulnerability repairing method according to any one of claims 1 to 3, characterized in that: Before the step of obtaining the function identification information and patch list information of the application function in the application program, the method includes: Send patch file acquisition instructions to the server; Receiving the patch repair file returned by the server according to the patch file acquisition instruction; The patch list information is generated according to the patch repair file.
7. A program vulnerability repair device, characterized in that: The program vulnerability repairing device comprises: a memory, a processor, and a program vulnerability repairing program stored in the memory and running on the processor. When the program vulnerability repairing program is executed by the processor, the steps of the program vulnerability repairing method according to any one of claims 1 to 6 are implemented.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program vulnerability repair program, and when the program vulnerability repair program is executed by a processor, the steps of the program vulnerability repair method according to any one of claims 1 to 6 are implemented.
