Power distribution network terminal integrity verification method and device based on memory access control

By using the memory access control method, modifying the exception vector table and using the HVC exception handler to verify the kernel and control flow integrity, the security issues of the distribution network terminals are solved and the stability and reliability of the system are improved.

CN119598474BActive Publication Date: 2025-10-21STATE GRID HUNAN ELECTRIC POWER COMPANY LIMITED +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411753939.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-10-21
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

Existing distribution network terminals have security risks and are vulnerable to network attacks, resulting in system instability and unreliability, and lack of effective security verification methods.

Method used

A memory access control-based method is adopted to modify the exception vector table, use the HVC exception handler to verify the kernel integrity and control flow integrity, and use hash value comparison and whitelist matching to ensure the integrity of the system.

Benefits of technology

It improves the security, stability and reliability of distribution network terminal systems, prevents unauthorized kernel modification and control flow hijacking attacks, and reduces the risk of system crashes and data corruption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119598474B_ABST
    Figure CN119598474B_ABST
Patent Text Reader

Abstract

The application discloses a power distribution network terminal integrity verification method and device based on memory access control, and the method steps comprise the following: modifying the HVC exception entry corresponding to the exception vector table in the power distribution network terminal processor to execute the corresponding HVC exception processing program; controlling to start kernel integrity verification or control flow integrity verification by the HVC exception processing program; when starting the kernel integrity verification on the power distribution network terminal system, comparing the hash value calculated when starting the power distribution network terminal system with the hash value calculated when the number of events generated by the kernel layer and the application layer exceeds the preset threshold value to verify the kernel integrity; starting the control flow integrity verification on the power distribution network terminal system, acquiring the legal jump white list of the target function, and matching the source address value of the current jump to verify the control flow integrity. The application has the advantages of simple implementation method, low cost, high safety, stability and reliability and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent distribution network security detection, and in particular to a distribution network terminal integrity verification method and device based on memory access control. Background Art

[0002] Smart grids integrate bidirectional high-speed communication network technology with computer-based automation and distributed control technologies, enabling intelligent energy management. As a core component of smart grids, smart distribution networks deploy a large number of intelligent terminals, enabling bidirectional communication between distribution network terminals and master stations using a variety of communication methods. However, the integration of communication networks with distribution networks introduces new security issues, exposing the vast number of distribution network terminals to potential security risks. Cyberattacks are occurring with increasing frequency, and their variability, stealth, targeting, and persistence are also increasing. Distribution network terminals are crucial devices that directly connect to consumers. If attacked by a cyberattack, cascading failures could lead to widespread power outages and directly harm other critical infrastructure, such as finance, energy, communications, and transportation.

[0003] At present, the software stack of distribution network terminals is usually built on the basis of open source Linux or other RTOS. Due to the large amount of code in these operating systems, it is easy for a large number of security vulnerabilities to exist due to human negligence. In addition, the distribution network terminals are set in an open environment. Attackers can exploit vulnerabilities to tamper with the operating system kernel to implant malicious programs, or modify the program execution path to run malicious code. There is currently a lack of security verification methods for distribution network terminals, which will seriously threaten the safe, stable and reliable operation of smart distribution network systems and even smart grid systems. Summary of the Invention

[0004] The technical problem to be solved by the present invention is: In response to the technical problems existing in the prior art, the present invention provides a distribution network terminal integrity verification method and device based on memory access control, which has a simple implementation method, low cost, high security, stability and reliability. It can protect the kernel integrity and prevent the terminal operating system from being attacked by malware, while protecting the terminal system from running according to a predetermined control process, effectively improving the overall security, stability and reliability of the terminal system.

[0005] In order to solve the above technical problems, the technical solution proposed by the present invention is:

[0006] A method for verifying the integrity of a distribution network terminal based on memory access control, comprising the following steps:

[0007] Modify the HVC exception entry corresponding to the exception vector table in the distribution network terminal processor so that the corresponding HVC exception handling program is executed;

[0008] The HVC exception handling program controls the start of kernel integrity verification or control flow integrity verification of the distribution network terminal system according to the parameter value of the general register X0;

[0009] When starting the kernel integrity verification of the distribution network terminal system, the kernel integrity is verified by comparing the hash value calculated when starting the distribution network terminal system with the hash value calculated when the number of events generated by the kernel layer and the application layer exceeds a preset threshold;

[0010] Start the control flow integrity verification of the distribution network terminal system by obtaining the legal jump whitelist of the target function and matching the source address value of the current jump with the legal jump whitelist to verify the control flow integrity.

[0011] Furthermore, the HVC exception handling program initiating kernel integrity verification or control flow integrity verification of the distribution network terminal system according to the general register X0 parameter value includes:

[0012] Read the parameter value of general register X0 and make a judgment;

[0013] If the parameter is integrity_param, the kernel integrity of the distribution network terminal system is verified, where integrity_param is the parameter passed to register X0 after the distribution network terminal system is started and the HVC exception is triggered;

[0014] If the parameter is control_param, the control flow integrity of the distribution network terminal system is verified, where control_param is the parameter passed to the general register X0 when the target function is called and the HVC exception is triggered.

[0015] Furthermore, the core integrity verification of the distribution network terminal system includes:

[0016] When the distribution network terminal system is started, the first hash value startHashValue of the entire kernel code segment is calculated according to the kernel code segment length and the kernel code segment starting address set in the distribution network terminal system configuration file and saved in the trusted execution environment;

[0017] Monitor events generated by the kernel layer and application layer. When the cumulative number of events exceeds the preset threshold, the kernel integrity check is triggered and the second hash value eventHashValue of the kernel code segment at the current moment is calculated in the trusted execution environment.

[0018] The second hash value eventHashValue is compared with the first hash value startHashValue. If the comparison is consistent, it is determined that the kernel integrity verification has passed; otherwise, it is determined that the kernel integrity verification has failed.

[0019] Furthermore, the events generated by the kernel layer and the application layer include any one or more events of context switching, system call and interrupt processing.

[0020] Furthermore, the second hash value eventHashValue is compared with the first hash value startHashValue. If the comparison is consistent, the cumulative value of the number of events is cleared; if the comparison is inconsistent, the system operation is interrupted.

[0021] Furthermore, the control flow integrity verification of the distribution network terminal system includes:

[0022] Get the target function's legal jump whitelist in advance;

[0023] After starting the control flow integrity verification, the source address value of the current jump is obtained and matched with the legal jump whitelist. If a match is found, the control flow integrity verification is determined to be passed; otherwise, the control flow integrity verification is determined to be failed.

[0024] Furthermore, the step of obtaining a legal jump whitelist of the target function includes:

[0025] Decompile the kernel source code of the distribution network terminal system and obtain the first address of the target function;

[0026] Configure the target function's first address into the distribution network terminal system;

[0027] Repeatedly running the target function and collecting distribution network terminal system log information during the running process for analysis, and obtaining the legal jump whitelist of the target function according to the analysis results;

[0028] The obtained legal jump whitelist is configured into the distribution network terminal system.

[0029] Furthermore, when it is determined that there is a mismatch, it is determined that there is a risk of control flow hijacking, the current jump is an illegal jump, and the security protection process is executed. The security protection process includes recording the timestamp and context information of the current event, and deciding whether to interrupt the system operation or continue to run the system after isolating the affected part according to the preset strategy.

[0030] A computer device includes a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to perform the above method.

[0031] A computer-readable storage medium storing a computer program, wherein the computer program implements the above method when executed by a processor.

[0032] Compared with the prior art, the advantages of the present invention are:

[0033] 1. The present invention implements kernel integrity verification of the distribution network terminal system by adopting an event-based kernel integrity verification method. The hash value of the kernel code segment is calculated at startup and saved in a trusted execution environment to ensure that the distribution network terminal system is in a trusted state from the beginning. During the subsequent system operation, when the number of events generated by the kernel layer and the application layer exceeds the set threshold, the kernel integrity detection is triggered to determine whether the kernel integrity is destroyed, that is, whether it is complete, thereby preventing unauthorized kernel modification, system crashes caused by malicious program implantation, data corruption or loss, etc., and effectively improving the security, stability and reliability of the distribution network terminal system.

[0034] 2. The present invention implements control flow integrity verification by adopting a whitelist-based control flow integrity verification method. By comparing the target function's legal jump whitelist, it ensures that the system runs according to the predefined control flow, so that the program is executed based on the predefined legal path, thereby effectively reducing the attack surface of the system and avoiding control flow hijacking attacks such as return-oriented programming attacks, jump-oriented programming attacks, and stack-oriented programming attacks.

[0035] 3. The present invention realizes the integrity verification of the distribution network terminal system from two aspects: kernel integrity verification and control flow verification. It can comprehensively enhance the defense of the distribution network terminal against malicious attacks or intrusions, effectively improve the ability of the distribution network terminal system to prevent malware injection and resist control flow hijacking attacks, reduce the risks and losses caused by terminal security vulnerabilities, and effectively protect core businesses and key data. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 This is a flowchart of the implementation of the distribution network terminal integrity verification method based on memory access control in this embodiment.

[0037] Figure 2 The figure is a schematic diagram of the execution flow of the exception handling program in a specific application embodiment of the present invention.

[0038] Figure 3 The figure is a detailed implementation flow chart of kernel integrity verification in a specific application embodiment of the present invention.

[0039] Figure 4 The figure is a detailed implementation flowchart of the control flow integrity verification in a specific application embodiment of the present invention. DETAILED DESCRIPTION

[0040] The present invention will be further described below in conjunction with the accompanying drawings and specific preferred embodiments, but the scope of protection of the present invention is not limited thereby.

[0041] The present invention verifies the integrity of distribution network terminals from two aspects: kernel integrity verification and control flow verification. For kernel integrity verification, an event-based kernel integrity verification method is adopted. By calculating the hash value of the kernel code segment at startup and saving it in a trusted execution environment (TEE), the distribution network terminal system is ensured to be in a trusted state from the beginning. During the subsequent system operation, when the number of events generated by the kernel layer and the application layer exceeds a set threshold, kernel integrity detection is triggered to determine whether the kernel integrity is destroyed, that is, whether it is complete. This prevents unauthorized kernel modification and system crashes, data corruption or loss caused by malicious program implantation, and effectively improves the security, stability and reliability of the distribution network terminal system. For control flow integrity verification, a whitelist-based control flow integrity verification method is adopted. By comparing the target function's legal jump whitelist, it ensures that the system runs according to a predefined control flow, so that the program is executed based on a predefined legal path, thereby effectively reducing the attack surface of the system and avoiding control flow hijacking attacks such as return-oriented programming attacks, jump-oriented programming attacks, and stack-oriented programming attacks.

[0042] like Figure 1 As shown, the steps of the distribution network terminal integrity verification method based on memory access control in this embodiment include:

[0043] Step S01. Modify the HVC exception entry corresponding to the exception vector table in the distribution network terminal processor so that the corresponding HVC exception handler is executed, and the HVC exception handler starts the kernel integrity verification of the distribution network terminal system or starts the control flow integrity verification of the distribution network terminal system according to the parameter value of the general register X0.

[0044] In this embodiment, the HVC exception handler serves as a pre-processor for kernel integrity verification or control flow integrity verification. By modifying the HVC exception entry corresponding to the exception vector table in the distribution network terminal processor, it points to a newly constructed HVC exception handler. This HVC exception handler can control the initiation of kernel integrity calculation or control flow integrity verification. For example, the handler can be configured to first read the parameter value of general register X0 and then perform a parameter match. If the match result is E1 (i.e., integrity_param), kernel integrity calculation is performed; if the match result is E2 (i.e., control_param), control flow integrity verification is initiated.

[0045] In this embodiment, the steps of starting kernel integrity verification or control flow integrity verification of the distribution network terminal system according to the parameter value of the general register X0 by the HVC exception handler include:

[0046] Step S101. Read the parameter value of general register X0 and make a judgment;

[0047] Step S102. If the parameter is integrity_param, then perform kernel integrity verification on the distribution network terminal system, where integrity_param is the parameter passed into register X0 after starting the distribution network terminal system and triggering the HVC exception;

[0048] Step S103: If the parameter is control_param, control flow integrity verification is performed on the distribution network terminal system, where control_param is the parameter passed to the general register X0 when the target function is called and the HVC exception is triggered.

[0049] In a specific application embodiment, Figure 2 As shown, the HVC exception entry in the exception vector table is stored at memory location 0x00000008. The new HVC exception handler it points to first reads the parameter value of general register X0, then performs parameter matching. Finally, based on the parameter matching result, if the parameter matches integrity_param, kernel integrity calculation is performed; if the parameter matches control_param, control flow integrity verification is performed. Specifically, when the distribution network terminal system is started, an HVC exception is triggered, the parameter integrity_param is passed to general register X0, the system exception handler is executed, and kernel integrity calculation is started. When the target function is called, an HVC exception is triggered, the parameter control_param is passed to general register X0, the system exception handler is executed, and control flow integrity verification is started.

[0050] In a specific application embodiment, modifying the HVC exception entry in the exception vector table can be implemented using the following pseudo code:

[0051] / / HVC exception entry in the exception vector table

[0052] void* hvc_vector_entry = (void*)0x00000008;

[0053] / / Modify the HVC exception entry in the exception vector table

[0054] void modify_exception_vector_table(void)

[0055] {

[0056] / / Modify the HVC exception entry to point to the handle_hvc_exception function

[0057] *(uint64_t*)hvc_vector_entry = (uint64_t)&handle_hvc_exception;

[0058] }

[0059] The simple pseudo code for writing an exception handler is:

[0060] / / Function to handle HVC exceptions

[0061] void handle_hvc_exception(void)

[0062] {

[0063] / / Read the value of the X0 register

[0064] uint64_t param = __builtin_aarch64_read_x0();

[0065] / / Perform corresponding operations according to the parameters

[0066] switch(param)

[0067] {

[0068] case param is integrity_param;

[0069] integrity_computation();

[0070] break;

[0071] case param is control_param;

[0072] control_check();

[0073] break;

[0074] default:

[0075] break;

[0076] }

[0077] }

[0078] Step S02: When starting the kernel integrity verification of the distribution network terminal system, the kernel integrity is verified by comparing the hash value calculated when starting the distribution network terminal system with the hash value calculated when the number of events generated by the kernel layer and the application layer exceeds a preset threshold.

[0079] This embodiment implements event-based core integrity verification of the distribution network terminal system, and the steps include:

[0080] Step S201. When the distribution network terminal system is started, the first hash value startHashValue of the entire kernel code segment is calculated according to the kernel code segment length and the kernel code segment starting address set in the distribution network terminal system configuration file and saved in the trusted execution environment;

[0081] Step S202: Monitor events generated by the kernel layer and application layer (such as context switches, system calls, and interrupt processing). When the cumulative number of events exceeds a preset threshold, a kernel integrity check is triggered, and a second hash value (eventHashValue) of the kernel code segment at the current moment is calculated in the Trusted Execution Environment (TEE).

[0082] Step S203: Compare the second hash value eventHashValue with the first hash value startHashValue. If the comparison is consistent, it is determined that the kernel integrity verification has passed; otherwise, it is determined that the kernel integrity verification has failed.

[0083] This embodiment calculates the hash value of the kernel code segment at startup and saves it in a trusted execution environment, thereby ensuring that the distribution network terminal system is in a trusted state from the beginning. At the same time, during the subsequent system operation, by monitoring the number of events generated by the kernel layer and the application layer, the kernel integrity detection is triggered when the cumulative value of the event number exceeds the set threshold. This can effectively determine whether the kernel integrity is destroyed and prevent unauthorized kernel modifications, system crashes, data corruption or loss caused by malicious program implantation. By regularly performing kernel integrity verification on the terminal system in the above manner, potential threats can be discovered in a timely manner and corresponding countermeasures can be taken, effectively improving the security, stability and reliability of the distribution network terminal system.

[0084] In this embodiment, when the second hash value eventHashValue is compared with the first hash value startHashValue, if the comparison is consistent, the cumulative value of the number of events is cleared; if the comparison is inconsistent, the system operation is interrupted to ensure the safety of the system operation.

[0085] The following is an example of implementing kernel integrity verification in a specific application embodiment to further illustrate the kernel integrity verification method of the present invention. Figure 3 As shown, the specific steps include:

[0086] (1) Start the distribution network terminal system, trigger the HVC exception, pass the parameter integrity_param to the general register X0, execute the system exception handler, start the kernel integrity calculation, and calculate the hash value of the entire kernel code segment with the help of the hash function sha256() in the automation tool according to the kernel code segment length and kernel code segment starting address set in the distribution network terminal system configuration file. The first hash value startHashValue is obtained and the calculated value is saved in the trusted execution environment (TEE);

[0087] (2) The Performance Monitoring Unit (PMU) monitors events such as context switching, system calls, and interrupt processing generated by the kernel and application layers. When the cumulative number of events exceeds a preset threshold (e.g., 1000), kernel integrity verification is triggered.

[0088] (3) When performing kernel integrity verification, the hash value eventHashValue of the kernel code segment at the current moment is calculated in the trusted execution environment (TEE) and compared with the hash value startHashValue calculated when the distribution network terminal system is started. If exentHashValue = startHashValue, it means that the kernel integrity detection has passed, the kernel is judged to have integrity, and the cumulative value of the event number is cleared to zero; if eventHashValue != startHashValue, it means that the kernel integrity is destroyed, the detection fails, and the kernel integrity is judged to be destroyed. The distribution terminal system will terminate its operation.

[0089] By combining the above hardware devices such as the performance monitoring unit (PMU), it is possible to implement kernel integrity detection and verification of the collaborative work of software and hardware, providing more comprehensive and effective security protection for distribution network terminals.

[0090] Step S03: Start the control flow integrity verification of the distribution network terminal system by obtaining the legal jump whitelist of the target function and matching the source address value of the current jump with the legal jump whitelist to verify the control flow integrity.

[0091] Based on kernel integrity verification, this embodiment focuses on control flow integrity verification of system programs, which can effectively prevent various control flow attacks and ensure that the system's execution path is effectively protected, thereby providing information security protection for the stable and reliable operation of smart distribution networks and smart grids.

[0092] In this embodiment, the steps of verifying the control flow integrity of the distribution network terminal system include:

[0093] Step S301. Pre-acquire a legal jump whitelist of the target function;

[0094] Step S302: After starting the control flow integrity verification, obtain the source address value of the current jump and match it with the legal jump whitelist. If it matches, the control flow integrity verification is determined to be passed; otherwise, the control flow integrity verification is determined to be failed.

[0095] This embodiment ensures that the system runs according to a predefined control flow by comparing the target function's legal jump whitelist, so that the program is executed based on a predefined legal path, thereby effectively reducing the attack surface of the system and avoiding control flow hijacking attacks such as return-oriented programming attacks, jump-oriented programming attacks, and stack-oriented programming attacks.

[0096] In this embodiment, the step of obtaining the legal jump whitelist of the target function in step S301 includes:

[0097] Step S311: Decompile the kernel source code of the distribution network terminal system, and search and obtain the first address of the target function based on the decompilation result;

[0098] Step S312. Configure the target function's first address into the distribution network terminal system;

[0099] Step S313. Repeatedly run the target function and collect distribution network terminal system log information during the operation for analysis, and obtain a legal jump whitelist of the target function based on the analysis results;

[0100] Step S314: Configure the obtained legal jump whitelist into the distribution network terminal system.

[0101] Read the LR register (link register) to obtain the source address value of the current jump, compare the value with the control flow legal whitelist information one by one, and determine whether there is a control flow hijacking risk based on the matching results.

[0102] The following is an example of implementing control flow integrity verification in a specific application embodiment to further illustrate the control flow integrity verification method of the present invention. Figure 4 As shown, the specific steps include:

[0103] (1) Decompile the kernel source code of the distribution network terminal system using decompilation tools such as IDA pro, Ghidra, and Radare2. Based on the decompilation results, search for target functions, such as open(), read(), write(), fork(), execve(), and malloc(), and obtain the first address of the target function.

[0104] (2) The target function's first address is configured into the distribution network terminal system through a JSON file. The configuration is completed based on an automated tool.

[0105] (3) Repeatedly run the target function, and obtain the legal jump whitelist of the target function by collecting, parsing and monitoring the distribution network terminal system log information. For example, the whitelist is in the form of an address list of 0x11335577, 0x22446688, and 0x12345678;

[0106] (4) The collected legal whitelist information is configured in the distribution network terminal system using a JSON file. The configuration is completed based on an automated tool.

[0107] (5) Modify the target function source code and replace the nop instructions in the source code with HVC instructions. Figure 4 As shown, when modifying the target function source code, the nop instruction of "97f6e9f9 bl<_mcount>" is modified to the hvc instruction of "d4000002 hvc#0x0".

[0108] (6) Call the target function, trigger the HVC exception, pass the corresponding parameter E2 (i.e., control_param) into the general register X0, and execute the exception handler corresponding to the HVC exception entry in the exception vector table. The program reads the parameter value of the general register X0 for parameter matching. The matching value is E2, which triggers the control flow integrity verification.

[0109] (7) When performing control flow integrity verification, read the LR register (connection register) to obtain the source address value of the current jump, compare the value with the legal whitelist information one by one, and determine whether there is a control flow hijacking risk based on the matching results.

[0110] If the verification shows that there is no control flow hijacking risk, it means that this is a legal jump and the system will continue to run; if the verification shows that there is a control flow hijacking risk, it means that this jump is an illegal jump and the system will enter the security protection process to ensure that the system's control flow remains within the legal path.

[0111] like Figure 4 As shown in the figure, when executing control flow integrity verification, the source address value 0x12345678 of the current jump is obtained by reading the LR register (connection register), and the value is compared one by one with the legal whitelist information. Since the address 0x12345678 is registered in the legal whitelist, it can be determined based on the matching result that there is no risk of control flow hijacking, which means that this is a legal jump and the system will continue to run.

[0112] In another optional embodiment, when a mismatch is determined, a control flow hijacking risk is determined to exist, and the current jump is deemed illegal. The process also includes entering a security protection process. The security protection process includes recording the timestamp and context of the current event, and deciding whether to interrupt system operation or continue system operation after isolating the affected portion based on a preset strategy. Furthermore, a prompt warning message may be sent, such as by text message, phone call, or email, to notify the system administrator to promptly address the issue, thereby ensuring that the system's control flow remains within a legitimate path. It is understood that the security protection process may also employ other security protection strategies based on actual needs.

[0113] In another optional embodiment, the legal jump whitelist can be updated regularly to adapt to distribution network terminal system updates or emerging threats, or automated tools can be used to assist in completing the hash value calculation, decompilation, whitelist generation and JSON file configuration processes.

[0114] The present invention discloses a distribution network terminal integrity verification method based on memory access control. The method first modifies the HVC exception entry corresponding to the exception vector table in the distribution network terminal processor so that the HVC exception handler is pointed to. The HVC exception handler is a pre-program for kernel integrity verification or control flow integrity verification. When kernel integrity verification is initiated, kernel integrity calculation is initiated when an HVC exception is triggered by starting the distribution network terminal system. Events generated by the kernel layer and the application layer are monitored during subsequent system operation. When the cumulative value of the event count exceeds a preset threshold, kernel integrity detection is triggered to determine kernel integrity and then perform corresponding operations. When control flow integrity verification is initiated, a target function is repeatedly run to obtain a legal jump whitelist of the target function. After the target function is called to trigger an HVC exception, a system exception handler is executed, control flow integrity verification is initiated, and corresponding operations are performed based on the verification results. The method can comprehensively enhance the defense of the distribution network terminal against malicious attacks or intrusions from the perspectives of kernel integrity and control flow integrity, effectively improve the ability of the distribution network terminal system to prevent malware injection and control flow hijacking attacks, reduce the risks and losses caused by terminal security vulnerabilities, effectively protect core services and key data, and provide information security assurance for the safe and stable operation of the power system.

[0115] This embodiment further provides a computer device, including a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to perform the above method.

[0116] It is understandable that the above method of this embodiment can be executed by a single device, such as a computer or server, etc., and can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of a distributed scenario, one of the multiple devices can only execute one or more steps in the above method of this embodiment, and multiple devices interact to complete the above method. The processor can be implemented in the form of a general-purpose CPU, a microprocessor, an application-specific integrated circuit, or one or more integrated circuits, etc., for executing relevant programs to implement the above method of this embodiment. The memory can be implemented in the form of a read-only memory ROM, a random access memory RAM, a static storage device, and a dynamic storage device. The memory can store an operating system and other application programs. When the above method of this embodiment is implemented by software or firmware, the relevant program code is stored in the memory and called and executed by the processor.

[0117] This embodiment further provides a computer-readable storage medium storing a computer program, which implements the above method when executed by a processor.

[0118] Those skilled in the art will appreciate that the above-mentioned embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, may be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including the instruction device, which implements the function specified in the process. Figure 1 a process or multiple processes and / or boxes Figure 1These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0119] The above description is merely a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Although the present invention has been disclosed above with reference to the preferred embodiment, it is not intended to limit the present invention. Therefore, any simple modifications, equivalent variations, and modifications to the above embodiment that do not depart from the technical solution of the present invention and are based on the technical essence of the present invention shall fall within the scope of protection of the technical solution of the present invention.

Claims

1. A method for verifying the integrity of a distribution network terminal based on memory access control, characterized in that the steps include: Modify the HVC exception entry corresponding to the exception vector table in the distribution network terminal processor so that the corresponding HVC exception handling program is executed; The HVC exception handling program controls the start of kernel integrity verification or control flow integrity verification of the distribution network terminal system according to the parameter value of the general register X0; When starting the kernel integrity verification of the distribution network terminal system, the kernel integrity is verified by comparing the hash value calculated when starting the distribution network terminal system with the hash value calculated when the number of events generated by the kernel layer and the application layer exceeds a preset threshold; Start the control flow integrity verification of the distribution network terminal system by obtaining the legal jump whitelist of the target function and matching the source address value of the current jump with the legal jump whitelist to verify the control flow integrity.

2. The method for verifying the integrity of a distribution network terminal based on memory access control according to claim 1, characterized in that: The HVC exception handling program starts performing kernel integrity verification or control flow integrity verification on the distribution network terminal system according to the general register X0 parameter value, including: Read the parameter value of general register X0 and make a judgment; If the parameter is integrity_param, the kernel integrity of the distribution network terminal system is verified, where integrity_param is the parameter passed to the general register X0 after the distribution network terminal system is started and the HVC exception is triggered; If the parameter is control_param, the control flow integrity of the distribution network terminal system is verified, where control_param is the parameter passed to the general register X0 when the target function is called and the HVC exception is triggered.

3. The method for verifying the integrity of a distribution network terminal based on memory access control according to claim 1, characterized in that: The core integrity verification of the distribution network terminal system includes: When the distribution network terminal system is started, the first hash value startHashValue of the entire kernel code segment is calculated according to the kernel code segment length and the kernel code segment starting address set in the distribution network terminal system configuration file and saved in the trusted execution environment; Monitor events generated by the kernel layer and application layer. When the cumulative number of events exceeds the preset threshold, the kernel integrity check is triggered and the second hash value eventHashValue of the kernel code segment at the current moment is calculated in the trusted execution environment. The second hash value eventHashValue is compared with the first hash value startHashValue. If the comparison is consistent, it is determined that the kernel integrity verification has passed; otherwise, it is determined that the kernel integrity verification has failed.

4. The method for verifying the integrity of a distribution network terminal based on memory access control according to claim 3, characterized in that: The events generated by the kernel layer and the application layer include any one or more events of context switching, system call and interrupt processing.

5. The method for verifying the integrity of a distribution network terminal based on memory access control according to claim 3, characterized in that: The second hash value eventHashValue is compared with the first hash value startHashValue. If the comparison is consistent, the cumulative value of the number of events is cleared. If the comparison is inconsistent, the system operation is interrupted.

6. The method for verifying the integrity of a distribution network terminal based on memory access control according to any one of claims 1 to 5, characterized in that: The control flow integrity verification of the distribution network terminal system includes: Get the target function's legal jump whitelist in advance; After starting the control flow integrity verification, the source address value of the current jump is obtained and matched with the legal jump whitelist. If a match is found, the control flow integrity verification is determined to be passed; otherwise, the control flow integrity verification is determined to be failed.

7. The method for verifying the integrity of a distribution network terminal based on memory access control according to claim 6, characterized in that: The step of obtaining a legal jump whitelist of the target function includes: Decompile the kernel source code of the distribution network terminal system, and search and obtain the first address of the target function based on the decompilation results; Configure the target function's first address into the distribution network terminal system; Repeatedly running the target function and collecting distribution network terminal system log information during the running process for analysis, and obtaining the legal jump whitelist of the target function according to the analysis results; The obtained legal jump whitelist is configured into the distribution network terminal system.

8. The method for verifying the integrity of a distribution network terminal based on memory access control according to claim 6, characterized in that: When it is judged as a mismatch, it is determined that there is a risk of control flow hijacking, the current jump is an illegal jump, and the security protection process is executed. The security protection process includes recording the timestamp and context information of the current event, and deciding whether to interrupt the system operation or isolate the affected part and continue to run the system according to the preset strategy.

9. A computer device comprising a processor and a memory, wherein the memory is used to store a computer program, wherein: The processor is configured to execute the computer program to perform the method according to any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Kernel control flow anomaly detection method based on hardware mechanism

    CN107506638A

  • Power distribution network safety risk assessment method and system based on strategy association

    CN118378891A