[備忘録]cert.orgのmeltdown spectreを和訳してみた | urchinheadのブログ

Vulnerability Note VU#584653 (09 Jan 2018)
https://www.kb.cert.org/vuls/id/584653 

CPU hardware vulnerable to side-channel attack

脆弱性ノート VU#584653
CPUハードウェアはサイドチャネルアタックに脆弱



Overview

CPU hardware implementations are vulnerable to cache side-channel attacks. These vulnerabilities are referred to as Meltdown and Spectre.

```
概要

CPUハードウェア実装はキャッシュサイドチャネルアタックに対して脆弱である。これらの脆弱性は”メルトダウン”と”スペクター”と呼ばれている。

```

Description

Note: This Vulnerability Note is the product of ongoing analysis and represents our best knowledge as of the most recent revision. As a result, the content may change as our understanding of the issues develops.

```
記述
注意:この脆弱性ノートは現在進行形の記事であり、最新のリビジョン元にベストの情報を提供するものである。その結果、課題に対する我々の理解が進むと、内容を変更するかもしれない。

```

CPU hardware implementations are vulnerable to side-channel attacks referred to as Meltdown and Spectre. Both Spectre and Meltdown take advantage of the ability to extract information from instructions that have executed on a CPU using the CPU cache as a side-channel. These attacks are described in detail by Google Project Zero, the Institute of Applied Information Processing and Communications (IAIK) at Graz University of Technology (TU Graz) and Anders Fogh. The issues are organized into three variants:

 - Variant 1 (CVE-2017-5753, Spectre): Bounds check bypass
 - Variant 2 (CVE-2017-5715, also Spectre): Branch target injection
 - Variant 3 (CVE-2017-5754, Meltdown): Rogue data cache load, memory access permission check performed after kernel memory read


```
CPUハードウェア実装はキャッシュのサイドチャネルアタックに対して脆弱である。これらの脆弱性は”メルトダウン”と”スペクター”と言われている。スペクターとメルトダウンの両者とも、サイドチャネルと呼ばれるCPUキャッシュ機能を利用しているCPU上の命令を使って情報を引き出している。これらの攻撃はGoole Project Zeroのグラッツ工科大学(TU Granz)のアプリケーションプロセス アンド コミュニケーションズ(IAIK)とアンダーズ・フォー氏により詳細が報告されている。この問題は3種類の変種によって構成されている。
 - 変種 1 (CVE-2017-5753, Spectre): 境界チェック回避
 - 変種 2 (CVE-2017-5715, also Spectre): 分岐ターゲット挿入
 - 変種 3 (CVE-2017-5754, Meltdown): 不正データキャッシュ読込み カーネルメモリ読込み後のメモリアクセス権限チェックの実施

```


 Spectre

Spectre attacks take advantage of a CPU's branch prediction capabilities. Modern CPUs include a feature called branch prediction, which speculatively executes instructions at a location that the CPU believes it will branch to. Such speculative execution helps to more fully utilize the parts of the CPU, minimizing the time waiting, and therefore improving performance. When a branch is successfully predicted, instructions will retire, which means the outcomes of the instructions such as register and memory writes will be committed. If a branch is mispredicted, the speculatively-executed instructions will be discarded, and the direct side-effects of the instructions are undone. What is not undone are the indirect side-effects, such as CPU cache changes. By measuring latency of memory access operations, the cache can be used to extract values from speculatively-executed instructions.

```
スペクター  

スペクター攻撃はCPUの分岐予測機能を利用している。近年のCPUは分岐予測と呼ばれる機能を具備している。これは、CPUが"処理分岐する"と確信した時点で、投機的に(推測的に)命令を実行する機能である。このような投機的命令はCPUの一部をより効果的に利用するのに役に立つ。 これは、待ち時間の最小化やその結果としてパフォーマンスの改善に効果的である。分岐予測が成功した時に命令は終了する。つまり、レジスターやメモリ書き込みのような命令の結果が引き渡しされることを意味する。もし、分岐予測が外れた場合、投機的実行命令は廃棄され、命令の直接的な副作用は取り消される。CPUキャッシュの変更など間接的な副作用は取り消されない。メモリアクセス操作の時間差を計測することで、そのキャッシュ内容は投機的実行命令によりその値を利用することができる。


```


With Spectre variant 1 (CVE-2017-5753), the instructions after a conditional branch are speculatively executed as the result of a misprediction. With Spectre variant 2 (CVE-2017-5715), the CPU executes instructions at a location determined by a mispredicted branch target.

```
スペクター変種1(CVE-2017-5753)では、状態分岐後の命令は投機的に不成立予測結果として実行される。スペクター変種2(CVE-2017-5715)では、CPUは分岐ターゲットの予測が外れたと判断した時点で命令を実行する。
```

With both variants of the Spectre attack, the impact is that a process may leak sensitive data to other processes on a system. Spectre may also allow one part of an application to access other parts of the same process memory space that would otherwise not be permitted.

```
スペクター攻撃のどちらの変種においても、あるプロセスがシステム上の他のプロセスの重要なデータを漏洩するかもしれないという影響がある。また、スペクターはアプリケーションのある部分で、同じプロセスの許可されていない他のパートのメモリ空間にアクセスできるかもしれない。
```


While the Spectre attack itself does not cross a user/kernel memory privilege boundary, depending on the configuration of the target platform, the Spectre attack may indirectly allow a user-space application to access kernel memory. For example, the Project Zero blog post describes a scenario that uses eBPF to exfiltrate kernel memory contents into user-space code. This is made possible because eBPF JIT allows for userspace applications to inject code that is executed in kernel space. While this code is verified by the kernel, eBPF-compliant code will be allowed to execute with kernel permissions. The exploit described by Project Zero leverages eBPF to execute the Spectre attack in kernel space, while exfiltrating the data to user space. It is possible that other technologies that allow in-kernel code execution may also possibly be leveraged to leak kernel memory using Spectre.

```
スペクター攻撃それ自体はユーザー/カーネルのメモリ権限境界を越えないが、対象プラットフォームの設定に依存するものの、ユーザー空間アプリケーションに間接的にカーネルメモリにアクセスするための許可を与えるかもしれない。たとえば、the Project Zero blog ではユーザー空間コード内でカーネルメモリ内容を抽出するためにeBPF(expanded Barkeley Packet filter)を利用するシナリオを投稿している。これはeBPFの JIT(Just-in-Time) コンパイラがユーザ空間アプリケーションに、カーネル空間で実行するコードの挿入の許可を可能としていることによる。このコードはカーネルによってチェックされているが、eBPF準拠コードがカーネル権限で実行許可されるであろう。Project Zeroによって記述されているエクスプロイトは、ユーザー空間からデータを抽出すると同時に、カーネル空間内でスペクター攻撃を実行するためにeBPFを活用している。これは、カーネル内で実行することを許可する技術が、スペクターを利用してカーネルメモリを漏洩することに活用されることを可能としている。
```

### Meltdown

 Meltdown is related to the Spectre attack in that it also uses a cache side channel to access data that otherwise wouldn't be available. The main difference is that it leverages out-of-order execution capabilities in modern CPUs. Like speculative execution due to branch prediction, as used by Spectre, out-of-order execution on a CPU is a technique for ensuring fullest utilization of the CPU's parts. Although instructions may appear sequentially in the machine language, a CPU that supports out-of-order execution may execute instructions in a non-sequential manner, which can minimize the time that a CPU spends idle.


```
 メルトダウンはスペクター攻撃と関連している。それは別の方法で利用できないデータに、アクセスするためにキャッシュサイドチャネルを利用する。スペクターとの主な違いは、メルトダウンは近年のCPUに具備されているout-of-order実行機能を利用することである。スペクターが利用する分岐予測を目的とする投機的実行のように、CPUのout-of-order実行機能はCPUの機能を最大限に活用することを確保する技術である。命令文はマシン語の中で逐次的出現するが、out-of-order実行をサポートするCPUは、非逐次的方法に命令を実行する。これは、CPUのアイドル時間を最小下にすることが可能となる。
```

 Meltdown leverages insecure behavior that has been demonstrated in Intel CPUs and may affect CPUs from other vendors. Vulnerable CPUs allow memory reads in out-of-order instruction execution, and also contain a race condition between the raising of exceptions and the out-of-order instruction execution. The Meltdown attack reads a kernel memory value, which raises an exception because code running with user-space privileges are not permitted to directly read kernel memory. However, due to the race condition, out-of-order instructions following the faulting instruction may also execute. Even though instructions appear after the faulting instruction, out-of-order execution allows them to execute, using data retrieved from the instruction that raises the exception. By the time the exception is raised, some number of out-of-order instructions have executed. Although the raised exception causes the CPU to roll back the out-of-order instructions, the cache state is not reverted. This allows data from out-of-order instructions to persist beyond the point when the exception has been raised.

```
 メルトダウンはセキュアでない振る舞いを利用する。これはIntelのCPUでデモされており、他のベンダのCPUにも影響するかもしれない。脆弱性のあるCPUはout-of-order命令実行中にメモリ読み込みを許可する。そして、例外の発生とout-of-order命令の実行の間で競合状態を抱える。メルトダウン攻撃はカーネルメモリを読み取る。すると、カーネルメモリを直接読み込むためのユーザ空間権限が許可されないコードが走るため、例外を発生する。しかしながら、競合状態のため、不正命令となるout-of-order命令も実行される。命令は不正命令の後に発生するのに、例外が発生する命令から回収されたデータを利用して、out-of-order実行はそれらの実行を許可する。例外が発生するまでに、いくつかのout-of-order命令が既に実行されている。out-of-order命令がロールバックするためにCPUで例外は発生するが、キャッシュの状態は回収されない。このため、例外が発生するポイントを超えて保持されるため、our-of-order命令からのデータを許容する。
```

The impact of Meltdown is that a process running in user space is able to view the contents of kernel memory. Meltdown may also allow Spectre-like memory content leaking that does not cross the user/kernel privilege boundary.

```
メルトダウンのインパクトはユーザー空間で動作するプロセスがカーネルメモリを参照することを可能とすることにある。メルトダウンもスペクターのようなユーザ/カーネル権限境界を越えないメモリ情報漏えいを許可するかもしれない。
```


The Linux kernel mitigations for Meltdown are referred to as KAISER, and subsequently KPTI, which aim to improve separation of kernel and user memory pages. Because the Spectre attacks do not cross user/kernel boundaries, the protections introduced with KAISER/KPTI do not add any protection against them.

```
Linuxカーネルのメルトダウン攻撃の緩和はKAISERとして、その後に KPTIとして参照されている。これはカーネルとユーザメモリページの分離を改善する目的である。スペクター攻撃はユーザ/カーネル境界を越えないが、KAISER/KPTIで紹介される防御方法はそれらに対してなんら防御を追加するものではない。
```

The following table compares Spectre and Meltdown.
```
以下にスペクターとメルトダウンの比較表を載せる
```

# |Spectre | Meltdown |
---------------------------------|----------------------------------|-----------------------------------|
CPU mechanism for triggering     |Speculative execution from branch<br>prediction | Out-of-order execution            |
Affected platforms               |CPUs that perform speculative execution <br> from branch prediction | CPUs that allow memory reads in<br>out-of-order instructions |
Difficulty of successful attack  |High - Requires tailoring to the software <br>environment of the victim process | Low - Kernel memory access exploit<br>code is mostly universal|
Impact                           |Cross- and intra-process (including <br>kernel) memory disclosure |Kernel memory disclosure to userspace|
Software mitigations             |     Indirect Branch Restricted Speculation <br> (IBRS)<br>Note: This software mitigation also <br>requires CPU microcode updates and it <br>only mitigates Spectre variant 2|Kernel page-table isolation (KPTI) |

 

 

```
        #                        |    スペクター                       |   メルトダウン                     |
    ---------------------------------|----------------------------------|-----------------------------------|
    トリガとなるCPU機能    |分岐予測による投機的実行 | Out-of-order実行            |
    影響プラットフォーム    |分岐予測による登記的実行を具備するCPU|out-of-order命令でメモリ参照を許可するCPU |
    攻撃成立の難易度  |高い-犠牲プロセスのソフトウェア環境の準備が必要 | 引く - カーネルメモリアクセスエクスプロイトコードはほぼ一般的|
    影響度        |クロス - 内部プロセス(カーネルを含む)メモリの漏洩 |カーネルメモリのユーザ空間への漏洩|
    ソフトウェア緩和策  | 制限された間接的分岐投機(IBRS)<br>注意: このソフトウェア緩和策は <br>CPUのマイクロコードのアップデートと <br>スペクター変種2に対して有効|カーネルページテーブル分離 (KPTI) |
```

 




### Impact
An attacker able to execute code with user privileges can achieve various impacts. The Meltdown attack allows reading of kernel memory from userspace. This can result in privilege escalation, disclosure of sensitive information, or it can weaken kernel-level protections, such as KASLR. The Spectre attack can allow inter-process or intra-process data leaks.
```
影響度
攻撃者はユーザ権限でコードを実行することができる、さまざまな影響を与えることができる。メルトダウン攻撃はユーザー空間からカーネルメモリを参照すること許可する。これは権限回避、重要情報の公開を引き起こす。または、KASLRのようなカーネルレベル防御を弱めることができる。スペクター攻撃はプロセス間あるいはプロセス内のデータ漏洩を許可することが可能。


```
To execute code locally, an attacker would require a valid account or independent compromise of the target. Attacks using JavaScript in web browsers are possible. Multi-user and multi-tenant systems (including virtualized and cloud environments) likely face the greatest risk. Systems used to browse arbitrary web sites are also at risk. Single-user systems that do not readily provide a way for attackers to execute code locally face significantly lower risk.
```
コードをローカルで実行するため、攻撃者はターゲットの正規アカウント、もしくは、別の不正アクセスを要求するであろう。攻撃者はウエブブラウザ内のjavascriptの利用が可能。マルチユーザ、マルチ手阿南とシステム(仮想環境、クラウド環境を含む)は大きなリスクに直面する可能性が高い。任意のwebサイトを参照しているシステムもリスクがある。攻撃者がローカルから容易いにコードを実行できないシングルユーザシステムについてはかなりリスクが低い。

```
### Solution
Apply updates

Operating system, CPU microcode updates, and some application updates mitigate these attacks.

```
解決策

アップデートの適用
オペレーティングシステム、CPUマイクロコードアップデート、アプリケーションのアップデートで攻撃を緩和する。

```


### Vendor Information (09 Jan 2018)

|Vendor                                           | Status    | Date Notified | Date Updated |
|--------------------------------------|-----------|------------------|-------------------|
|Amazon                                         | Affected|            -              | 05 Jan 2018    |
|AMD                                               |Affected|             -              | 03 Jan 2018    |
|Android Open Source Project|Affected |             -             |  05 Jan 2018    |
|Apple                                             |Affected |            -             |  08 Jan 2018    |
|Arm                                                |Affected |            -             |  03 Jan 2018     |
|CentOS                                         |Affected |            -             |  05 Jan 2018    |
|Cisco                                             |Affected |            -             |  05 Jan 2018    |
|Citrix                                              |Affected|            -             |   05 Jan 2018    |
|Debian GNU/Linux                    |Affected |            -             |  05 Jan 2018    |
|Dell                                                |Affected |            -             | 08 Jan 2018     |
|DragonFly BSD Project            |Affected  |            -            | 08 Jan 2018      |
|Fedora Project                           |Affected  |           -             | 05 Jan 2018      |
|Fortinet, Inc.                               |Affected  |           -             | 05 Jan 2018      |
|FreeBSD Project                        |Affected  |            -            | 05 Jan 2018      |
|Google                                         |Affected  |            -            |  03 Jan 2018      |


### CVSS Metrics
|Group                | Score | Vector                                                          |
|-------------------|---------|-----------------------------------------------|
|Base                    |4.4        |AV:L/AC:M/Au:S/C:C/I:N/A:N             |
|Temporal           |3.4        |E:POC/RL:OF/RC:C                                |
|Environmental | 5.1       | CDP:ND/TD:H/CR:H/IR:ND/AR:ND   |

### References

  -  https://meltdownattack.com/
  -  https://meltdownattack.com/meltdown.pdf
  -  https://spectreattack.com/
  -  https://spectreattack.com/spectre.pdf
  -  https://security.googleblog.com/2018/01/todays-cpu-vulnerability-what-you-need.html
  -  https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html
  -  https://cyber.wtf/2017/07/28/negative-result-reading-kernel-memory-from-user-mode/
  -  https://github.com/IAIK/KAISER
  -  https://gruss.cc/files/kaiser.pdf
  -  https://gruss.cc/files/prefetch.pdf
  -  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5aa90a84589282b87666f92b6c3c917c8080a9bf
  -  https://lkml.org/lkml/2017/12/27/2
  -  https://lkml.org/lkml/2018/1/4/615
  -  https://lwn.net/Articles/741878/
  -  https://lwn.net/Articles/737940/
  -  https://lwn.net/Articles/742702/
  -  http://pythonsweetness.tumblr.com/post/169166980422/the-mysterious-case-of-the-linux-page-table
  -  https://nakedsecurity.sophos.com/2018/01/03/fckwit-aka-kaiser-aka-kpti-intel-cpu-flaw-needs-low-level-os-patches/
  -  https://en.wikipedia.org/wiki/Kernel_page-table_isolation
  -  https://chrisam.net/2018/01/04/speculative-execution-side-channel-vulnerabilities-vendor-published-info/
  -  https://www.raspberrypi.org/blog/why-raspberry-pi-isnt-vulnerable-to-spectre-or-meltdown/
  -  https://doublepulsar.com/important-information-about-microsoft-meltdown-cpu-security-fixes-antivirus-vendors-and-you-a852ba0292ec

### Credit

These issues were researched and reported by researchers at Google Project Zero (Jann Horn) the Institute of Applied Information Processing and Communications (IAIK) at Graz University of Technology (Gruss et. al.), Paul Kocher, and Anders Fogh.

This document was written by Art Manion and Will Dormann.
Other Information

    CVE IDs: CVE-2017-5753 CVE-2017-5715 CVE-2017-5754
    US-CERT Alert: TA18-004A
    Date Public: 03 1月 2018
    Date First Published: 03 1月 2018
    Date Last Updated: 08 1月 2018
    Document Revision: 179

### Feedback

If you have feedback, comments, or additional information about this vulnerability, please send us email.<cert@cert.org>