A cross-container software operation detection method and system

By using Flush-Reload technology and cache analysis in the cloud computing environment, we can monitor the running status of cross-container software, solve the problem of software running detection in the co-resident state, realize simple and accurate software monitoring and version identification, and improve cloud computing security. sex.

CN113051563BActive Publication Date: 2024-10-01INSTITUTE OF INFORMATION ENGINEERING CHINESE ACADEMY OF SCIENCES
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202110214223.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-25
Publication Date
2024-10-01
Estimated Expiration
2041-02-25

AI Technical Summary

Technical Problem

In a cloud computing environment, it is difficult to monitor the running status of software across containers or virtual machines in a co-resident state, resulting in security issues that need to be resolved. Especially for containers with weak isolation, existing technology is difficult to effectively detect the running status of software and detect the running status of software. Defend against attacks.

Method used

By building an attack container, we analyze the loading of target instructions in the shared cache, use Flush-Reload technology to monitor the loading time of memory lines, determine the read threshold based on performance testing, determine whether the software is loaded from cache or memory, and then monitor the operation of the target software. Condition.

Benefits of technology

It is possible to monitor the running status of software under the same source image without obtaining root permissions of the target container. The operation is simple, reducing the complexity of environment configuration, and provides monitoring address libraries for multiple open source software, reducing user workload and enabling accurate Reports the name and version number of the software in the target container.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113051563B_ABST
    Figure CN113051563B_ABST
Patent Text Reader

Abstract

The present invention discloses a cross-container software operation detection method and system, which belongs to the field of system security technology. An attack container with the same mirror source is constructed according to a target container; the target software to be monitored is selected, the monitoring address and version number of the target software are obtained and stored in a configuration file, and the target software and its configuration file are copied to the attack container; the performance of the server where the target container and the attack container are located is tested, the time of reading memory and reading cache is obtained, and a threshold value η for distinguishing between reading memory and reading cache is determined; the memory line corresponding to the monitoring address of the target software is cleared from all levels of cache, the target software is run after waiting for a period of time, and the time T of reloading to the memory line is recorded. If T>η, it is judged to be read from the memory, and the target software does not read the memory line within the above waiting time; if T<η, it is judged to be read from the cache, and the target software reads the memory line within the above waiting time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of system security technology and relates to a method for detecting software operation, and in particular to a cache-based cross-container software operation detection method and system. Background Art

[0002] In cloud computing environments, instances (an instance is a service unit provided by a cloud service provider to a user, such as a virtual machine, a container, etc.) deployed on the same server and belonging to different users have a low level of trust, which brings many co-resident security issues. Such problems are more obvious for containers with weaker isolation. Therefore, it is necessary to study possible attacks in the co-resident state.

[0003] In the case of co-residence, common software-based vulnerability exploitation attacks or privilege escalation across containers or virtual machines need to target specific software. Many tools commonly used by attackers can also be used as a reference for intrusion detection. It can be seen that the software running status in the target virtual machine or container can provide important information for attack or defense, so it is necessary to study software running detection methods.

[0004] In modern computer architecture, there is usually a cache system that stores recently accessed data to improve the efficiency of subsequent accesses. Generally speaking, cache access is two orders of magnitude faster than memory access, or even more. The typical cache architecture is divided into three levels - L1, L2, and L3. The content that needs to be cached starts from L3 and is stored in smaller and faster cache layers layer by layer. L3 is a layer shared by all CPU cores.

[0005] Cache side-channel attacks are based on the fact that the attacker and the victim share the cache in a physical system (such as a virtualized environment or a cloud environment), which enables the attacker to obtain leaked information by monitoring the usage of the shared cache. The Flush-Reload technique uses this principle to repeatedly refresh the cache and load the target memory line to obtain the execution status of the target program on the memory line. The shared cache of co-resident containers and virtual machines is an important information leakage point. Therefore, this point can be used to detect software operation across containers and virtual machines. With the development of cloud computing, co-resident security issues are receiving more and more attention. At the same time, as a preliminary preparation for many attack methods and intrusion detection methods, methods for obtaining software operation status across containers or virtual machines are becoming more and more important, and this problem needs to be solved urgently. Summary of the invention

[0006] In response to the problem of software operation detection, the present invention proposes a cross-container software operation detection method and system based on shared cache. After analyzing the cache part shared by two containers, the loading status of the target instruction in the cache is extracted to judge the operation status of the target program.

[0007] The technical solution adopted by the present invention is as follows:

[0008] A cross-container software operation detection method, the steps of which include:

[0009] 1) Build an attack environment: Build an attack container with the same image source based on the target container;

[0010] 2) Build a configuration file: Select the target software to be monitored based on the software installed in the shared image source, obtain the monitoring address and version number of the target software, store them in the configuration file, and copy the target software and its configuration file to the attack container;

[0011] 3) Selecting a threshold: Test the performance of the server where the target container and the attack container are located, obtain the time for reading memory and reading cache, and determine the threshold η for distinguishing between reading memory and reading cache;

[0012] 4) Implement monitoring: clear the memory line corresponding to the monitoring address of the target software from all levels of cache, run the target software after waiting for a period of time, and record the time T for reloading to the memory line. If T>η, it is judged as reading from the memory, and the target software did not read the memory line during the above waiting time; if T<η, it is judged as reading from the cache, and the target software read the memory line during the above waiting time.

[0013] Furthermore, the installation location of the corresponding executable file in the container is retrieved according to the name of the target software, the version information of the target software is read, and the version number is parsed from the version information.

[0014] Furthermore, the monitoring address library is searched according to the name and version number of the target software. If the corresponding address is retrieved, it is directly selected as the monitoring address; if the corresponding address is not retrieved, the executable file of the target software is disassembled and analyzed to find the entry function of the software, and the monitoring address is selected according to the entry function.

[0015] Furthermore, the selected monitoring address according to the entry function requires that the selected address meets the following conditions:

[0016] 1) Regardless of the operation performed by the target software, the monitoring address will be accessed during the operation;

[0017] 2) The monitoring address will be executed repeatedly during the operation of the target software;

[0018] 3) When the target software is not running, the server does not load the monitoring address into the cache due to the speculative execution strategy.

[0019] Furthermore, the method for testing server performance is: execute multiple flush+reload combination instructions on the same address, measure the time spent on each reload read, and use it as the time parameter for reading cache lines from the L1 cache on the server; execute flush+reload combination instructions on multiple different addresses, measure the time spent on each reload read, and use it as the time parameter for reading memory lines from the memory on the server; select a threshold η based on the two time parameters to divide whether the reload instruction is read from the cache line or the memory line.

[0020] Furthermore, the flush instruction is executed to clear the memory line corresponding to the monitoring address of the target software from all levels of cache, and when the target software is run after a period of time, the reload instruction is executed to read the memory line.

[0021] Furthermore, the rdtsc instruction is executed to read the timestamp counter to measure the time T to reload into the memory line.

[0022] A cross-container software operation detection system includes a memory and a processor. A computer program is stored on the memory, and the processor implements the steps of the above method when executing the program.

[0023] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.

[0024] The beneficial effects of the present invention are as follows: the method of the present invention does not need to obtain the root permission of the target container, and can monitor the software running status under the same source image as long as it is under the same resident condition. The method is simple to operate and does not require complex environment configuration. In addition, the present invention provides a monitoring address library for multiple commonly used open source software, reducing the workload of users. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 Flowchart of a method for detecting software running across containers based on a shared cache.

[0026] Figure 2 This is a statistical diagram of the time when the CPU reads data from the memory in the test embodiment.

[0027] Figure 3 This is a statistical diagram of the time when the CPU reads data from the cache in the test embodiment. DETAILED DESCRIPTION

[0028] The technical solutions of the present invention in the embodiments will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention:

[0029] The process of a cross-container software running detection method proposed by the present invention is as follows: Figure 1 As shown in the figure. First, create an attack container, which must share a base image with the target container; then copy the target software program and configuration file to be monitored to the attack container; then select the time threshold for distinguishing between reading memory and reading cache; finally, run the target software and compare the time for reading the memory line with the threshold to determine whether the target software has read the cache.

[0030] Among them, give the name of the target software to be monitored, retrieve the installation location of the corresponding executable file in the container according to the name, and parse the version number from the software version information according to the installation location, and then save the installation path and version number into the configuration file. Note that when determining the target software, make sure that the software is installed in the shared image layer.

[0031] Use the obtained software name and version number to search in the provided monitoring address library (the monitoring address library is a text file, each line in the file records a monitoring item, the monitoring item includes the software name, version information and monitoring address, and subsequent users can customize the monitoring address library as needed and add new monitoring items to the library). If the corresponding address is retrieved, it can be directly used and added to the configuration file; if the corresponding address cannot be retrieved, it is necessary to manually disassemble and analyze the executable file of the target software, find the entry function of the software, and select the monitoring address. The selection of the monitoring address follows the following principles: 1) Regardless of the operation performed by the target software, the address must be accessed during the operation process; 2) Try to select the part that will be executed repeatedly during the operation process; 3) If the target software is not running, the server will not load the address into the cache due to strategies such as predictive execution.

[0032] The time threshold is selected by testing the performance of the server. Specifically, the flush+reload combination instruction is executed multiple times for the same address, and the time spent on each reload read is measured as the time reference for reading cache lines from the L1 cache on the server; the flush+reload combination instruction is executed for multiple different addresses, and the time spent on each reload read is measured as the time reference for reading memory lines from the memory on the server. Based on the comprehensive time distribution, a threshold η is selected that can effectively divide the two data read sources of the reload instruction.

[0033] After the configuration preparation is completed, continuous monitoring begins. The present invention uses the flush instruction to clear the memory line corresponding to the monitoring address from all levels of cache, waits for a period of time, and then executes the reload instruction to read the memory line. The present invention uses the rdtsc instruction to read the 64-bit timestamp counter to measure the reading time T, and compares the time T with the threshold η. If T<η, it is determined that the data source of this read is the cache, that is, the target software reads this memory address within the waiting time; otherwise, it is considered that the data source of this read is the memory, that is, the target software did not read this memory address within the waiting time. Furthermore, whether the target software is running can be inferred from whether the monitoring address is read.

[0034] from Figure 1 It can be seen from the process that the present invention can monitor the operation of multiple software at the same time. If you want to monitor multiple software, you only need to fine-tune the monitoring program. In the preparation stage, multiple target software are analyzed and their monitoring addresses are integrated into a configuration file. Figure 1 In the loop body, each address in the file is monitored in rotation.

[0035] A specific implementation method of the present invention is as follows. It is understood that the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0036] In this embodiment, the container uses Docker-ce-18.03.1, the server operating system is Ubuntu-18.04, and the operating system of the target and attack containers is Ubuntu-16.04. In the shared basic image, three common softwares, Apache-1.7.0, Netcat-0.7.1, and Nmap-7.70, are installed.

[0037] In this example, a target container, victim, and an attack container, attacker, are created based on the base image. After testing the performance of the server 10,000 times, the statistical results are as follows: Figure 2 and Figure 3 shown.

[0038] Comprehensive analysis shows that the read time of L1 cache is concentrated between 35-75, and the read time of memory is concentrated above 195. 145 is initially selected as the time threshold for the two cases. The L1 cache read time is less than 145, accounting for 99.98%, and the memory read time is greater than 145, accounting for 95.69%, showing that this threshold can effectively distinguish the two cases. However, the L3 cache is actually used in the detection. According to the Intel manual, it can be inferred that in Intel CPU, the access time of L1 cache is about 33-43 clock cycles shorter than the access time of L3 cache. Finally, 110 was selected as the threshold η to distinguish the two accesses.

[0039] After determining each parameter and configuration, enter the loop monitoring part. In each loop, a certain address is tested once. First, the flush instruction is used to clear the target memory line in all levels of cache, and then the reload instruction is used to reload the memory line. In addition, the rdtsc instruction is used once before and after the reload operation to read the value of the timestamp register. The difference T between the two is used as the basis for measuring the loading time. If T>η, it is determined that the reload operation loaded the target memory line from the memory; if T<η, it is determined that the reload operation loaded the target memory line from the cache, and then the software name, version and current timestamp of the target memory line are reported. In this embodiment, in order to limit Figure 1 The instructions in the loop body are executed serially in the specified order and are not interrupted by other programs. The mfence and lfence instructions are used to serialize the instruction stream.

[0040] The experimental results show that, for the three software in this embodiment, the method of the present invention can accurately report the software name and version number running in the target container.

Claims

1. A method for detecting cross-container software operation, characterized in that: The following steps are involved: 1) Build an attack container with the same image source based on the target container; 2) Select the target software to be monitored based on the software installed in the shared image source, obtain the monitoring address and version number of the target software, store them in the configuration file, and copy the target software and its configuration file to the attack container; wherein, retrieve the installation location of the corresponding executable file in the container according to the name of the target software, read the version information of the target software, and parse the version number from the version information; search in the monitoring address library according to the name and version number of the target software, and if the corresponding address is retrieved, directly select it as the monitoring address; if the corresponding address is not retrieved, disassemble and analyze the executable file of the target software, find the entry function of the software, and select the monitoring address according to the entry function; selecting the monitoring address according to the entry function requires that the selected address meets the following conditions: (1) Regardless of the operation performed by the target software, the monitoring address will be accessed during the operation; (2) The monitoring address will be repeatedly executed during the operation of the target software; (3) When the target software is not running, the server does not load the monitoring address into the cache due to the predictive execution strategy; 3) Test the performance of the server where the target container and the attack container are located, obtain the time for reading memory and reading cache, and determine the threshold η for distinguishing between reading memory and reading cache; the method for testing the performance of the server is: execute multiple flush+reload combination instructions on the same address, measure the time spent on each reload read, and use it as the time parameter for reading cache lines from L1 cache on the server; execute flush+reload combination instructions on multiple different addresses, measure the time spent on each reload read, and use it as the time parameter for reading memory lines from memory on the server; select a threshold η for dividing whether the reload instruction is read from cache lines or memory lines based on the two time parameters; 4) Clear the memory line corresponding to the monitoring address of the target software from all levels of cache, run the target software after waiting for a period of time, and record the time T for reloading to the memory line. If T>η, it is judged as reading from the memory, and the target software did not read the memory line during the above waiting time; if T<η, it is judged as reading from the cache, and the target software read the memory line during the above waiting time.

2. The method according to claim 1, characterized in that Execute the flush instruction to clear the memory line corresponding to the monitoring address of the target software from all levels of cache. After waiting for a period of time, when running the target software, execute the reload instruction to read the memory line.

3. The method according to claim 1, characterized in that Execute the rdtsc instruction to read the timestamp counter to measure the time T to reload into the memory line.

4. A cross-container software operation detection system, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, the steps of the method described in any one of claims 1 to 3 are implemented.

5. A computer-readable storage medium, characterized in that: A computer program is stored, and when the program is executed by a processor, the steps of the method described in any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Software deployment method and device

    CN107770148A

  • Docker-based software large-scale-testing method

    CN108121654A

  • Method for dynamically and randomly defensing Cache attacks

    CN108491694A

  • Method of detecting processor, detection device and detection system

    CN108509791A

  • DDoS malicious code detection and traceability method based on breeding

    CN112261029A