Vulnerability repair method and device
By obtaining vulnerability information from the control server in Java Web technology and applying patch updates to repair it, the problem of cumbersome server-side vulnerability repair process is solved, fast and effective vulnerability repair is achieved, and the risk of vulnerability exposure is reduced.
Patent Information
- Application Number
- CN202010618924.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-01
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-07-01
AI Technical Summary
There is a lack of effective server-side vulnerability repair methods in existing Java Web technology, which makes the vulnerability repair process cumbersome and time-consuming, and makes the vulnerability vulnerable to hacker attacks during the intermediate exposure time.
Provide a vulnerability repair method and device, by obtaining vulnerability information from the control server, scanning protected applications according to vulnerability fingerprints, obtaining and applying patch updates and repairs, including parsing patch bytecode files, loading InstrumentAgent, redefining classes and replacing vulnerabilities method to complete the patch update.
It achieves fast and effective vulnerability repair, avoids the steps of code modification, compilation and restart in traditional methods, shortens the repair time and reduces the risk of vulnerability exposure.
Smart Images

Figure CN113760339B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a vulnerability repair method and device. Background Art
[0002] As Java Web enterprise development technology is increasingly used in enterprises, relevant security research on Java Web technology is becoming more and more in-depth, and vulnerabilities in Java Web technology are emerging one after another. In order to fix these vulnerabilities, enterprises need a lot of time for a series of repair processes such as vulnerability location, code modification, compilation, and testing and online release. At the same time, the above process takes too long, and the gap in the middle becomes a great time for hackers to exploit vulnerabilities to attack. As the offensive and defensive confrontation becomes more and more intense, how to conveniently, accurately, and quickly fix vulnerabilities in enterprises has become a difficult problem that is expected to be solved.
[0003] Existing Java security vulnerability hot fix technologies are mainly concentrated in client scenarios and system security scenarios, and are rarely used on the server side. Even if there are similar technologies, they mainly solve how to fix bugs and update resources. There is no mature and complete technical solution for back-end security scenarios. Summary of the invention
[0004] The embodiments of the present disclosure provide a vulnerability repair method and device.
[0005] In a first aspect, an embodiment of the present disclosure provides a vulnerability repair method, comprising: obtaining vulnerability information from a control server, wherein the vulnerability information includes a vulnerability fingerprint and a patch configuration file; scanning the executable file of a protected application according to the vulnerability fingerprint to determine whether there is a vulnerability; if a vulnerability exists, obtaining a vulnerability patch according to a patch path in the patch configuration file; performing a patch update and repair on the protected application according to the vulnerability patch; and reporting the repair result to the control server after the repair is completed.
[0006] In some embodiments, patching and repairing the protected application according to the vulnerability patch includes: parsing the vulnerability patch to obtain repair points and repair methods; compiling the source code in the vulnerability patch to obtain a patch bytecode file; and patching and repairing the protected application according to the repair points and repair methods.
[0007] In some embodiments, the patch update repair of the protected application is performed according to the repair point and the repair method, including: obtaining the identifier of the unique process of the currently running JVM instance of the protected application, loading the InstrumentAgent dynamic link library into the unique process; creating a socket connection and sending the patch bytecode file to the server socket; encapsulating the redefinition class request as a virtual machine level operation according to the repair point and the repair method and adding it to the virtual machine thread running queue, when the thread pulls the redefinition class request from the queue, loading the patch bytecode file, completing the merging of the constant pool of the class to be modified, clearing the original method breakpoints, and performing the update class operation. Replace the bytecode of the method with a vulnerability with the patch bytecode fragment, complete the class redefinition notification after the security repair, and load the class file after the vulnerability is repaired.
[0008] In some embodiments, before creating a socket connection and sending the patch bytecode file to the server socket, the method further includes: if the Attach listener is not started in the currently running JVM instance, opening the server socket listening port to receive connection requests.
[0009] In some embodiments, after loading the patch bytecode file, the method further includes: verifying the content of the patch bytecode file.
[0010] In some embodiments, the vulnerability information further includes an MD5 digest of the patch configuration file; and the method further includes: verifying the patch configuration file according to the MD5 digest of the patch configuration file.
[0011] In some embodiments, the method further includes: obtaining the vulnerability patch MD5 digest; and verifying the vulnerability patch according to the vulnerability patch MD5 digest.
[0012] In some embodiments, before obtaining vulnerability information from the control server, the method further includes: obtaining version information of the protected application; and sending the version information to the control server so that the control server searches for corresponding vulnerability information according to the version information.
[0013] In a second aspect, an embodiment of the present disclosure provides a vulnerability repair device, comprising: an acquisition unit, configured to acquire vulnerability information from a control server, wherein the vulnerability information includes a vulnerability fingerprint and a patch configuration file; a scanning unit, configured to scan the executable file of a protected application according to the vulnerability fingerprint to determine whether a vulnerability exists; a downloading unit, configured to obtain a vulnerability patch according to a patch path in a patch configuration file if a vulnerability exists; and an updating unit, configured to perform a patch update and repair on the protected application according to the vulnerability patch.
[0014] In some embodiments, the device further includes a reporting unit configured to report the repair result to the control server after the repair is completed.
[0015] In some embodiments, the update unit is further configured to: parse the vulnerability patch to obtain repair points and repair methods; compile the source code in the vulnerability patch to obtain a patch bytecode file; and perform patch update and repair on the protected application according to the repair points and repair methods.
[0016] In some embodiments, the update unit is further configured to: obtain the identifier of the unique process of the currently running JVM instance of the protected application, load the Instrument Agent dynamic link library into the unique process; create a socket connection and send the patch bytecode file to the server socket; encapsulate the redefine class request as a virtual machine-level operation according to the repair point and repair method and add it to the virtual machine thread running queue, and when the thread pulls the redefine class request from the queue, load the patch bytecode file. Complete the merging of the constant pool of the class to be modified, clear the original method breakpoints, and perform the update class operation. Replace the bytecode of the vulnerable method with the patch bytecode fragment, complete the class redefinition notification after the security repair, and load the class file after the vulnerability is repaired.
[0017] In some embodiments, the update unit is further configured to: before creating a socket connection and sending the patch bytecode file to the server socket, if the Attach listener is not started in the currently running JVM instance, start the server socket listening port to receive the connection request.
[0018] In some embodiments, the update unit is further configured to: verify the content of the patch bytecode file after loading the patch bytecode file.
[0019] In some embodiments, the vulnerability information further includes an MD5 digest of the patch configuration file; and the updating unit is further configured to: verify the patch configuration file according to the MD5 digest of the patch configuration file.
[0020] In some embodiments, the updating unit is further configured to: obtain the vulnerability patch MD5 digest; and verify the vulnerability patch according to the vulnerability patch MD5 digest.
[0021] In some embodiments, the reporting unit is further configured to: obtain version information of the protected application before obtaining vulnerability information from the control server; and send the version information to the control server so that the control server searches for corresponding vulnerability information according to the version information.
[0022] In a third aspect, an embodiment of the present disclosure provides a vulnerability repair electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement any method described in the first aspect.
[0023] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any one of the first aspects is implemented.
[0024] The vulnerability repair method and device provided in the embodiments of the present application solve the problem that in traditional scenarios, vulnerability repair requires modification of the original code, recompilation, and restart of the online release. This solution can directly skip the above steps and directly update the online application through a patch, quickly and effectively solving the problem of difficult vulnerability repair and long exposure time. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0026] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;
[0027] Figure 2 is a flow chart of an embodiment of a vulnerability repair method according to the present disclosure;
[0028] Figure 3a-3c is a schematic diagram of an application scenario of the vulnerability repair method disclosed herein;
[0029] Figure 4 is a flow chart of another embodiment of the vulnerability repair method according to the present disclosure;
[0030] Figure 5 is a structural schematic diagram of an embodiment of a vulnerability repair device according to the present disclosure;
[0031] Figure 6 It is a structural diagram of a computer system of an electronic device suitable for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0033] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0034] Figure 1 An exemplary system architecture to which an embodiment of the vulnerability repair method or vulnerability repair device of the present application can be applied is shown.
[0035] like Figure 1 As shown in the figure, this system is mainly divided into three main modules, among which the "Vulnerability Patch Warehouse" module and the "Control Service Unit" module are installed on the "Control Server". The "Control Service" module provides a remote API to the outside world, and the "Vulnerability Patch Warehouse" module, as a persistent database, provides data persistence services for the "Control Service". The "Vulnerability Fixing Device" (hereinafter referred to as Fix-Unit) and the "Protected Application" (hereinafter referred to as Main-Process) are installed on the same server. Fix-Unit is a security daemon process used to protect the security of Main-Process, which is generally a business service process.
[0036] Fix-Unit periodically requests the remote API of the control server through heartbeat to obtain the latest vulnerability information (step 201). When a new security update is found, the executable file of the protected application is scanned through the file fingerprint obtained from the control server (step 202). If the scan result is "there is a vulnerability", then Fix-Unit will obtain the vulnerability patch (step 203) and initiate the patch repair process, and update the patch and repair the Main-Process through the Java instrument interface (step 204). After the repair is completed, Fix-Units can also report the repair results through the remote API.
[0037] Continue to refer Figure 2 , shows a process 200 of an embodiment of a vulnerability repair method according to the present application. The vulnerability repair method comprises the following steps:
[0038] Step 201, obtaining vulnerability information from a control server.
[0039] In this embodiment, the execution subject of the vulnerability repair method (for example Figure 1The application server shown in the figure) can obtain vulnerability information from the control server. The control server can regularly push vulnerability information related to the protected application in the application server, and can also find the corresponding vulnerability information after reporting the version information of the protected application on the application server and send it to the application server. Among them, the vulnerability information includes vulnerability fingerprints and patch configuration files. The vulnerability fingerprint is used to describe the characteristics of the vulnerability file. Optionally, the vulnerability information may also include the MD5 summary of the patch configuration file and the MD5 summary of the vulnerability patch. The patch configuration file may include information such as the patch path and file directory. The method also includes: verifying the patch configuration file according to the MD5 summary of the patch configuration file. To prevent the patch configuration file from being tampered with.
[0040] Step 202: Scan the executable file of the protected application according to the vulnerability fingerprint to determine whether there is a vulnerability.
[0041] In this embodiment, the executable files of the protected application are scanned and matched with the vulnerability fingerprints one by one. If there is a matching file, it means that the file has a vulnerability and needs to be repaired. If no matching file is found, it means that there is no vulnerability and no need to repair.
[0042] Step 203: If a vulnerability exists, a vulnerability patch is obtained according to the patch path in the patch configuration file.
[0043] In this embodiment, if there is a vulnerability, a vulnerability patch is downloaded from a vulnerability patch repository according to the patch path in the patch configuration file.
[0044] In some optional implementations of this embodiment, the method further includes: obtaining the vulnerability patch MD5 digest; and verifying the vulnerability patch according to the vulnerability patch MD5 digest, so as to prevent the vulnerability patch from being tampered with.
[0045] Step 204: patch the protected application program according to the vulnerability patch.
[0046] In this embodiment, necessary information required for patch update, such as repair points and repair methods, can be parsed from the vulnerability patch. Then, according to the repair points and repair methods, the method affected by the vulnerability in the protected application is rewritten through the interface provided in InstrumentAgent.
[0047] The downloaded vulnerability patch is uncompiled source code, which is compiled by the application server. The source code in the vulnerability patch is compiled to obtain the patch bytecode file. The protected application is patched and repaired according to the repair points and repair methods.
[0048] In some optional implementations of this embodiment, the identifier of the unique process of the currently running JVM instance of the protected application is obtained, and the Instrument Agent dynamic link library is loaded into the unique process; a socket connection is created and the patch bytecode file is sent to the server socket; the redefinition class request is encapsulated as a virtual machine-level operation according to the repair point and the repair method and added to the virtual machine thread running queue, and when the thread pulls the redefinition class request from the queue, the patch bytecode file is loaded. Complete the operations such as merging the constant pool of the class to be modified, clearing the original method breakpoint, and updating the class itable / vtable. Replace the bytecode of the method with the vulnerability with the patch bytecode fragment, complete the class redefinition notification after the security repair, and load the class file after the vulnerability is repaired. Here, the vulnerability repair device acts as the client and the protected application acts as the server. If the Attach listener is not started in the currently running JVM instance of the protected application, it is necessary to control the protected application to open the server socket listening port to receive the connection request. Then the vulnerability repair device can establish a socket connection with the protected application and send the compiled patch bytecode file to the protected application. The protected application performs vulnerability repair.
[0049] In some optional implementations of this embodiment, after loading the patch bytecode file, the method further includes: verifying the content of the patch bytecode file, for example, checking the format of the file, and if the format does not meet expectations, the file cannot be used.
[0050] Continuing to refer to FIG. 3, FIG. 3 is a schematic diagram of an application scenario of the vulnerability repair method according to the present embodiment. In the application scenario of FIG. 3, the protected application is a Java EE enterprise-level application running on a Java virtual machine. The Java virtual machine specification provides a set of virtual machine tool interfaces to the outside world, which can be used by developers to expand and implement their own logic. Fix-unit consists of three parts, among which Instrument Agent uses the interface exposed by the protected application to provide a dynamic link library of the proxy function to provide a support proxy service for the instrumented program. After receiving the instruction issued by the control server, the Agent UI calls the dynamic link library of the proxy function, uses the control protocol to communicate with the virtual machine tool interface of the JVM instance to be protected, and loads the corresponding patch file (patch). The patch file is then compiled, and the generated patch bytecode file is sent to the protected application. After receiving the patch stream file, the agent main method loaded into the JVM instance adds a class converter, in which the redefinition class request is encapsulated by the JVM as a virtual machine-level operation and added to the virtual machine thread running queue. When the thread pulls the redefinition class request from the queue, the new bytecode file is loaded and the content is verified. Then complete the operations such as merging the constant pool of the class to be modified, clearing the original method breakpoints, and updating the class itable / vtable.
[0051] By replacing the vulnerable method bytecode with the patch bytecode fragment, the class redefinition notification after the security repair is finally completed. At this point, all patch hot update operations are completed, and the online application security vulnerability is repaired online in real time.
[0052] Two examples are listed below to demonstrate the feasibility of the hot fix. Fastjson is Alibaba's open source JSON parsing library, which can parse strings in JSON format and supports serializing Java Beans into JSON strings, as well as deserializing from JSON strings to JavaBeans. Hackers can use this feature to deserialize specified malicious classes on the victim's machine, causing the victim's machine to be remotely controlled by the attacker to execute arbitrary system commands or refuse to provide normal services to the outside world due to memory resource exhaustion. In order to deal with the endless stream of deserialization vulnerabilities, the official introduced a deserialization class name check function in version 1.2.25, which uses a blacklist method to verify the deserialization class name and blocks malicious attacks by throwing runtime exceptions. The hot patch replaces the bytecode fragment that saves the blacklist array variable at runtime, updates the blacklist list in real time, and can intercept malicious deserialization classes that bypass the original blacklist without upgrading the component version. Some patch codes such as Figure 3bAs shown in the figure. Versions below 1.2.60 do not perform validity checks on the incoming hexadecimal characters, which causes the memory occupied by the JVM process to quickly rise to the maximum value allowed by the JVM when parsing the malformed JSON string, and is eventually terminated by the operating system protection process, resulting in the inability to provide normal services to normal users. When parsing the JSON terminator, the hot patch obtains the bytecode value and compares it with a specific value. When parsing the malformed hexadecimal, it throws a runtime exception to terminate the attack request. The patch code is as follows: Figure 3c shown.
[0053] The technical solution of this application is used for Java backend applications, which solves the problem that fixing vulnerabilities requires modifying the code, recompiling, and re-launching. Java vulnerabilities can be fixed without modifying the application code, compiling, or restarting the application.
[0054] Further references Figure 4 , which shows a process 400 of another embodiment of a vulnerability repair method. The process 400 of the vulnerability repair method includes the following steps:
[0055] Step 401: Obtain version information of the protected application program, and send the version information to the control server.
[0056] In this embodiment, the execution subject of the vulnerability repair method (for example Figure 1 The application server shown in the figure can collect the version information of the protected application involved locally and report it to the control server. The control server analyzes and determines which protected applications may have vulnerabilities based on the version information. The corresponding vulnerability information is then distributed to the application server. The control server may manage multiple application servers and can dispatch vulnerability information based on the version information of the protected application.
[0057] Step 402: Acquire vulnerability information from the control server, wherein the vulnerability information includes vulnerability fingerprints and patch configuration files.
[0058] Step 403: Scan the executable file of the protected application according to the vulnerability fingerprint to determine whether there is a vulnerability.
[0059] Step 404: If a vulnerability exists, a vulnerability patch is obtained according to the patch path in the patch configuration file.
[0060] Step 405: patch the protected application program according to the vulnerability patch.
[0061] Steps 402-405 are substantially the same as steps 201-205, and thus are not described in detail herein.
[0062] Step 406: After the repair is completed, the repair result is reported to the control server.
[0063] In this embodiment, there are four repair results: installation success / failure, uninstallation success / failure. The reason for the failure can also be reported to the control server. The control server analyzes the failure reason, such as the problem of the patch file version, and initiates the vulnerability repair again after updating the patch file.
[0064] Further references Figure 5 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a vulnerability repair device, which is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0065] like Figure 5 As shown, the vulnerability repair device 500 of this embodiment includes: an acquisition unit 501, a scanning unit 502, a downloading unit 503, and an updating unit 504. The acquisition unit 501 is configured to acquire vulnerability information from a control server, wherein the vulnerability information includes a vulnerability fingerprint and a patch configuration file; the scanning unit 502 is configured to scan the executable file of the protected application according to the vulnerability fingerprint to determine whether there is a vulnerability; the downloading unit 503 is configured to acquire a vulnerability patch according to the patch path in the patch configuration file if there is a vulnerability; and the updating unit 504 is configured to perform patch update and repair on the protected application according to the vulnerability patch.
[0066] In this embodiment, the specific processing of the acquisition unit 501, the scanning unit 502, the downloading unit 503, and the updating unit 504 of the vulnerability repair device 500 can be referred to. Figure 2 Corresponding to step 201, step 202, step 203, and step 204 in the embodiment.
[0067] In some optional implementations of this embodiment, the device further includes a reporting unit (not shown in the drawings), which is configured to report the repair result to the control server after the repair is completed.
[0068] In some optional implementations of this embodiment, the update unit 504 is further configured to: parse the vulnerability patch to obtain repair points and repair methods; compile the source code in the vulnerability patch to obtain a patch bytecode file; and perform patch update and repair on the protected application according to the repair points and repair methods.
[0069] In some optional implementations of this embodiment, the update unit 504 is further configured to: obtain the identifier of the unique process of the currently running JVM instance of the protected application, load the Instrument Agent dynamic link library into the unique process; create a socket connection and send the patch bytecode file to the server socket; encapsulate the redefine class request as a virtual machine-level operation according to the repair point and repair method and add it to the virtual machine thread running queue, and when the thread pulls the redefine class request from the queue, load the patch bytecode file. Complete the merging of the constant pool of the class to be modified, clear the original method breakpoints, and perform the update class operation. Replace the bytecode of the vulnerable method with the patch bytecode fragment, complete the class redefinition notification after the security repair, and load the class file after the vulnerability is repaired.
[0070] In some optional implementations of this embodiment, the update unit 504 is further configured to: before creating a socket connection and sending the patch bytecode file to the server socket, if the Attach listener is not started in the currently running JVM instance, the server socket listening port is opened to receive connection requests.
[0071] In some optional implementations of this embodiment, the updating unit 504 is further configured to: verify the content of the patch bytecode file after loading the patch bytecode file.
[0072] In some optional implementations of this embodiment, the vulnerability information further includes an MD5 digest of the patch configuration file; and the updating unit 504 is further configured to: verify the patch configuration file according to the MD5 digest of the patch configuration file.
[0073] In some optional implementations of this embodiment, the updating unit 504 is further configured to: obtain the vulnerability patch MD5 digest; and verify the vulnerability patch according to the vulnerability patch MD5 digest.
[0074] In some optional implementations of this embodiment, the reporting unit is further configured to: obtain version information of the protected application before obtaining vulnerability information from the control server; and send the version information to the control server so that the control server searches for corresponding vulnerability information based on the version information.
[0075] Reference below Figure 6 , which shows an electronic device (eg, Figure 1 A schematic diagram of the structure of a control server or application server) 600. Figure 6 The control server or application server shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0076] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0077] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0078] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above functions defined in the method of the embodiment of the present disclosure are executed. It should be noted that the computer-readable medium described in the embodiment of the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus, or a device. In an embodiment of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, an apparatus, or a device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
[0079] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains vulnerability information from the control server, wherein the vulnerability information includes vulnerability fingerprints and patch configuration files; scans the executable file of the protected application according to the vulnerability fingerprint to determine whether there is a vulnerability; if there is a vulnerability, obtains the vulnerability patch according to the patch path in the patch configuration file; and performs patch update and repair on the protected application according to the vulnerability patch.
[0080] Computer program code for performing the operations of embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0081] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0082] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes an acquisition unit, a scanning unit, a downloading unit, and an update unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the acquisition unit may also be described as a "unit for obtaining vulnerability information from a control server".
[0083] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. A vulnerability repair method, comprising: Acquire vulnerability information from a control server, wherein the vulnerability information includes a vulnerability fingerprint and a patch configuration file; Scanning the executable file of the protected application according to the vulnerability fingerprint to determine whether there is a vulnerability; If there is a vulnerability, obtain the vulnerability patch according to the patch path in the patch configuration file; Analyze the vulnerability patch to obtain repair points and repair methods; Compile the source code in the vulnerability patch to obtain a patch bytecode file; Obtaining an identifier of a unique process of a currently running JVM instance of the protected application, and loading an InstrumentAgent dynamic link library into the unique process; Creating a socket connection and sending the patch bytecode file to the server socket; According to the repair point and the repair method, the redefine class request is encapsulated as a virtual machine level operation and added to the virtual machine thread running queue, and when the thread pulls the redefine class request from the queue, the patch bytecode file is loaded; Complete the merging of the constant pool of the class to be modified, clear the breakpoints of the original method, and perform the update class operation; Replace the bytecode of the vulnerable method with the patch bytecode fragment, complete the class redefinition notification after the security repair, and load the class file after the vulnerability is repaired.
2. The method according to claim 1, wherein: The method further comprises: After the repair is completed, the repair result is reported to the control server.
3. The method according to claim 1, wherein: Before creating a socket connection and sending the patch bytecode file to the server socket, the method further includes: If the Attach listener is not started in the currently running JVM instance, the server-side socket listening port is opened to receive the connection request.
4. The method according to claim 1, wherein: After loading the patch bytecode file, the method further comprises: Verify the content of the patch bytecode file.
5. The method according to claim 1, wherein: The vulnerability information also includes an MD5 summary of a patch configuration file; and the method further includes: The patch configuration file is verified according to the MD5 digest of the patch configuration file.
6. The method according to claim 1, wherein: The method further comprises: Get the vulnerability patch MD5 digest; The vulnerability patch is verified according to the vulnerability patch MD5 digest.
7. The method according to any one of claims 1 to 6, wherein: Before obtaining vulnerability information from the control server, the method further includes: Obtaining version information of the protected application; The version information is sent to the control server, so that the control server searches for corresponding vulnerability information according to the version information.
8. A vulnerability repair device, comprising: An acquisition unit is configured to acquire vulnerability information from a control server, wherein the vulnerability information includes a vulnerability fingerprint and a patch configuration file; a scanning unit configured to scan the executable file of the protected application according to the vulnerability fingerprint to determine whether there is a vulnerability; A download unit is configured to obtain a vulnerability patch according to a patch path in the patch configuration file if a vulnerability exists; Update unit, configured as: Analyze the vulnerability patch to obtain repair points and repair methods; Compile the source code in the vulnerability patch to obtain a patch bytecode file; Obtaining an identifier of a unique process of a currently running JVM instance of the protected application, and loading an InstrumentAgent dynamic link library into the unique process; Creating a socket connection and sending the patch bytecode file to the server socket; According to the repair point and the repair method, the redefine class request is encapsulated as a virtual machine level operation and added to the virtual machine thread running queue, and when the thread pulls the redefine class request from the queue, the patch bytecode file is loaded; Complete the merging of the constant pool of the class to be modified, clear the breakpoints of the original method, and perform the update class operation; Replace the bytecode of the vulnerable method with the patch bytecode fragment, complete the class redefinition notification after the security repair, and load the class file after the vulnerability is repaired.
9. A vulnerability repair electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and device for repairing vulnerability
CN106921731A
