# 瞬态执行CPU漏洞

瞬态执行CPU漏洞是一种硬件安全弱点：处理器会推测执行或乱序执行某些指令，这些指令的结果随后被丢弃，但它们对CPU微架构状态（如缓存）的、依赖于秘密的影响却可以被攻击者测量，从而恢复这些指令本不应触及的数据。2018年1月[Spectre](https://www.edgepedia.org/zh/spectre-security-vulnerability)和Meltdown的披露使这一类漏洞受到广泛关注，此后它已发展为一个庞大的、有命名的攻击与变种家族。<sup>[1](https://arxiv.org/abs/2005.13435)</sup><sup> • </sup><sup>[2](https://www.usenix.org/system/files/sec19-canella.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 首次公开披露 | Spectre与Meltdown，2018年1月<sup>[1](https://arxiv.org/abs/2005.13435)</sup> |
| 核心机制 | 异常或分支预测错误事件在CPU微架构状态中留下依赖于秘密的痕迹，尽管架构层面的结果已被丢弃<sup>[2](https://www.usenix.org/system/files/sec19-canella.pdf)</sup> |
| 原始CVE | 变种1（CVE-2017-5753）、变种2（CVE-2017-5715）、变种3（CVE-2017-5754）、变种3a（CVE-2018-3640）、变种4（CVE-2018-3639）<sup>[3](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/sysadmin-guidance-transient-execution-side-channel.html)</sup> |
| 受影响厂商 | 包括英特尔、AMD和ARM等；针对三家处理器的概念验证攻击均已得到演示<sup>[2](https://www.usenix.org/system/files/sec19-canella.pdf)</sup> |
| 攻击阶段 | 预置、秘密访问和传输，其中秘密被编码进非瞬态微架构状态，随后在架构层面被恢复<sup>[4](https://www.usenix.org/system/files/usenixsecurity25-de-faveri-tron.pdf)</sup> |
| 真实世界利用 | 截至2025年5月，英特尔表示尚未发现任何针对瞬态执行漏洞的真实世界利用<sup>[5](https://www.intel.com/content/www/us/en/security-center/announcement/intel-security-announcement-2025-05-13-001.html)</sup> |

## 攻击原理

现代处理器使用推测执行、乱序执行及相关优化来提升性能，执行的工作若预测有误则可能随后被丢弃。<sup>[6](https://cdn.kernel.org/doc/html/latest/staging/speculation.html)</sup>通常，这些被丢弃的工作无法在架构状态——即软件所能看到的寄存器和内存内容——中被观察到。然而，瞬态指令可以在微架构状态中留下痕迹，例如哪些缓存行持有数据，而这些痕迹在推测被回滚后依然存在。<sup>[6](https://cdn.kernel.org/doc/html/latest/staging/speculation.html)</sup><sup> • </sup><sup>[2](https://www.usenix.org/system/files/sec19-canella.pdf)</sup>

因此，一次攻击分为三个阶段。在预置步骤中，攻击者将微架构布置成易受攻击的状态；在秘密访问步骤中，CPU因该预置而瞬态访问秘密数据；在传输步骤中，秘密被编码进非瞬态微架构状态（例如缓存），随后被攻击者恢复为架构层面的值。<sup>[4](https://www.usenix.org/system/files/usenixsecurity25-de-faveri-tron.pdf)</sup>编码步骤通常被称为泄露小工具，即一段充当受害者内存或寄存器内容隐蔽信道发射器的指令序列。<sup>[7](https://nsarchive.gwu.edu/themes/custom/nsarchive/templates/pdfjs/web/viewer.html?file=https%3A%2F%2Fnsarchive.gwu.edu%2Fsites%2Fdefault%2Ffiles%2Fdocuments%2F4345434%2FMeltdown-Attack-Spectre-2017-Unclassified-spectre.pdf)</sup>

一般而言，这些攻击要求攻击者在目标数据所在的同一台机器或同一个虚拟机上运行代码，而攻击者并无直接访问该数据的权限。<sup>[8](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/branch-history-injection.html?countrylabel=Asia+Pacific)</sup>

## Spectre与Meltdown

这两个奠基性攻击以“什么制造了瞬态窗口”为界线划分了整个领域。<sup>[9](https://www.usenix.org/system/files/usenixsecurity23-de-meulemeester.pdf)</sup>

**Spectre**利用预测机制。攻击者错误训练分支预测器，使受害者推测执行一条在架构层面本不会走的代码路径。在经典的边界检查绕过中，CPU错误预测一个条件分支并推测加载一个越界数组元素；该值被丢弃，但依赖的内存访问留下了可测量的缓存状态，当多个依赖访问被串联起来时，便提供了任意读取原语。<sup>[6](https://cdn.kernel.org/doc/html/latest/staging/speculation.html)</sup>原始论文表明，推测执行违反了操作系统进程隔离、容器化、[即时编译](https://www.edgepedia.org/zh/just-in-time-compilation)以及缓存计时攻击对策背后的安全假设，并演示了一个[JavaScript](https://www.edgepedia.org/zh/javascript)程序读取运行它的浏览器进程地址空间中的数据。<sup>[10](https://arxiv.org/abs/1801.01203)</sup><sup> • </sup><sup>[7](https://nsarchive.gwu.edu/themes/custom/nsarchive/templates/pdfjs/web/viewer.html?file=https%3A%2F%2Fnsarchive.gwu.edu%2Fsites%2Fdefault%2Ffiles%2Fdocuments%2F4345434%2FMeltdown-Attack-Spectre-2017-Unclassified-spectre.pdf)</sup>

**Meltdown**利用出错指令。它利用乱序执行的副作用从用户空间读取任意内核内存位置，包括个人数据和密码，不依赖任何软件漏洞，也与操作系统无关。在受影响的系统上，它破坏了地址空间隔离和半虚拟化环境的安全保证。<sup>[11](https://www.usenix.org/conference/usenixsecurity18/presentation/lipp)</sup>

厂商后来分配了变种编号和CVE标识符：变种1为边界检查绕过（CVE-2017-5753），变种2为分支目标注入（CVE-2017-5715），变种3为恶意数据缓存加载（CVE-2017-5754），变种3a为恶意系统寄存器读取（CVE-2018-3640），变种4为推测存储绕过（CVE-2018-3639），变种1.1即边界检查绕过存储则为CVE-2018-3693。<sup>[3](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/sysadmin-guidance-transient-execution-side-channel.html)</sup>

## 后续变种

2018年之后，该家族迅速壮大。2019年，格拉茨技术大学、鲁汶大学和威廉与玛丽学院的学者进行的一项系统化研究识别出六种此前未被注意的攻击，其中包括两种新近被证明可利用的Meltdown效应——影响英特尔的Meltdown-PK（保护密钥绕过）和同时影响英特尔与AMD的Meltdown-BND（边界检查绕过）——以及四种此前未被描述过的Spectre错误训练策略。<sup>[12](https://www.usenix.org/conference/usenixsecurity19/presentation/canella)</sup>2019年5月，一类基于Meltdown的、名为微架构数据采样（MDS）的攻击被披露。<sup>[13](https://www.usenix.org/system/files/sec20-moghimi-medusa.pdf)</sup>

分支预测攻击持续出现。英特尔的Branch History Injection（CVE-2022-0001）和Intra-mode Branch Target Injection（CVE-2022-0002），CVSS评分均为4.7（中等），允许攻击者跨安全上下文转换操纵分支历史，使间接分支推测性地选择攻击者选定的预测器条目。<sup>[14](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/branch-history-injection.html)</sup>AMD披露了Branch Type Confusion（CVE-2022-23825）和Retbleed（CVE-2022-29900），其中被错误训练的返回指令预测在特定微架构相关条件下允许任意推测性代码执行。<sup>[15](https://www.amd.com/en/resources/product-security/bulletin/amd-sb-1037.html)</sup>2023年，Inception攻击（CVE-2023-20569）影响了AMD Zen 3和[Zen 4](https://www.edgepedia.org/zh/zen-4)处理器上的返回地址预测，需要微码或BIOS更新；AMD评估其仅可本地利用，例如通过下载的恶意软件。<sup>[16](https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7005.html)</sup>AMD的2025年瞬态调度器攻击公告（CVE-2024-36350、CVE-2024-36357、CVE-2024-36348和CVE-2024-36349）涵盖了在特定微架构条件下通过指令执行时序造成的泄露。<sup>[17](https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7029.html)</sup>这一类攻击并不局限于x86：2025年针对苹果M3 CPU的FLOP攻击利用了错误的加载输出预测，在[Safari](https://www.edgepedia.org/zh/safari-web-browser)和Chrome浏览器内获得了64位读取原语。<sup>[18](https://www.usenix.org/system/files/usenixsecurity25-kim-jason.pdf)</sup>

## 缓解措施

防御在硬件、微码、操作系统和应用层面展开，没有任何单一层面足以应对所有变种。<sup>[12](https://www.usenix.org/conference/usenixsecurity19/presentation/canella)</sup>

**硬件与微码。** 英特尔引入了间接分支控制机制，即处理器与系统软件之间的新接口，让操作系统能够阻止攻击者控制受害者的间接分支预测，例如在适当时机使预测器失效。<sup>[19](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/speculative-execution-side-channel-mitigations.html)</sup>对于变种3，缓解措施是操作系统更新，在Linux上实施KPTI（内核页表隔离），在Windows上实施KVA Shadow；变种2需要微码和操作系统更新来限制对间接分支的推测；变种4需要微码禁用存储转发技术。<sup>[3](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/sysadmin-guidance-transient-execution-side-channel.html)</sup>

**操作系统。** Linux内核使用retpolines（返回蹦床，用于替换间接调用和跳转）和增强型IBRS来防止消费恶意客户机留下的被污染的 Branch Target Buffer 条目，并通过sysfs暴露各变种的缓解状态。<sup>[20](https://kernel.org/doc/html/v5.11/admin-guide/hw-vuln/spectre.html)</sup>对于边界检查绕过，它提供了`array_index_nospec()`辅助函数，即使在推测执行下也能返回被净化到[0, size)范围内的索引。<sup>[6](https://cdn.kernel.org/doc/html/latest/staging/speculation.html)</sup>内核命令行选项如`nospectre_v1`、`nospectre_v2`和`spectre_bhi`可控制或禁用缓解措施。<sup>[21](https://docs.kernel.org/admin-guide/hw-vuln/spectre.html)</sup>

**软件。** 开发者可以在危险模式之前插入推测屏障以串行化执行，也可以重构应用使敏感信息在推测执行期间不可访问，例如将每个Web源隔离到独立的浏览器进程中。微软的C++编译器在[Visual Studio](https://www.edgepedia.org/zh/visual-studio) 2017版本15.5.5中增加了`/Qspectre`开关，作为针对与CVE-2017-5753相关的一组有限易受攻击模式的编译期缓解措施。<sup>[22](https://learn.microsoft.com/en-us/cpp/security/developer-guidance-speculative-execution?view=msvc-170)</sup>

2019年的系统化研究发现，大多数防御措施——包括已部署的——无法完全缓解所有攻击变种，部分原因是许多防御针对的是特定的隐蔽信道，而非泄露的微架构根因。<sup>[12](https://www.usenix.org/conference/usenixsecurity19/presentation/canella)</sup>一种设计回应是未映射推测契约，即观察到未在页表中映射的内存无法通过瞬态执行泄露；基于此思想构建的Ward内核为每个进程维护独立的内核页表，以降低缓解开销。<sup>[23](https://www.usenix.org/conference/osdi20/presentation/behrens)</sup>

## 物理侧信道

瞬态执行攻击此前依赖软件可观测的信道，如缓存计时或端口争用，这暗示关闭这些信道就能关闭攻击。SpectrEM（USENIX Security 2023）表明并非如此：通过测量处理器在瞬态窗口期间产生的电磁辐射，研究人员从Arm Cortex-A72中以高达每秒366比特的速度提取秘密比特，误码率低至0.008%，并将其描述为物理瞬态执行攻击的首次实际演示。该攻击假设存在物理对手，但并不从根本上要求在设备上执行代码。<sup>[24](https://www.usenix.org/conference/usenixsecurity23/presentation/de-meulemeester)</sup>

## 影响与披露实践

2018年的披露引发了英特尔所称的行业范围内硬件安全研究方式的转变，厂商现在会针对每个新问题发布统一的受影响处理器列表、微码更新和软件安全指南。<sup>[25](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/resources/enabling-secure-development-with-guidance.html)</sup><sup> • </sup><sup>[26](https://www.intel.com/content/www/us/en/developer/topic-technology/software-security-guidance/processors-affected-consolidated-product-cpu-model.html)</sup>英特尔已多次表示尚未发现任何针对瞬态执行漏洞的真实世界利用，最近一次是在2025年5月，当时它回应了Branch Privilege Injection——[苏黎世联邦理工学院](https://www.edgepedia.org/zh/eth-zurich)的研究，该研究通过分支预测器竞态条件攻破了Spectre v2硬件缓解措施。<sup>[5](https://www.intel.com/content/www/us/en/security-center/announcement/intel-security-announcement-2025-05-13-001.html)</sup>英特尔还推动使用更精确的术语，指出将新问题描述为“类Spectre”或“类Meltdown”可能导致对其运作方式或影响的误解，并区分域内、跨域和域绕过披露变种。<sup>[27](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/refined-speculative-execution-terminology.html)</sup>

## References

1. [Survey of Transient Execution Attacks (Xiong & Szefer, arXiv 2020)](https://arxiv.org/abs/2005.13435)
2. [A Systematic Evaluation of Transient Execution Attacks and Defenses (Canella et al., USENIX Security 2019, PDF)](https://www.usenix.org/system/files/sec19-canella.pdf)
3. [Guidance for System Administrators to Mitigate Transient Execution Side Channel Issues (Intel)](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/sysadmin-guidance-transient-execution-side-channel.html)
4. [End-to-end transient execution attack phases (De Faveri Tron et al., USENIX Security 2025, PDF)](https://www.usenix.org/system/files/usenixsecurity25-de-faveri-tron.pdf)
5. [Branch Privilege Injection, Intel Security Announcement INTEL-2025-05-13-001](https://www.intel.com/content/www/us/en/security-center/announcement/intel-security-announcement-2025-05-13-001.html)
6. [Speculation, The Linux Kernel documentation](https://cdn.kernel.org/doc/html/latest/staging/speculation.html)
7. [Spectre paper (Kocher et al., 2018, PDF copy)](https://nsarchive.gwu.edu/themes/custom/nsarchive/templates/pdfjs/web/viewer.html?file=https%3A%2F%2Fnsarchive.gwu.edu%2Fsites%2Fdefault%2Ffiles%2Fdocuments%2F4345434%2FMeltdown-Attack-Spectre-2017-Unclassified-spectre.pdf)
8. [branch history injection and intra-mode branch target injection](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/branch-history-injection.html?countrylabel=Asia+Pacific)
9. [spectrem:exploiting electromagnetic emanations during transient execution](https://www.usenix.org/system/files/usenixsecurity23-de-meulemeester.pdf)
10. [Spectre Attacks: Exploiting Speculative Execution (arXiv 1801.01203)](https://arxiv.org/abs/1801.01203)
11. [Meltdown: Reading Kernel Memory from User Space (Lipp et al., USENIX Security 2018)](https://www.usenix.org/conference/usenixsecurity18/presentation/lipp)
12. [A Systematic Evaluation of Transient Execution Attacks and Defenses (USENIX Security 2019, presentation page)](https://www.usenix.org/conference/usenixsecurity19/presentation/canella)
13. [Medusa: Microarchitectural Data Leakage via Automated Attack Synthesis (Moghimi et al., USENIX Security 2020, PDF)](https://www.usenix.org/system/files/sec20-moghimi-medusa.pdf)
14. [Branch History Injection and Intra-mode Branch Target Injection / INTEL-SA-00598 (Intel)](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/branch-history-injection.html)
15. [AMD CPU Branch Type Confusion, AMD-SB-1037](https://www.amd.com/en/resources/product-security/bulletin/amd-sb-1037.html)
16. [Return Address Security Bulletin (Inception), AMD-SB-7005](https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7005.html)
17. [AMD Transient Scheduler Attacks, AMD-SB-7029](https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7029.html)
18. [FLOP: Breaking the Apple M3 CPU via False Load Output Predictions (Kim et al., USENIX Security 2025, PDF)](https://www.usenix.org/system/files/usenixsecurity25-kim-jason.pdf)
19. [Speculative Execution Side Channel Mitigations (Intel)](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/speculative-execution-side-channel-mitigations.html)
20. [Spectre Side Channels, Linux kernel admin guide v5.11](https://kernel.org/doc/html/v5.11/admin-guide/hw-vuln/spectre.html)
21. [Spectre Side Channels, Linux kernel admin guide (current)](https://docs.kernel.org/admin-guide/hw-vuln/spectre.html)
22. [C++ Developer Guidance for Speculative Execution Side Channels (Microsoft Learn)](https://learn.microsoft.com/en-us/cpp/security/developer-guidance-speculative-execution?view=msvc-170)
23. [Efficiently Mitigating Transient Execution Attacks using the Unmapped Speculation Contract (Behrens et al., OSDI 2020)](https://www.usenix.org/conference/osdi20/presentation/behrens)
24. [SpectrEM: Exploiting Electromagnetic Emanations During Transient Execution (De Meulemeester et al., USENIX Security 2023)](https://www.usenix.org/conference/usenixsecurity23/presentation/de-meulemeester)
25. [Enabling Secure Development with Disclosure and Feature Guidance (Intel)](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/resources/enabling-secure-development-with-guidance.html)
26. [Affected Processors: Transient Execution Attacks & Related Security Issues (Intel)](https://www.intel.com/content/www/us/en/developer/topic-technology/software-security-guidance/processors-affected-consolidated-product-cpu-model.html)
27. [Refined Speculative Execution Terminology (Intel)](https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/refined-speculative-execution-terminology.html)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 计算机硬件 › Processors & processor engineering › Microarchitecture & implementation › Intel microarchitectures

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/transient-execution-cpu-vulnerability

English original: https://www.edgepedia.org/transient-execution-cpu-vulnerability
