A Cache Side-Channel Attack Defense Method Based on Hybrid Randomized Mapping

By mixing randomized mapping scheme and path skewed cache technology, the problem of difficult balance between performance and security in cache-side channel attack defense is solved, and efficient defense at different cache levels is achieved to adapt to the security and performance requirements of different scenarios.

CN114186226BActive Publication Date: 2025-08-01ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111490515.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-08
Publication Date
2025-08-01
Estimated Expiration
2041-12-08

AI Technical Summary

Technical Problem

The existing cache-side channel attack defense methods are difficult to balance between performance and security, especially the table-based mapping scheme has large storage overhead and insufficient flexibility in computing-based solutions, so it is impossible to effectively defend against cache-side channel attacks.

Method used

A hybrid randomized mapping scheme is adopted, combined with table-based and calculation-based cache randomized mapping, which is used for different cache modules respectively, and a path skewed cache technology is introduced, using virtual index tables and adjustable packet passwords for address mapping to adapt to the characteristics of different cache levels.

Benefits of technology

In the case of small performance losses, it is effective to defend against cache-side channel attacks, cut off the attacker's way to obtain information, adapt to the security and performance requirements of different scenarios, and has high security and good performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114186226B_ABST
    Figure CN114186226B_ABST
Patent Text Reader

Abstract

The present invention designs a cache side-channel attack defense method based on hybrid randomized mapping. This method considers the performance and security requirements of each cache level at different cache hierarchies. It uses table-based randomized mapping in the first-level cache and a computation-based randomized mapping scheme in other-level caches. At the same time, in caches at all levels, the present invention adopts the design of way-skewed cache by utilizing the characteristics of cache set associativity. The present invention has the advantages of high security, good performance, strong scalability, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cache security, and more particularly, to a method for defending against cache side-channel attacks based on hybrid randomized mapping. Background Art

[0002] Side-channel attacks against caches are a common and widespread type of attack, which mainly utilize the changes in memory access time brought about by the cache module and its microarchitecture characteristics. After putting the cache in a specific state, the attacker makes the target program execute critical operations, and then the attacker measures the memory access times at different locations, or measures the overall execution time of the target program, to obtain the execution situation of the target program, and further infer sensitive information. Side-channel attacks against caches have a wide range of impacts. This type of attack can target the first-level cache and gradually extend to the entire cache hierarchy, including the last-level cache, which makes processors in different scenarios, such as desktop devices, mobile devices, and cloud platforms, vulnerable to this type of attack. The harmfulness of this type of attack is also relatively large. The attacker can obtain confidential information such as AES and RSA keys through such attacks to obtain sensitive data of users; it can also bypass protection mechanisms such as address space layout randomization in this way to prepare for further attacks. Due to the universality and harmfulness of this type of attack, it is very necessary to reduce or prevent this type of attack.

[0003] Many defense methods against cache side-channel attacks have been proposed, and their basic principle is to prevent the attacker from accurately measuring and inferring the cache access situation. Among them, the scheme based on cache randomized mapping is a type of scheme that can effectively defend against this type of attack. The main idea of this scheme is to eliminate the fixed mapping of specific data in the cache, making it difficult for the attacker to infer the memory access situation of the victim program, so as to mitigate or even eliminate cache side-channel attacks. The main difference between different cache randomization schemes lies in the selection of the random mapping, which is mainly divided into two ways: table-based mapping and computation-based mapping. The table-based mapping scheme stores the random mapping in a table and needs to look up the table to obtain the cache location every time it accesses. This method achieves low performance overhead and security guarantee at the cost of additional storage. The computation-based mapping scheme does not need to store the random mapping compared with the table-based scheme, but calculates the mapping relationship in the cache according to the address. This scheme is relatively flexible. By selecting different randomization functions and update strategies, this scheme can be applied to caches of different scales and with different latency requirements. Compared with other types of schemes, the scheme based on cache randomization has relatively small performance overhead, and its effectiveness has also been relatively fully verified. Summary of the Invention

[0004] The object of the present invention is to provide a defense method against cache side-channel attacks based on hybrid randomized mapping for the problem of cache side-channel attacks.

[0005] The object of the present invention is achieved by the following technical solutions:

[0006] The present invention discloses a defense method against cache side-channel attacks based on hybrid randomized mapping, including the following steps:

[0007] 1) Construct a system including a central processing unit, a cache system, a memory, etc., and the cache system includes a first-level cache module and a second-level cache module;

[0008] 2) The first-level cache uses a cache randomized mapping scheme based on a table;

[0009] 3) For the second-level cache module and other modules in the cache system, a cache randomized mapping scheme based on computation is used;

[0010] 4) Based on the cache set-associative design in all cache modules, the design of way-skewed cache is used.

[0011] As a further improvement, the cache randomized mapping scheme based on a table in step 2) of the present invention includes the following steps:

[0012] 2-1) Construct a virtual index table, each item in the table stores a virtual index, the bit width of which is greater than the bit width of the physical index, and the number of items in the table is the same as the number of cache blocks;

[0013] 2-2) In the system initialization stage, a key is randomly generated for the hash operation in the randomized mapping;

[0014] 2-3) When mapping the cache address, perform a hash operation on the valid bits in the address except the offset bits, and a randomly generated key is included in the hash operation to obtain a virtual index address;

[0015] 2-4) Match the virtual index address obtained in 2-3) with each item in the virtual index table. If there is a match, it is a cache hit, and the index address of this item in the virtual index table is the physical index address for accessing the cache storage. If there is no matching item, a physical index address is randomly selected and added to the virtual index table.

[0016] As a further improvement, the cache randomized mapping scheme based on computation in step 3) of the present invention uses an adjustable block cipher to map the cache access address, where the encryption key is the randomly generated key at initialization, the plaintext for encryption is the valid bits in the access address except the offset bits, and the adjustment handle is zero.

[0017] As a further improvement, the middle path skew caching technology described in step 4) of the present invention is applicable to all modules in the caching system. For each path in the cache, different virtual index tables and keys are applied in the table-based cache randomization mapping scheme in step 2), and different keys are applied in the computation-based cache randomization mapping scheme in step 3).

[0018] Advantages of the present invention:

[0019] Aiming at the cache side-channel attack problem, the present invention comprehensively considers the cache hierarchy and proposes a hybrid randomization mapping scheme for different cache modules according to the performance, storage and other requirements of different cache modules to resist cache side-channel attacks.

[0020] Generally speaking, the present invention realizes the protection against cache side-channel attacks with a relatively small performance loss. In terms of security, the present invention cuts off the fixed mapping of the cache index used in the attack in principle, making it impossible for the attacker to obtain effective information within a reasonable time. At the same time, protection measures are adopted for all modules in the entire cache system, and the characteristics and interaction relationships of each module are considered. In terms of performance, the cache randomization method in the present invention can be adjusted according to the security and performance requirements in different scenarios, and the computational overhead brought by the present invention can be integrated with the existing cache design to reduce the overhead. Therefore, the performance overhead brought by the present invention is relatively small in general. From the perspective of resources, the present invention needs to introduce additional storage modules and computational modules, and the additional resource consumption is also necessary to ensure security. From the perspective of testing and analysis, the present invention is not only feasible, but also has the advantages of high security, good performance, strong scalability, etc. Description of the drawings

[0021] Figure 1 It is a schematic diagram of the table-based cache randomization mapping applied to the first-level cache;

[0022] Figure 2 It is a schematic diagram of the computation-based cache randomization mapping applied to the cache system except the first-level cache;

[0023] Figure 3 It is a schematic diagram of the path skew cache. Detailed implementation manners

[0024] The system model targeted by the present invention includes a system composed of a central processing unit, a cache system, a memory, etc., where the cache system includes modules such as a first-level cache and a second-level cache. At the same time, the present invention is also applicable to other similar systems. In the cache system, the first-level cache uses a table-based cache randomization mapping scheme; other modules in the cache system except the first-level cache, including the second-level cache, etc., use a computation-based cache randomization mapping scheme; in all cache modules, based on the cache set-associative design, a way-skewed cache design is used. The overall architecture of the present invention will be described below with reference to the accompanying drawings of the specification.

[0025] The cache side-channel attack defense method based on hybrid randomization mapping of the present invention uses a table-based cache randomization mapping scheme in the first-level cache. In a traditional cache, n bits in the access address are used as an index, corresponding to 2 n cache sets in the cache. The present invention uses n + k bits as an index, that is, a cache conceptually having 2 n+k cache sets is physically mapped to 2 n physical cache sets, and a mapping table is used to save this mapping. Figure 1 is a schematic diagram of the table-based cache randomization mapping applied to the first-level cache; it shows the design of the randomization function. In this design, there are 2 n row number registers, and each row number register stores the n + k-bit logical index corresponding to the physical index position. During a cache access process, the access address is first converted into a logical index through a hash function. The hash function performs a hash operation on the valid bits in the access address except the offset bits and also includes a key generated during the initialization process. The generated logical index is compared with each item in the row number register. If there is a match, it means that the index of the row number register is the corresponding physical index. In this way, the n + k-bit logical index is mapped to an n-bit physical index through the row number register. Then, the cache obtains the corresponding metadata and data according to the physical index, compares the tag in the address with the tag of the metadata to determine whether there is a hit, and performs the same subsequent operations as in a traditional cache. If there is no corresponding physical index in the row number register, a random index will be assigned. In the subsequent process, if replacement is needed, the logical index in the corresponding row number register will be updated, and a pre-increment operation will be performed if necessary.

[0026] The cache side-channel attack defense method based on hybrid randomization mapping of the present invention applies a computation-based cache randomization mapping scheme to cache modules other than the first-level cache module. Figure 2It is a schematic diagram of cache randomization mapping based on computation applied in a cache system other than the first-level cache. When calculating the index of the access address, this scheme uses an adjustable block cipher to map the cache access address to generate the corresponding physical index address. Among them, the encryption key is a random key generated during initialization, the plaintext for encryption is the valid bits in the access address except for the offset bits, and the adjustment handle is zero.

[0027] For the cache side-channel attack defense method based on hybrid randomization mapping of the present invention, the way-skewed cache technology is applicable to all modules in the cache system. Figure 3 It is a schematic diagram of way-skewed cache. When each way in the cache applies a randomization function, the randomization mappings of different ways may be different. In a cache request, the logical index will be mapped through multiple different randomization functions to obtain different physical indexes. If there is no corresponding physical index for the corresponding way, different physical indexes will be randomly allocated. When the cache needs to be replaced, the cache will randomly select one of multiple ways for replacement.

[0028] Those of ordinary skill in the art can understand that the above is only a single instance of the invention and is not used to limit the invention. Although the invention has been described in detail with reference to the foregoing instances, for those skilled in the art, they can still modify the technical solutions described in the foregoing instances or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, etc. made within the spirit and principle of the invention shall be included within the protection scope of the invention.

Claims

1. A cache side-channel attack defense method based on hybrid randomization mapping, characterized in that, Including the following steps: 1) Construct a system including a central processing unit, a cache system, a memory, etc., and the cache system includes a first-level cache module and a second-level cache module; 2) The first-level cache uses a table-based cache randomization mapping scheme; 3) The second-level cache module and other modules in the cache system use a computation-based cache randomization mapping scheme; 4) Based on the cache set-associative design in all cache modules, use the way-skewed cache design; The table-based cache randomization mapping scheme in step 2) includes the following steps: 2-1) Construct a virtual index table, each item in the table stores a virtual index, the bit width of which is greater than the bit width of the physical index, and the number of items in the table is the same as the number of cache blocks; 2-2) In the system initialization stage, randomly generate a key for the hash operation in the randomization mapping; 2-3) When mapping the cache address, perform a hash operation on the valid bits in the address except the offset bits, and the hash operation includes a randomly generated key to obtain a virtual index address; 2-4) Match the virtual index address obtained in 2-3) with each item in the virtual index table. If there is a match, it is a cache hit, and the index address of this item in the virtual index table is the physical index address for accessing the cache storage. If there is no matching item, randomly select a physical index address and add it to the virtual index table; The computation-based cache randomization mapping scheme in step 3) uses an adjustable block cipher to map the cache access address. Among them, the encryption key is the randomly generated key at initialization, the plaintext for encryption is the valid bits in the access address except the offset bits, and the adjustment handle is zero.

2. The cache side-channel attack defense method based on hybrid randomization mapping according to claim 1, wherein, The way-skewed cache technology in step 4) is applicable to all modules in the cache system. For each way in the cache, different virtual index tables and keys are applied in the table-based cache randomization mapping scheme in step 2), and different keys are applied in the computation-based cache randomization mapping scheme in step 3).

Citation Information

Patent Citations

  • A tweakable encrypion mode for memory encryption with protection against replay attacks

    CN103109296A

  • Cache side channel attack defense method based on local random mapping

    CN110442469A