A method to protect the integrity of Linux system

By modifying the Linux kernel and building a security review and integrity calculation module, and using hardware functions to protect system integrity, we solve the problem of malware attacks on Linux systems when they are connected to the Internet, and achieve defense and system integrity against known and unknown malicious codes. Effective protection, reducing resource occupation and the risk of false positives and omissions.

CN118312954BActive Publication Date: 2024-09-13HEFEI WEISHI INNOVATION INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410422446.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-09
Publication Date
2024-09-13
Estimated Expiration
2044-04-09

AI Technical Summary

Technical Problem

Existing Linux systems are vulnerable to malware attacks when connected to the Internet. Existing anti-virus software and HIDS/EDR software have problems such as post-mortem detection, inability to resolve unknown malicious codes, high resource usage, missed and false positives, and easy bypassing. It is impossible to solve security problems from the whole system level and from the bottom layer.

Method used

By modifying the Linux kernel, we build security review and integrity calculation, signature, and marking modules, use hardware functions to perform pre-detection and blocking, calculate HMAC/CMAC values ​​and signatures, and achieve system integrity protection. We combine hardware security modules for verification and Interception.

Benefits of technology

It achieves effective defense against known and unknown malicious codes, prevents system damage, reduces resource occupation and the risk of false positives and omissions, and provides a global, underlying security solution with reliable performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118312954B
    Figure CN118312954B
Patent Text Reader

Abstract

The present invention discloses a method for protecting the integrity of a Linux system, which specifically includes: (1) modifying a kernel with an integrity protection function; (2) constructing a security review and integrity calculation, signature, marking module, audit module and management module; (3) conducting a security review, calculating an HMAC / CMAC value, or signing, and marking, and making a security baseline; (4) installing a kernel with an integrity protection function, as well as an HMAC / CMAC value or signature, marking and a security baseline; (5) issuing a key and a digital certificate; (6) before the Linux operating platform carries out an event activity, verifying whether the system integrity of the Linux operating platform is destroyed, and if it is destroyed, prohibiting the event activity from being carried out, and reporting an alarm message; (7) choosing to ignore or disconnect the network connection of the Linux operating platform according to the security level of the Linux operating platform. The present invention solves the system security problem from the bottom by modifying the Linux kernel, making full use of hardware functions, and increasing the integrity protection mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical fields of information security and network security for Linux, and in particular to a method for protecting the integrity of a Linux system. Background Art

[0002] Linux is a free-to-use and freely-distributed Unix-like operating system. It is also a multi-user, multi-tasking, multi-threaded and multi-CPU operating system that complies with POSIX. Users can not only intuitively obtain the implementation mechanism of the operating system, but also modify and improve Linux according to their own needs to maximize its adaptability to user needs. Linux can run on a variety of hardware platforms, such as platforms with x86, 680x0, SPARC, Alpha and other processors; in addition, Linux is also an embedded operating system that can run on handheld computers, set-top boxes or game consoles, and has been widely used.

[0003] Like other operating systems, Linux also has security vulnerabilities during operation. When connected to the Internet, it is vulnerable to attacks by malicious software or programs (viruses and Trojans), causing problems in information security and network security. At present, the usual solution is to install anti-virus security software on the Linux operating platform (computer) to detect and kill known malicious code based on the signature code of the malicious code file. In essence, it uses HIDS and EDR security software to detect malicious behavior based on the signature code of the malicious code file and the behavioral signature code. There are the following problems and defects:

[0004] 1. Existing antivirus software and HIDS / EDR software can only detect and kill viruses after the fact, but cannot provide pre-emptive protection.

[0005] 2. Existing antivirus software and HIDS / EDR can only detect and kill known malicious code, but cannot solve the problem of unknown malicious code.

[0006] 3. Existing antivirus software and HIDS / EDR software are pure software, which generally occupy a lot of resources and have defects such as missed reports and false reports.

[0007] 4. Existing antivirus software and HIDS / EDR only focus on one aspect of the system, and do not solve the problem from the whole system level or bottom layer, making them easy to be bypassed. Summary of the invention

[0008] The purpose of the present invention is to overcome the defects and shortcomings of the prior art and provide a method for protecting the integrity of the Linux system by modifying the Linux kernel, making full use of hardware functions, increasing the integrity protection mechanism, and solving the system security problem from the bottom up.

[0009] To achieve the above object, the present invention provides the following technical solutions:

[0010] A method for protecting the integrity of a Linux system, characterized in that it specifically comprises the following steps:

[0011] S1. Modify the kernel of the Linux system to obtain a kernel with integrity protection function;

[0012] S2. Construct security review and integrity calculation, signature, marking module, audit module and management module;

[0013] S3. The security review and integrity calculation, signature, and marking module performs a security review on the executable code, security configuration, key configuration, key file, and key data file. After the security review is passed, the HMAC / CMAC value of the executable code, security configuration, key configuration, key file, and key data file is calculated, or the executable code, security configuration, key configuration, key file, and key data file are signed, and the executable code, security configuration, key configuration, key file, and key data file are marked, and then a security baseline is made, and then the kernel with integrity protection function, as well as the obtained HMAC / CMAC value or signature, mark, and security baseline are stored in a storage medium;

[0014] S4. Install the kernel with integrity protection function downloaded from the storage medium, as well as the HMAC / CMAC value or signature, tag and security baseline obtained in step S3 on the Linux operating platform;

[0015] S5. The management module sends the key for calculating the HMAC / CMAC value and the digital certificate for verifying the signature to the Linux operating platform;

[0016] S6. Before the Linux operating platform carries out an event activity, the kernel with integrity protection function first intercepts the event activity to be carried out, and then the kernel with integrity protection function determines whether the system integrity of the Linux operating platform is destroyed. If the system integrity of the Linux operating platform is not destroyed, the kernel with integrity protection function allows the event activity to be carried out normally; if the system integrity of the Linux operating platform is destroyed, the kernel with integrity protection function prohibits the event activity from being carried out, and reports the alarm information to the audit module;

[0017] The method for determining whether the system integrity of the Linux operating platform is damaged comprises the following steps:

[0018] S61. The kernel with integrity protection function calculates the HMAC / CMAC value of the executable code, security configuration and key configuration, key file and key data file of the Linux operating platform according to the key, or performs signature verification on the executable code, security configuration and key configuration, key file and key data file according to the digital certificate, and marks the executable code, security configuration and key configuration, key file and key data file;

[0019] S62. The kernel with integrity protection function compares the HMAC / CMAC value and the tag obtained in step S61 with the HMAC / CMAC value and the tag obtained in step S3 respectively. If the HMAC / CMAC value obtained in step S61 is the same as the HMAC / CMAC value obtained in step S3, or the signature verification in step S61 succeeds, and the tag obtained in step S61 matches the tag obtained in step S3, then the system integrity of the Linux operating platform is not destroyed.

[0020] If the HMAC / CMAC value obtained in step S61 is different from the HMAC / CMAC value obtained in step S3, or the signature verification in step S61 fails, or the tag obtained in step S61 does not match the tag obtained in step S3, the system integrity of the Linux operating platform is destroyed;

[0021] S7. The audit module receives the reported alarm information, analyzes and stores it, and reports the alarm information to the management module. The management module chooses to ignore or disconnect the network connection of the Linux operating platform according to the security level of the Linux operating platform.

[0022] Furthermore, in step S3, the key is protected by hardware of the Linux operating platform.

[0023] Furthermore, the hardware includes security functions of the CPU of the Linux operating platform, a trusted platform module and a hardware security module.

[0024] Furthermore, in step S3, the executable code includes compiled executable code, so library, kernel module, firmware, object file loaded by bpf, interpreted executable code, code compiled and interpreted by the interpreter, and program plug-in.

[0025] Furthermore, the kernel with integrity protection function verifies whether the HMAC / CMAC values ​​of the compiled executable code, so library, kernel module, firmware, object file loaded by bpf, interpreted execution code, code compiled and interpreted by the interpreter, content of the program plug-in and metadata thereof are correct, whether the signature verification is successful, and whether the tag matches. If the HMAC / CMAC value is correct or the signature verification is successful, and the tag matches, the system integrity of the Linux operating platform is not destroyed; if the HMAC / CMAC value is incorrect, or the signature verification fails, or the tag does not match, the system integrity of the Linux operating platform is destroyed.

[0026] Furthermore, in step S6, the kernel with integrity protection function verifies whether the memory and file contents of the security configuration and key configuration are correct, or whether the HMAC / CMAC value of the metadata is correct, and whether the tags match.

[0027] Furthermore, in step S6, the kernel with integrity protection function verifies whether the HMAC / CMAC value of the content or metadata of the key file is correct and whether the tag matches.

[0028] Furthermore, in step S6, the kernel with integrity protection function verifies whether the HMAC / CMAC value of the content or metadata of the key data file is correct and whether the tag matches.

[0029] Furthermore, in step S6, the security level of the Linux operating platform is divided into a low level and a high level. When the security level of the Linux operating platform is a low level, the management module chooses to ignore; when the security level of the Linux operating platform is a high level, the management module chooses to disconnect the network connection of the Linux operating platform.

[0030] Furthermore, the management module disconnects the network connection of the Linux operating platform by disabling the IP or setting a firewall.

[0031] Compared with the prior art, the present invention has the following beneficial effects:

[0032] 1. Existing antivirus software and HIDS / EDR software can only solve known problems, while the present invention can solve known and unknown problems, especially the problems of unknown malicious codes, Rootkits, etc.

[0033] 2. The existing anti-virus software and HIDS / EDR software are pure software, and detect and kill viruses based on virus file signature codes or virus behavior signature codes. The present invention makes full use of hardware functions and is implemented in the kernel, which can effectively prevent virus invasion.

[0034] 3. Existing anti-virus software and HIDS / EDR software detect and kill viruses after the fact, when the virus has already damaged the system. However, some viruses (such as Rootkits) can block and defend against them in advance, thereby preventing malicious code and malicious behavior from damaging the system.

[0035] 4. In view of the problem that existing anti-virus software and HIDS / EDR software generally occupy high resources and have missed reports and false reports, the present invention uses very few resources and has no missed reports or false reports.

[0036] 5. The present invention can solve the problem from a global, holistic and bottom-level perspective, has reliable performance and is easy to use. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a structural principle block diagram of each functional module in the present invention.

[0038] Figure 2 The method flow of the present invention Figure 1 .

[0039] Figure 3 The method flow of the present invention Figure 2 . DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0041] See also Figure 1-3 , a method for protecting the integrity of a Linux system, specifically comprising the following steps:

[0042] S1. Modify the kernel of the Linux system to obtain a kernel with integrity protection function.

[0043] S2. Construct security review and integrity calculation, signature, marking module, audit module and management module.

[0044] S3. The security review and integrity calculation, signature, and marking modules conduct a security review on the executable code, security configuration, key configuration, key file, and key data file. After the security review is passed, the HMAC / CMAC value of the executable code, security configuration, key configuration, key file, and key data file is calculated, or the executable code, security configuration, key configuration, key file, and key data file are signed, and the executable code, security configuration, key configuration, key file, and key data file are marked, and then a security baseline is made, and then the kernel with integrity protection function, as well as the obtained HMAC / CMAC value or signature, mark, and security baseline are stored in the storage medium.

[0045] S4. Install the kernel with integrity protection function downloaded from the storage medium on the Linux operating platform, as well as the HMAC / CMAC value or signature, tag and security baseline obtained in step S3.

[0046] S5. The management module sends the key for calculating the HMAC / CMAC value and the digital certificate for verifying the signature to the Linux operating platform.

[0047] Specifically, the key is protected using the hardware of the Linux operating platform.

[0048] The hardware includes, but is not limited to, the security features of the CPU of the Linux platform (SGX, keylocker), the Trusted Platform Module (TPM), and the Hardware Security Module (HSM, a type of hardware used for security purposes, such as encryption and decryption in the HSM).

[0049] S6. Before the Linux operating platform carries out an event activity, the kernel with integrity protection function first intercepts the event activity to be carried out, and then the kernel with integrity protection function determines whether the system integrity of the Linux operating platform is damaged. If the system integrity of the Linux operating platform is not damaged, the kernel with integrity protection function allows the event activity to be carried out normally; if the system integrity of the Linux operating platform is damaged, the kernel with integrity protection function prohibits the event activity from being carried out and reports the alarm information to the audit module.

[0050] The method for determining whether the system integrity of the Linux operating platform is damaged comprises the following steps:

[0051] S61. The kernel with integrity protection function calculates the HMAC / CMAC value of the executable code, security configuration and key configuration, key files and key data files of the Linux operating platform based on the key, or performs signature verification on the executable code, security configuration and key configuration, key files and key data files based on the digital certificate, and marks the executable code, security configuration and key configuration, key files and key data files.

[0052] S62. The kernel with integrity protection function compares the HMAC / CMAC value and the tag obtained in step S61 with the HMAC / CMAC value and the tag obtained in step S3. If the HMAC / CMAC value obtained in step S61 is the same as the HMAC / CMAC value obtained in step S3, or the signature verification in step S61 succeeds, and the tag obtained in step S61 matches the tag obtained in step S3, then the system integrity of the Linux operating platform is not destroyed.

[0053] If the HMAC / CMAC value obtained in step S61 is different from the HMAC / CMAC value obtained in step S3, or the signature verification in step S61 fails, or the tag obtained in step S61 does not match the tag obtained in step S3, the system integrity of the Linux operating platform is destroyed.

[0054] Specifically, executable code includes compiled executable code, so library, kernel module, firmware, object file loaded by bpf, interpreted executable code, code compiled and interpreted by the interpreter, and program plug-ins.

[0055] Furthermore, the kernel with integrity protection function verifies whether the HMAC / CMAC values ​​of compiled executable code, so library, kernel module, firmware, object files loaded by bpf, interpreted executable code, code compiled and interpreted by the interpreter, content of program plug-ins and their metadata are correct, whether the signature verification is successful, and whether the tag matches. If the HMAC / CMAC value is correct or the signature verification is successful, and the tag matches, the system integrity of the Linux operating platform is not destroyed; if the HMAC / CMAC value is incorrect, or the signature verification fails, or the tag does not match, the system integrity of the Linux operating platform is destroyed.

[0056] Furthermore, the kernel with integrity protection function verifies whether the memory and file contents of the security configuration and critical configuration are correct, or whether the HMAC / CMAC value of the metadata is correct, and whether the tags match.

[0057] In addition, the kernel with integrity protection function verifies that the HMAC / CMAC value of the content or metadata of the critical file is correct and that the tag matches.

[0058] In addition, the kernel with integrity protection function verifies whether the HMAC / CMAC value of the content or metadata of the critical data file is correct and whether the tag matches.

[0059] S7. The audit module receives the reported alarm information, analyzes and stores it, and reports the alarm information to the management module. The management module chooses to ignore or disconnect the network connection of the Linux operating platform according to the security level of the Linux operating platform.

[0060] Specifically, the audit module analyzes the reasons why the integrity of the Linux operating platform is destroyed based on the reported alarm information, such as whether it is ransomware, implanted rootkit, or false alarm.

[0061] In addition, the security level of the Linux operating platform is divided into low and high levels. When the security level of the Linux operating platform is low, the management module chooses to ignore; when the security level of the Linux operating platform is high, the management module chooses to disconnect the network connection of the Linux operating platform.

[0062] Furthermore, the management module disconnects the network connection of the Linux operating platform by disabling the IP or setting a firewall.

[0063] Although this specification is described according to implementation modes, not every implementation mode includes only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

[0064] Therefore, the above description is only a preferred embodiment of the present application and is not intended to limit the scope of implementation of the present application; that is, all equivalent changes made according to the scope of the claims of the present application are within the protection scope of the claims of the present application.

Claims

1. A method to protect the integrity of Linux systems, Features: The specific steps include: S1. Modify the kernel of the Linux system to obtain a kernel with integrity protection function; S2. Construct security review and integrity calculation, signature, marking module, audit module and management module; S3. The security review and integrity calculation, signature, and marking module performs a security review on the executable code, security configuration, key configuration, key file, and key data file. After the security review is passed, the HMAC / CMAC value of the executable code, security configuration, key configuration, key file, and key data file is calculated, or the executable code, security configuration, key configuration, key file, and key data file are signed, and the executable code, security configuration, key configuration, key file, and key data file are marked, and then a security baseline is made, and then the kernel with integrity protection function, as well as the obtained HMAC / CMAC value or signature, mark, and security baseline are stored in a storage medium; S4. Install the kernel with integrity protection function downloaded from the storage medium, as well as the HMAC / CMAC value or signature, tag and security baseline obtained in step S3 on the Linux operating platform; S5. The management module sends the key for calculating the HMAC / CMAC value and the digital certificate for verifying the signature to the Linux operating platform; S6. Before the Linux operating platform carries out an event activity, the kernel with integrity protection function first intercepts the event activity to be carried out, and then the kernel with integrity protection function determines whether the system integrity of the Linux operating platform is destroyed. If the system integrity of the Linux operating platform is not destroyed, the kernel with integrity protection function allows the event activity to be carried out normally; If the system integrity of the Linux operating platform is destroyed, the kernel with integrity protection function prohibits the event activity from being carried out and reports the alarm information to the audit module; The method for determining whether the system integrity of the Linux operating platform is damaged comprises the following steps: S61. The kernel with integrity protection function calculates the HMAC / CMAC value of the executable code, security configuration and key configuration, key file and key data file of the Linux operating platform according to the key, or performs signature verification on the executable code, security configuration and key configuration, key file and key data file according to the digital certificate, and marks the executable code, security configuration and key configuration, key file and key data file; S62. The kernel with integrity protection function compares the HMAC / CMAC value and the tag obtained in step S61 with the HMAC / CMAC value and the tag obtained in step S3 respectively. If the HMAC / CMAC value obtained in step S61 is the same as the HMAC / CMAC value obtained in step S3, or the signature verification in step S61 succeeds, and the tag obtained in step S61 matches the tag obtained in step S3, then the system integrity of the Linux operating platform is not destroyed. If the HMAC / CMAC value obtained in step S61 is different from the HMAC / CMAC value obtained in step S3, or the signature verification in step S61 fails, or the tag obtained in step S61 does not match the tag obtained in step S3, the system integrity of the Linux operating platform is destroyed; S7. The audit module receives the reported alarm information, analyzes and stores it, and reports the alarm information to the management module. The management module chooses to ignore or disconnect the network connection of the Linux operating platform according to the security level of the Linux operating platform.

2. A method for protecting the integrity of a Linux system according to claim 1, Features: In the step S5, the key is protected by the hardware of the Linux operating platform.

3. A method for protecting the integrity of a Linux system according to claim 2, Features: The hardware includes the security function of the CPU of the Linux operating platform, a trusted platform module and a hardware security module.

4. A method for protecting the integrity of a Linux system according to claim 1, Features: In the step S6, the executable code includes compiled executable code, so library, kernel module, firmware, object file loaded by bpf, interpreted executable code, code compiled and interpreted by the interpreter, and program plug-in.

5. A method for protecting the integrity of a Linux system according to claim 4, Features: The kernel with integrity protection function verifies whether the HMAC / CMAC values ​​of the compiled executable code, so library, kernel module, firmware, object file loaded by bpf, interpreted execution code, code compiled and interpreted by the interpreter, content of the program plug-in and metadata thereof are correct, whether the signature verification is successful, and whether the tag matches. If the HMAC / CMAC value is correct or the signature verification is successful, and the tag matches, the system integrity of the Linux operating platform is not destroyed; if the HMAC / CMAC value is incorrect, or the signature verification fails, or the tag does not match, the system integrity of the Linux operating platform is destroyed.

6. A method for protecting the integrity of a Linux system according to claim 1, Features: In step S6, the kernel with integrity protection function verifies whether the memory and file contents of the security configuration and key configuration are correct, or whether the HMAC / CMAC value of the metadata is correct, and whether the tags match.

7. A method for protecting the integrity of a Linux system according to claim 1, Features: In step S6, the kernel with integrity protection function verifies whether the HMAC / CMAC value of the content or metadata of the key file is correct and whether the tag matches.

8. A method for protecting the integrity of a Linux system according to claim 1, Features: In step S6, the kernel with integrity protection function verifies whether the HMAC / CMAC value of the content or metadata of the key data file is correct and whether the tag matches.

9. A method for protecting the integrity of a Linux system according to claim 1, Features: In the step S7, the security level of the Linux operating platform is divided into a low level and a high level. When the security level of the Linux operating platform is a low level, the management module chooses to ignore; When the security level of the Linux operating platform is high, the management module chooses to disconnect the network connection of the Linux operating platform.

10. A method for protecting the integrity of a Linux system according to claim 9, Features: The management module disconnects the network connection of the Linux operating platform by disabling the IP or setting a firewall.