如何检查你的 Linux 系统是否存在 Meltdown 或者 Spectre 漏洞
Meltdown Specter CPU
![](/data/attachment/album/201803/22/090515cp7byb7i1ppi7gpy.jpg)


Meltdown 和 Specter 漏洞的最恐怖的现实之一是它们涉及非常广泛。几乎每台现代计算机都会受到一些影响。真正的问题是*你*是否受到了影响？每个系统都处于不同的脆弱状态，具体取决于已经或者还没有打补丁的软件。


由于 Meltdown 和 Spectre 都是相当新的漏洞，并且事情正在迅速发展，所以告诉你需要注意什么或在系统上修复了什么并非易事。有一些工具可以提供帮助。它们并不完美，但它们可以帮助你找出你需要知道的东西。


### 简单测试


顶级的 Linux 内核开发人员之一提供了一种简单的方式来检查系统在 Meltdown 和 Specter 漏洞方面的状态。它是简单的，也是最简洁的，但它不适用于每个系统。有些发行版不支持它。即使如此，也值得一试。



```
grep . /sys/devices/system/cpu/vulnerabilities/*

```

![Kernel Vulnerability Check](/data/attachment/album/201803/22/090520fz2cmmqp25hf5lpz.jpg "Kernel Vulnerability Check")


你应该看到与上面截图类似的输出。很有可能你会发现系统中至少有一个漏洞还存在。这的确是真的，因为 Linux 在减轻 Specter v1 影响方面还没有取得任何进展。


### 脚本


如果上面的方法不适合你，或者你希望看到更详细的系统报告，一位开发人员已创建了一个 shell 脚本，它将检查你的系统来查看系统收到什么漏洞影响，还有做了什么来减轻 Meltdown 和 Spectre 的影响。


要得到脚本，请确保你的系统上安装了 Git，然后将脚本仓库克隆到一个你不介意运行它的目录中。



```
cd ~/Downloads
git clone https://github.com/speed47/spectre-meltdown-checker.git

```

这不是一个大型仓库，所以它应该只需要几秒钟就克隆完成。完成后，输入新创建的目录并运行提供的脚本。



```
cd spectre-meltdown-checker
./spectre-meltdown-checker.sh

```

你会在终端看到很多输出。别担心，它不是太难理解。首先，脚本检查你的硬件，然后运行三个漏洞检查：Specter v1、Spectre v2 和 Meltdown。每个漏洞都有自己的部分。在这之间，脚本明确地告诉你是否受到这三个漏洞的影响。


![Meltdown Spectre Check Script Ubuntu](/data/attachment/album/201803/22/090523v7za1see87c3eyed.jpg "Meltdown Spectre Check Script Ubuntu")


每个部分为你提供了潜在的可用的缓解方案，以及它们是否已被应用。这里需要你的一点常识。它给出的决定可能看起来有冲突。研究一下，看看它所说的修复是否实际上完全缓解了这个问题。


### 这意味着什么


所以，要点是什么？大多数 Linux 系统已经针对 Meltdown 进行了修补。如果你还没有更新，你应该更新一下。 Specter v1 仍然是一个大问题，到目前为止还没有取得很大进展。Spectre v2 将取决于你的发行版以及它选择应用的补丁。无论哪种工具都说，没有什么是完美的。做好研究并留意直接来自内核和发行版开发者的信息。




---


via: <https://www.maketecheasier.com/check-linux-meltdown-spectre-vulnerability/>


作者：[Nick Congleton](https://www.maketecheasier.com/author/nickcongleton/) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Check Your Linux PC for Meltdown and Spectre](https://www.maketecheasier.com/assets/uploads/2018/01/lmc-feat.jpg)

One of the scariest realities of the Meltdown and Spectre vulnerabilities is just how widespread they are. Virtually every modern computer is affected in some way. The real question is how exactly are *you* affected? Every system is at a different state of vulnerability depending on which software has and hasn’t been patched.

Since Meltdown and Spectre are both fairly new and things are moving quickly, it’s not all that easy to tell what you need to look out for or what’s been fixed on your system. There are a couple of tools available that can help. They’re not perfect, but they can help you figure out what you need to know.

**Also read:** [How to Use the Nessus Vulnerability Scanner on Linux](https://www.maketecheasier.com/use-nessus-vulnerability-scanner-linux/)

## Simple Test

One of the top Linux kernel developers provided a simple way of checking the status of your system in regards to the Meltdown and Spectre vulnerabilities. This one is the easiest, and is most concise, but it doesn’t work on every system. Some distributions decided not to include support for this report. Even still, it’s worth a shot to check.

grep . /sys/devices/system/cpu/vulnerabilities/*

You should see output similar to the image above. Chances are, you’ll see that at least one of the vulnerabilities remains unchecked on your system. This is especially true since Linux hasn’t made any progress in mitigating Spectre v1 yet.

## The Script

If the above method didn’t work for you, or you want a more detailed report of your system, a developer has created a shell script that will check your system to see what exactly it is susceptible to and what has been done to mitigate Meltdown and Spectre.

In order to get the script, make sure you have Git installed on your system, and then clone the script’s repository into a directory that you don’t mind running it out of.

cd ~/Downloads git clone https://github.com/speed47/spectre-meltdown-checker.git

It’s not a large repository, so it should only take a few seconds to clone. When it’s done, enter the newly created directory and run the provided script.

cd spectre-meltdown-checker ./spectre-meltdown-checker.sh

You’ll see a bunch of junk spit out into the terminal. Don’t worry, its not too hard to follow. First, the script checks your hardware, and then it runs through the three vulnerabilities: Spectre v1, Spectre v2, and Meltdown. Each gets its own section. In between, the script tells you plainly whether you are vulnerable to each of the three.

Each section provides you with a breakdown of potential mitigation and whether or not they have been applied. Here’s where you need to exercise a bit of common sense. The determinations that it gives might seem like they’re in conflict. Do a bit of digging to see if the fixes that it says are applied actually do fully mitigate the problem or not.

## What This Means

So, what’s the takeaway? Most Linux systems have been patched against Meltdown. If you haven’t updated yet for that, you should. Spectre v1 is still a big problem, and not a lot of progress has been made there as of yet. Spectre v2 will depend a lot on your distribution and what patches it’s chosen to apply. Regardless of what either tool says, nothing is perfect. Do your research and stay on the lookout for information coming straight from the kernel and distribution developers.

Our latest tutorials delivered straight to your inbox