Uruchom poniższe polecenie w konsoli PowerShell (Uruchom jako Administrator). Kliknij przycisk, aby przenieść kod do schowka jako idealny, nienaruszony oneliner:
Run the following command in a PowerShell (Run as Administrator) console. Click the button to copy the code to your clipboard as a perfect, intact oneliner:
powershell -c {try{$sb=Confirm-SecureBootUEFI}catch{$sb=$false};try{$db=Get-SecureBootUEFI -Name db; $ca=([System.Text.Encoding]::ASCII.GetString($db.Bytes) -match "UEFI CA 2023")}catch{$ca=$false};try{$bl=(Get-BitLockerVolume -MountPoint C:).ProtectionStatus -eq 'On'}catch{$bl=$false};$q=(Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Secureboot" -Name "AvailableUpdates" -ErrorAction SilentlyContinue).AvailableUpdates;$qs=if($null -eq $q){"Brak_Danych"}elseif($q -eq 16384 -or $q -eq 0){"Sukces($q)"}elseif($q -eq 320){"Zaplanowano(320)"}elseif($q -eq 256){"W_Toku(256)"}else{"Inny($q)"};$r=if($sb -and $ca){"READY"}elseif($q -eq 320 -or $q -eq 256){"REBOOT_PENDING"}elseif(-not $sb){"BLOCKED"}else{"RISK"};Write-Output "SecureBoot=$sb | BitLocker=$bl | UEFI_CA_2023=$ca | UpdateQueue=$qs | RESULT=$r";exit([int](-not($sb -and $ca)))}
Skrypt ten został zaprojektowany, aby w jednym, szybkim wywołaniu zbadać 5 kluczowych obszarów bezpieczeństwa sprzętowego i systemowego, nie wymagając od administratora szukania informacji w wielu różnych miejscach. Zwraca on zawsze przejrzysty ciąg znaków przypominający logowanie. Przykład:
This script is designed to examine 5 key areas of hardware and system security in a single, fast call, without requiring the administrator to look for information in many different places. It always returns a clear logging-style string. Example:
SecureBoot=True | BitLocker=True | UEFI_CA_2023=False | UpdateQueue=Brak_Danych | RESULT=RISK
Oto co dokładnie oznacza każdy wyodrębniony parametr w wyjściu skryptu:
Here is exactly what each extracted parameter in the script's output means:
| Zmienna w logu Log variable | Wartość Value | Znaczenie techniczne Technical meaning |
|---|---|---|
| SecureBoot= | True / False | Określa, czy funkcja Secure Boot jest fizycznie włączona i aktywna w BIOS/UEFI. Determines whether the Secure Boot feature is physically enabled and active in BIOS/UEFI. |
| BitLocker= | True / False | Informuje, czy partycja systemowa C: jest chroniona szyfrowaniem BitLocker. Jeśli True, resetowanie kluczy wymusi podanie Recovery Key! Indicates whether the C: system partition is protected by BitLocker encryption. If True, resetting the keys will force a Recovery Key prompt! |
| UEFI_CA_2023= | True / False | Weryfikuje, czy w bazie sygnatur (db) NVRAM znajduje się już nowy certyfikat "Microsoft UEFI CA 2023". Verifies whether the new "Microsoft UEFI CA 2023" certificate is already present in the NVRAM signature database (db). |
| Wartość UpdateQueue UpdateQueue Value | Stan i akcja State and action |
|---|---|
| Sukces(0) lub Sukces(16384) Sukces(0) or Sukces(16384) | Pakiety zostały pomyślnie przetworzone. Wartość 16384 oznacza, że system oczekuje na restart w celu sfinalizowania procedury. Wartość 0 oznacza pełne zakończenie operacji. Packages processed successfully. The value 16384 means the system is waiting for a reboot to finalize the procedure. The value 0 means the operation is fully completed. |
| Zaplanowano(320) Zaplanowano(320) | Zadanie aktualizacji certyfikatów zostało zainicjowane i wrzucone do kolejki harmonogramu zadań systemu Windows. The certificate update task has been initiated and placed in the Windows Task Scheduler queue. |
| W_Toku(256) W_Toku(256) | System operacyjny aktualnie modyfikuje wpisy i przygotowuje transakcję zapisu do pamięci NVRAM. The operating system is currently modifying entries and preparing a write transaction to NVRAM. |
| Brak_Danych Brak_Danych | Brak wpisu w rejestrze. System nie podjął jeszcze żadnej próby przygotowania nowej bazy certyfikatów. Wymagane wymuszenie (Krok 3). No registry entry. The system has not yet attempted to prepare the new certificate database. Enforcement required (Step 3). |
| Zwrócony RESULT Returned RESULT | Ocena i dalsze kroki Assessment and next steps |
|---|---|
| READY | System w pełni zabezpieczony. Secure Boot jest aktywny, a nowe certyfikaty UEFI CA 2023 zostały pomyślnie wgrane do NVRAM płyty głównej. Brak wymaganych działań. System fully secured. Secure Boot is active, and the new UEFI CA 2023 certificates have been successfully loaded into the motherboard's NVRAM. No further action required. |
| REBOOT_PENDING | Wymagany restart. Pliki aktualizacji zostały przetworzone, a system czeka na ponowne uruchomienie komputera, aby firmware płyty zindeksował nowe klucze db/KEK. Reboot required. Update files have been processed, and the system is waiting for a reboot so the motherboard firmware can index the new db/KEK keys. |
| BLOCKED | Operacja zablokowana. Secure Boot jest wyłączony w systemie lub sprzętowy BIOS/UEFI posiada aktywną blokadę zapisu modyfikacji do pamięci nieulotnej NVRAM. Operation blocked. Secure Boot is disabled in the system or the hardware BIOS/UEFI has an active block preventing write modifications to NVRAM. |
| RISK | System podatny na zagrożenia / Brak aktualizacji. Zbliża się termin wygaśnięcia starych certyfikatów (czerwiec 2026 r.). Należy niezwłocznie przejść do Kroku 3 i 4 w celu wymuszenia instalacji. System vulnerable / No update. The expiration date of old certificates (June 2026) is approaching. Proceed immediately to Steps 3 and 4 to force the installation. |
Jeśli w Kroku 2 system zwrócił status RISK lub Brak_Danych, dodaj wymaganą flagę bitową aktualizacji bezpośrednio do rejestru za pomocą poniższego polecenia:
If in Step 2 the system returned RISK or Brak_Danych, add the required update bit flag directly to the registry using the following command:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Secureboot" -Name "AvailableUpdates" -Value 0x140 -Type DWord -Force
Aby natychmiast wyzwolić natywne zadanie harmonogramu Windows odpowiedzialne za wdrożenie przygotowanych certyfikatów baz kluczy Secure Boot, użyj komendy:
To immediately trigger the native Windows Scheduled Task responsible for deploying the prepared Secure Boot key database certificates, use the command:
powershell -Command {Start-ScheduledTask -TaskName "\Microsoft\Windows\PI\Secure-Boot-Update"}
Po wykonaniu wcześniejszych kroków odczekaj minimum 30 sekund, a następnie wykonaj pełny restart systemu operacyjnego. Często wymagane są dwa cykle restartu, by certyfikaty zaktualizowały się w całości.
After completing previous steps, wait at least 30 seconds, then perform a full restart of the operating system. Often two reboot cycles are required for the certificates to fully update.
Wgrywanie nowych certyfikatów z poziomu systemu operacyjnego Windows opiera się na tym, jak dany producent zaimplementował proces obsługi zmiennych UEFI i sprawdzania klucza KEK. Zobacz jak zarządzać różnymi typami środowisk sprzętowych:
Uploading new certificates from Windows relies heavily on how a given manufacturer implemented the handling of UEFI variables and KEK verification. See how to manage different types of hardware environments:
db i dbx. Sama aktualizacja BIOS od producenta często wystarczy, by podmienić bazy w NVRAM, zanim Windows w ogóle tego zażąda.
Additionally, newer BIOS packages published in HP Support Assistant, Lenovo Commercial Vantage, or Dell Command Update in most cases contain the embedded new set of db and dbx certificates. A simple manufacturer BIOS update is often enough to replace the databases in NVRAM before Windows even requests it.
Security -> Secure Boot -> Key Management.
The solution is to update the BIOS to the latest version, enter its settings and navigate to Security -> Secure Boot -> Key Management.
Restore Factory Keys, Reset to Default lub Install Default Secure Boot Keys. Załaduje to poprawne klucze (w tym MS 2023) przypisane do nowej wersji BIOS przez producenta płyty.
Use built-in options there, e.g. Restore Factory Keys, Reset to Default, or Install Default Secure Boot Keys. This will load the correct keys (including MS 2023) assigned to the new BIOS version by the motherboard manufacturer.
.auth / .cer (out-of-band management).
On hardware like Supermicro, certificates are usually uploaded manually via the built-in IPMI / BMC management interface, Redfish API, or physically during POST by entering the BIOS Setup and uploading certificates as .auth / .cer files (out-of-band management).
apt update && apt install pve-edk2-firmware
Upewnij się, że posiadasz co najmniej wersję 4.2025.05-2.
Make sure you have at least version 4.2025.05-2.
ms-cert=2023k. Zablokuje to też Windows Update wewnątrz VM.
Virtual machines with old EFI disks will log a warning in the Proxmox system about a missing ms-cert=2023k flag. This will also block Windows Update inside the VM.
(Hardware -> EFI Disk), kliknij Disk Action -> Enroll Updated Certificates.
In GUI: Select VM hardware options (Hardware -> EFI Disk), click Disk Action -> Enroll Updated Certificates.
qm enroll-efi-keys ID_MASZYNY (np. qm enroll-efi-keys 102).
Or in CLI: qm enroll-efi-keys VM_ID (e.g. qm enroll-efi-keys 102).
TA PROCEDURA WYMUSI PONOWNE PODANIE KLUCZA ODZYSKIWANIA BITLOCKER PRZY NASTĘPNYCH URUCHOMIENIACH! THIS PROCEDURE WILL FORCE RE-ENTRY OF THE BITLOCKER RECOVERY KEY ON SUBSEQUENT BOOTS!
Upewnij się na 100%, że posiadasz wydrukowany lub zapisany aktualny klucz odzyskiwania (Recovery Key) przed przystąpieniem do procedury. Ensure 100% that you have printed or saved your current Recovery Key before proceeding with the procedure.
Poniżej znajduje się szczegółowy opis mechanizmu Secure Boot oraz procesu, w jaki Microsoft aktualizuje certyfikaty w pamięci UEFI, oparty na zmianach wprowadzonych w 2023 roku w związku z wygasaniem starych kluczy z 2011 r. (których ważność kończy się w 2026 r.).
Below is a detailed description of the Secure Boot mechanism and the process by which Microsoft updates certificates in UEFI memory, based on changes introduced in 2023 due to the expiration of old 2011 keys (which expire in 2026).
[ PAMIĘĆ BIOS / NVRAM ]
├── PK (Platform Key) ──> Zarządza KEK
└── KEK (Key Exchange Key) ──> Zarządza db / dbx
├── db (Dozwolone): MS UEFI CA 2023 / Windows Production PCA 2011
└── dbx (Zablokowane): Lista skasowanych / dziurawych (np. BlackLotus)
[ BIOS / NVRAM MEMORY ]
├── PK (Platform Key) ──> Manages KEK
└── KEK (Key Exchange Key) ──> Manages db / dbx
├── db (Authorized): MS UEFI CA 2023 / Windows Production PCA 2011
└── dbx (Forbidden): List of revoked / vulnerable hashes (e.g. BlackLotus)
db i dbx..efi), które mają prawo się uruchomić. To tutaj trafia nowy certyfikat Microsoft Corporation UEFI CA 2023.db and dbx databases..efi) that are allowed to run. The new Microsoft Corporation UEFI CA 2023 certificate is placed here.[Boot] ──> UEFI ładuje Boot Manager (np. bootmgfw.efi)
│
├── Krok 1: Czy plik ma prawidłowy podpis cyfrowy?
│ ├── NIE ──> [HALT] Błąd Secure Boot
│ └── TAK ──> Przejdź do Krok 2
│
├── Krok 2: Czy certyfikat podpisu pochodzi z bazy "db" (np. nowy CA 2023)?
│ ├── NIE ──> [HALT] Nieautoryzowany system
│ └── TAK ──> Przejdź do Krok 3
│
└── Krok 3: Sprawdzenie czarnej listy "dbx"
├── Czy hash pliku lub certyfikat jest w "dbx"?
│ ├── TAK ──> [HALT] Plik zablokowany (unieważniony)
│ └── NIE ──> [SUCCESS] Windows Boot Manager zostaje uruchomiony!
[Boot] ──> UEFI loads Boot Manager (e.g., bootmgfw.efi)
│
├── Step 1: Does the file have a valid digital signature?
│ ├── NO ──> [HALT] Secure Boot Error
│ └── YES ──> Proceed to Step 2
│
├── Step 2: Is the signature certificate from "db" database (e.g. CA 2023)?
│ ├── NO ──> [HALT] Unauthorized system
│ └── YES ──> Proceed to Step 3
│
└── Step 3: Check "dbx" blacklist
├── Is the file hash or certificate in "dbx"?
│ ├── YES ──> [HALT] File blocked (revoked)
│ └── NO ──> [SUCCESS] Windows Boot Manager is launched!
db i dbx ze zmiennych środowiskowych.bootmgfw.efi na partycji systemowej).dbx, rozruch jest natychmiast przerywany.db. Jeśli plik podpisany jest poprawnym certyfikatem (np. nowym MS 2023), zostaje załadowany do pamięci.bootmgfw.efi następnie ładuje winload.efi, weryfikując jego podpis, a ten z kolei weryfikuje jądro systemu (ntoskrnl.exe) i kluczowe sterowniki systemowe.db and dbx databases from environmental variables.bootmgfw.efi on the system partition).dbx database, the boot process is immediately halted.db database. If signed by a valid certificate (e.g., new MS 2023), it is loaded into memory.bootmgfw.efi then loads and verifies winload.efi, which in turn verifies the system kernel (ntoskrnl.exe) and critical system drivers.[ PROCES AKTUALIZACJI (Windows Update) ]
Dostarczenie łatki ──> Windows OS ──> Wywołanie API UEFI (SetVariable)
│
WERYFIKACJA SPRZĘTOWA (Klucz KEK)
├── Podpis niepoprawny
│ └──> [ODRZUCENIE] Autonomiczna decyzja BIOS
│
└── Podpis poprawny
└──> [ZAPIS] Dodanie certyfikatów do NVRAM
[ UPDATE PROCESS (Windows Update) ]
Update Delivery ──> Windows OS ──> UEFI API Call (SetVariable)
│
HARDWARE VERIFICATION (KEK Key)
├── Invalid signature
│ └──> [REJECTED] Autonomous BIOS decision
│
└── Valid signature
└──> [COMMIT] Certificates written to NVRAM
── Podpis niepoprawny ──> Odrzucenie updatu leży wyłącznie po stronie autonomicznej decyzji sprzętowego BIOSu. Ani użytkownik, ani żaden proces z poziomu systemu Windows nie mają na to wpływu i nie mogą tego obejść.
The step ── Invalid signature ──> Update rejected lies exclusively on the autonomous decision of the hardware BIOS. Neither the user nor any Windows process can influence or bypass this.
Bezpośredni zapis z działającego systemu operacyjnego (nawet z uprawnieniami administratora) do przestrzeni NVRAM BIOS/UEFI jest sprzętowo zablokowany. Microsoft aktualizuje bazy używając zaufanego, odroczonego procesu z wykorzystaniem mechanizmu UEFI Runtime Services:
Direct writing from a running OS (even with admin privileges) to the BIOS/UEFI NVRAM space is blocked on the hardware level. Microsoft updates the databases using a trusted, deferred process via the UEFI Runtime Services mechanism:
SetFirmwareEnvironmentVariableEx) w celu umieszczenia ładunku aktualizacji w tzw. Zmiennych Uwierzytelnionych EFI (Authenticated Variables).KEK zapisanego uprzednio na płycie głównej. Odrzucenie w przypadku niepoprawnego podpisu to autonomiczna decyzja sprzętowego BIOSu/UEFI, całkowicie niezależna od woli użytkownika czy systemu operacyjnego (Windows).db (i odpowiednie skróty do dbx) w trwałej pamięci flash NVRAM. Zmienne tymczasowe są czyszczone, po czym kontynuowany jest normalny proces bootowania Windows.SetFirmwareEnvironmentVariableEx) to place the update payload into Authenticated EFI Variables.KEK stored previously on the motherboard. Rejection in case of an invalid signature is an autonomous decision of the hardware BIOS/UEFI, completely independent of the user's will or the operating system (Windows).db database (and appropriate hashes to dbx) in the persistent NVRAM flash memory. Temporary variables are cleared, and the normal Windows boot process continues.