Meltdown/Spectre Script Verifikation Linux

TAL9000

Grand Admiral Special
Mitglied seit
20.03.2007
Beiträge
5.945
Renomée
654
Standort
nähe Giessen
https://github.com/speed47/spectre-meltdown-checker

A simple shell script to tell if your Linux installation is vulnerable against the 3 "speculative execution" CVEs that were made public early 2018.

Without options, it'll inspect your currently running kernel. You can also specify a kernel image on the command line, if you'd like to inspect a kernel you're not running.

The script will do its best to detect mitigations, including backported non-vanilla patches, regardless of the advertised kernel version number.

Installation:
Code:
wget https://raw.githubusercontent.com/speed47/spectre-meltdown-checker/master/spectre-meltdown-checker.sh

Ausführen als root:
Code:
sudo sh spectre-meltdown-checker.sh

Ausgabe:
68747470733a2f2f6672616d617069632e6f72672f364f3476344141774d656e762f4d364a34434657777342337a2e706e67

$ sudo sh spectre-meltdown-checker.sh
[sudo] password for tal9000:
Spectre and Meltdown mitigation detection tool v0.29

Checking for vulnerabilities against running kernel Linux 4.4.0-109-generic #132~14.04.1-Ubuntu SMP Tue Jan 9 21:46:42 UTC 2018 x86_64
CPU is Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz


CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: NO
> STATUS: VULNERABLE (CVE-2017-5753)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
* Hardware (CPU microcode) support for mitigation: NO
* Kernel support for IBRS: NO
* IBRS enabled for Kernel space: NO
* IBRS enabled for User space: NO
* Mitigation 2
* Kernel compiled with retpoline option: NO
* Kernel compiled with a retpoline-aware compiler: NO
> STATUS: VULNERABLE (CVE-2017-5715)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI): YES
* PTI enabled and active: YES
> STATUS: NOT VULNERABLE (CVE-2017-5754)

CPU Intel Core i3-540 auf Intel DH55TC
 
Zuletzt bearbeitet:
Mint 18.3 mit Kernel 4.13.0-26 auf einem Ivy Bridge i5-3450/Z77

Spectre and Meltdown mitigation detection tool v0.30

Checking for vulnerabilities against running kernel Linux 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64
CPU is Intel(R) Core(TM) i5-3450 CPU @ 3.10GHz

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: NO
> STATUS: VULNERABLE (only 29 opcodes found, should be >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
* Hardware (CPU microcode) support for mitigation
* The SPEC_CTRL MSR is available: NO
* The SPEC_CTRL CPUID feature bit is set: NO
* Kernel support for IBRS: NO
* IBRS enabled for Kernel space: NO
* IBRS enabled for User space: NO
* Mitigation 2
* Kernel compiled with retpoline option: NO
* Kernel compiled with a retpoline-aware compiler: NO
> STATUS: VULNERABLE (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI): YES
* PTI enabled and active: YES
> STATUS: NOT VULNERABLE (PTI mitigates the vulnerability)

A false sense of security is worse than no security at all, see --disclaimer
 
Ubuntu 16.04 mit den aktuellen updates auf nem i7-6700HQ powered laptop.

Code:
sudo sh spectre-meltdown-checker.sh
Spectre and Meltdown mitigation detection tool v0.30

Checking for vulnerabilities against running kernel Linux 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64
CPU is Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel:  NO 
> STATUS:  VULNERABLE  (only 29 opcodes found, should be >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
*   Hardware (CPU microcode) support for mitigation
*     The SPEC_CTRL MSR is available:  YES 
*     The SPEC_CTRL CPUID feature bit is set:  YES 
*   Kernel support for IBRS:  NO 
*   IBRS enabled for Kernel space:  NO 
*   IBRS enabled for User space:  NO 
* Mitigation 2
*   Kernel compiled with retpoline option:  NO 
*   Kernel compiled with a retpoline-aware compiler:  NO 
> STATUS:  VULNERABLE  (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI):  YES 
* PTI enabled and active:  YES 
> STATUS:  NOT VULNERABLE  (PTI mitigates the vulnerability)

A false sense of security is worse than no security at all, see --disclaimer

Bei mir ist CPU microcode support fuer Spectre Variant 2 aktiv (bei errate und Hal9000 nicht) mit selbem kernel wie bei errate.
 
neue Version 0.31 sowie aktualisiertes intel-microcode 3.20180108.0~ubuntu14.04.2
CPU Intel Core i3-540 auf Intel DH55TC, Mint 17.3 mit Kernel 4.4.0-109 (nach Vorschlag Mint Update installiert, war früher 3.19)



Für Copy Past Text in Spoiler
Code:
Spectre and Meltdown mitigation detection tool v0.31

Checking for vulnerabilities against running kernel Linux 4.4.0-109-generic #132~14.04.1-Ubuntu SMP Tue Jan 9 21:46:42 UTC 2018 x86_64
CPU is Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel:  NO 
> STATUS:  VULNERABLE  (only 32 opcodes found, should be >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
*   Hardware (CPU microcode) support for mitigation
*     The SPEC_CTRL MSR is available:  NO 
*     The SPEC_CTRL CPUID feature bit is set:  NO 
*   Kernel support for IBRS:  NO 
*   IBRS enabled for Kernel space:  NO 
*   IBRS enabled for User space:  NO 
* Mitigation 2
*   Kernel compiled with retpoline option:  NO 
*   Kernel compiled with a retpoline-aware compiler:  NO 
> STATUS:  VULNERABLE  (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI):  YES 
* PTI enabled and active:  YES 
* Checking if we're running under Xen PV (64 bits):  NO 
> STATUS:  NOT VULNERABLE  (PTI mitigates the vulnerability)
Tja scheinbar ist mein i3 zu alt als das das Mikrocodeupdate was bringt...

@eratte: alle Updates installiert? (auch die bis Ebene 5)
 
Zuletzt bearbeitet:


Gruß,
Ritschie
 
Zuletzt bearbeitet:
Micro Code per Treiberverwaltung installiert:



Unterschied keiner:

Spectre and Meltdown mitigation detection tool v0.30

Checking for vulnerabilities against running kernel Linux 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64
CPU is Intel(R) Core(TM) i5-3450 CPU @ 3.10GHz

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: NO
> STATUS: VULNERABLE (only 29 opcodes found, should be >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
* Hardware (CPU microcode) support for mitigation
* The SPEC_CTRL MSR is available: NO
* The SPEC_CTRL CPUID feature bit is set: NO
* Kernel support for IBRS: NO
* IBRS enabled for Kernel space: NO
* IBRS enabled for User space: NO
* Mitigation 2
* Kernel compiled with retpoline option: NO
* Kernel compiled with a retpoline-aware compiler: NO
> STATUS: VULNERABLE (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI): YES
* PTI enabled and active: YES
> STATUS: NOT VULNERABLE (PTI mitigates the vulnerability)

A false sense of security is worse than no security at all, see --disclaimer
 
Micro Code per Treiberverwaltung installiert:

Unterschied keiner:
i5-3450 zu Alt... was fürn sch***!

Jemand mit nem Haswell unterwegs zum verifizieren? Skylake wird vom Microcode ja so wie es aussieht "gehärtet".

Das Tool zum verifizieren gibt es nun in Version 0.31
 
Zuletzt bearbeitet:
Huch, dagegen sieht mein Ryzen irgendwie ziemlich ungepatcht aus - dabei habe ich gerade vorher noch mal nach updates gesucht und auch ein paar installiert.
Die relevanten Patches hatte ich aber ohnehin schon vor ein paar Tagen bekommen.

Was bedeutet denn die Zahl der Opcodes und wie kann man die erhöhen? (Hab leider irgendwann aufgegeben, bei dem Thema dranzubleiben...)

Spectre and Meltdown mitigation detection tool v0.31

Checking for vulnerabilities against running kernel Linux 4.13.0-25-generic #29-Ubuntu SMP Mon Jan 8 21:14:41 UTC 2018 x86_64
CPU is AMD Ryzen 7 1700 Eight-Core Processor

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: NO
> STATUS: VULNERABLE (only 29 opcodes found, should be >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
* Hardware (CPU microcode) support for mitigation
* The SPEC_CTRL MSR is available: NO
* The SPEC_CTRL CPUID feature bit is set: NO
* Kernel support for IBRS: NO
* IBRS enabled for Kernel space: NO
* IBRS enabled for User space: NO
* Mitigation 2
* Kernel compiled with retpoline option: NO
* Kernel compiled with a retpoline-aware compiler: NO
> STATUS: VULNERABLE (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI): YES
* PTI enabled and active: NO
* Checking if we're running under Xen PV (64 bits): NO
> STATUS: NOT VULNERABLE (your CPU vendor reported your CPU model as not vulnerable)
 
i5-3450 zu Alt... was fürn sch***!

Denke ich nicht, das Micro Code Update wird noch nicht verfügbar sein und nach Ergebnis des Test ist der Schutz gegen Spectre V2 im Kernel noch nicht aktiv.
Schutz gegen Meltdown ist aktiv und das war auch sehr wichtig.

Intel hat da Updates veröffentlich, für Haswell und Broadwell und wohl auch Kaby Lake wurde aber auch welche schon wieder zurückgezogen:
Seite 15: 21. Update: Intel versieht hunderte Prozessoren mit Microcode-Update (Hardwareluxx)

Mit Linux hat man den vorteil das das Micrp Code geladen werden kann, bei Windows wird mal wohl auf ein BIOS Update hoffen müssen.

--- Update ---

Gegen Spectre V2 wird ja als nächstes Retpoline Einzug in den Kernel finden, sieht man ja an unseren Werten das der bei uns noch nicht aktiv ist.

TOMBOMBADIL hat zwar den passenden Micro Code aber noch nichts im Kernel dazu aktiv.

Und MagicEye04 muss sich am wenigsten Sorgen machen mit Ryzen, von Meltdown nicht betroffen, Spectre V2 Risiko gegen 0 und V1 muss in Anwendungen geschützt werden.
 
Schon klar, aber wenn auf einem anderen Rechner mit Ryzen die Lücke gestopft ist und auf meinem nicht, dann würde ich schon gern wissen, woran es liegt?
Braucht man dafür evtl. ein aktuelleres Bios?
 
Braucht man dafür evtl. ein aktuelleres Bios?
Also ich hab das ASUS Prime B350-Plus aber nichtmal das aktuellste BIOS drauf (kann heute Abend mal nachsehen, welches).

System ist openSUSE Leap 42.3 mit sämtlichen Updates. Dabei gab es um das Bekanntwerden der Sicherheitslücken ein Kernel-Update sowie eines für kernel-firmware.

Gruß,
Ritschie
 
Schon klar, aber wenn auf einem anderen Rechner mit Ryzen die Lücke gestopft ist und auf meinem nicht

Du kannst ja nur die Meldung zu Spectre V1 meinen, auf welcher Grundlage das Tool zu der Aussage kommt ist mir nicht ganz klar.
Es steht aber dabei: heuristic to be improved when official patches become available

Also abwarten, bisher geht man davon aus das der Schutz gegen V1 nicht im OS erledigt wird sondern in den Anwendungen.

Neuen Micro Code braucht es bei AMD wenn nur für V2 - der soll auch nur optional angeboten werden.
 
Zuletzt bearbeitet:
Welche Lücke meinst du und welchen anderen Rechner?
Er meint dieses Posting -> http://www.planet3dnow.de/vbulletin...kation-Linux?p=5186024&viewfull=1#post5186024

Er vergleicht mein Ryzen System mit seinem:
Magic:
Code:
CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: [COLOR="#FF0000"]NO[/COLOR]
> STATUS: [COLOR="#FF0000"]VULNERABLE[/COLOR] (only 29 opcodes found, should be >= 70, heuristic to be improved when official patches become available)

Ritschie:
Code:
CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: [COLOR="#008000"]YES[/COLOR]
> STATUS: [COLOR="#008000"]NOT VULNERABLE[/COLOR] (92 opcodes found, which is >= 70, heuristic to be improved when official patches become available)

Gruß,
Ritschie
 
Zuletzt bearbeitet:
Checking count of LFENCE opcodes in kernel

Kernel ist ja nicht der selbe. Ubuntu (und damit auch Mint) ist da wohl noch nicht so weit wie Suse.
 
Zuletzt bearbeitet:
Anscheinend wird das von den Mainstream Medien nicht wirklich sinnvoll rübergebracht.

AMD ist so gut wie sicher. Variante 1 ist ab Werk nicht möglich da der Befehl unterbunden ist. Variante 2 und 3 ist auf AMD Hardware eigentlich nicht anwendbar weil es eben ein andere Design ist. Der Trick funktioniert nur auf Intel. Angreifer müsste suchen ob sie auf AMD eine andere Lücke finden die man ausnutzen kann.

Vom Linux Kernel her ändert sich nichts weil der Patch auf AMD deaktiviert ist. Es wurde darum gebeten weil das Ausnutzen eh nicht möglich ist. Es sind nur Änderungen microcode/Kernel die AMD mit übernehmen muss.

Das ist so mein Wissensstand.
 
Version 0.32 wurde am 20.01. veröffentlicht, aktuell mit 3 weiteren Änderungen:

fix(dmesg): detect when dmesg is truncated
fix(cpu): Pentium Exxxx series are not vulnerable
fix(display): use text-mode compatible colors

Ein Unterschied bei Ergebnis ist eher unwahrscheinlich ohne weiter Updates (oder man hat eine Exxxx CPU), aber das erneute drüber laufen lassen schadet auch nicht...

EDIT: neues (altes) Mikrocodeupdate wurde verteilt:
 
Zuletzt bearbeitet:
Das ist die Ausgabe mit der Version 0.32 des Script und Ubuntu Kernel 4.40.112 vom 22.01.2018:
Spectre and Meltdown mitigation detection tool v0.32

Checking for vulnerabilities against running kernel Linux 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64
CPU is AMD Ryzen 7 1800X Eight-Core Processor

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: YES
> STATUS: NOT VULNERABLE (115 opcodes found, which is >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
* Hardware (CPU microcode) support for mitigation
* The SPEC_CTRL MSR is available: NO
* The SPEC_CTRL CPUID feature bit is set: NO
* Kernel support for IBRS: YES
* IBRS enabled for Kernel space: NO
* IBRS enabled for User space: NO
* Mitigation 2
* Kernel compiled with retpoline option: NO
* Kernel compiled with a retpoline-aware compiler: NO
> STATUS: VULNERABLE (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI): YES
* PTI enabled and active: NO
* Checking if we're running under Xen PV (64 bits): NO
> STATUS: NOT VULNERABLE (your CPU vendor reported your CPU model as not vulnerable)

A false sense of security is worse than no security at all, see --disclaimer

In Ubuntu habe im Moment keine Microcode-Updates aktiviert, über die Paketverwaltung
ist amd64-microcode (2.20160316.1) verfügbar vom 19.03.2016.

* Upstream release 20160316 built from linux-firmware:
+ Updated Microcodes:
sig 0x00600f20, patch id 0x0600084f, 2016-01-25
+ This microcode updates fixes a critical erratum on NMI handling
introduced by microcode patch id 0x6000832 from the 20141028 update.
The erratum is also present on microcode patch id 0x6000836.
+ THIS IS A CRITICAL STABILITY AND SECURITY UPDATE FOR THE EARLIER
AMD PILEDRIVER PROCESSORS, including:
+ AMD Opteron 3300, 4300, 6300
+ AMD FX "Vishera" (43xx, 63xx, 83xx, 93xx, 95xx)
+ AMD processors with family 21, model 2, stepping 0
* Robert ?wi?cki, while fuzzing the kernel using the syzkaller tool,
uncovered very strange behavior on an AMD FX-8320, later reproduced on
other AMD Piledriver model 2, stepping 0 processors including the Opteron
6300. Robert discovered, using his proof-of-concept exploit code, that
the incorrect behavior allows an unpriviledged attacker on an unpriviledged
VM to corrupt the return stack of the host kernel's NMI handler. At best,
this results in unpredictable host behavior. At worst, it allows for an
unpriviledged user on unpriviledged VM to carry a sucessful host-kernel
ring 0 code injection attack.
* The erratum is timing-dependant, easily triggered by workloads that cause
a high number of NMIs, such as running the "perf" tool.

-- Henrique de Moraes Holschuh <hmh@debian.org> Sat, 19 Mar 2016 14:02:44 -0300

MfG
RedBaron
 
Ich habe nicht mal Microcodes überhaupt aktiviert, es war standardmäßig aus und ich sah bisher keine Veranlassung, es zu aktivieren, der Rechner lief auch so und rechnete schnell.
 
Ich habe nicht mal Microcodes überhaupt aktiviert, es war standardmäßig aus und ich sah bisher keine Veranlassung, es zu aktivieren, der Rechner lief auch so und rechnete schnell.
Microcodes aktivieren?
Entweder sie sind geflasht, also fest installiert oder eben nicht.
Wenn man in einer Windows Sitzung die Codes ändert, werden bei nächsten "reboot" die aus dem UEFI geladen.
Also wie die ältere Revision, Live Patch nennt man sowas...
 
Da wir hier im Linux-Thread sind, kann ich zu Windows nix sagen, hab ich dieses Jahr noch nicht gebootet.
In Ubuntus "Anwendungen und Aktualisierungen" habe ich unter Zusatzliche Treiber jedenfalls "amd64microcode..." auf "nicht benutzen" stehen auf dem Ryzen.
Beim Athlon5350 ist es aus welchen Gründen auch immer aktiviert.
 
Hallo

HWE Kernel 4.13.0-31 vom 19.01.2018 in Ubuntu 16.04.3 LTS

Code:
Spectre and Meltdown mitigation detection tool v0.32

Checking for vulnerabilities against running kernel Linux 4.13.0-31-generic #34~16.04.1-Ubuntu SMP Fri Jan 19 17:11:01 UTC 2018 x86_64
CPU is  AMD Ryzen 7 1800X Eight-Core Processor

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel:  YES 
> STATUS:  NOT VULNERABLE  (114 opcodes found, which is >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
*   Hardware (CPU microcode) support for mitigation
*     The SPEC_CTRL MSR is available:  NO 
*     The SPEC_CTRL CPUID feature bit is set:  NO 
*   Kernel support for IBRS:  YES 
*   IBRS enabled for Kernel space:  NO 
*   IBRS enabled for User space:  NO 
* Mitigation 2
*   Kernel compiled with retpoline option:  NO 
*   Kernel compiled with a retpoline-aware compiler:  NO 
> STATUS:  VULNERABLE  (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI):  YES 
* PTI enabled and active:  NO 
* Checking if we're running under Xen PV (64 bits):  NO 
> STATUS:  NOT VULNERABLE  (your CPU vendor reported your CPU model as not vulnerable)

In MS Windows werden die Microcode Updates über Microsoft Update verfügbar, zuletzt 2015:
june-2015-intel-cpu-microcode-update-for-windows
This article describes a microcode update for Intel Central Processing Units (CPUs). The update is for Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7 Service Pack 1 (SP1), or Windows Server 2008 R2 SP1. Before you install this update, see the Prerequisites section.

MfG
RedBaron
 
Zurück
Oben Unten