Advancing key protection in Windows using VBS (2024)

Today, we are excited to bring you the next step in key protection for Windows. Now in Windows 11 Insider Preview Build 26052and Windows Server Insider Preview Build 26052, developers can use the Cryptography API: Next Generation (CNG) framework to help secure Windows keys with virtualization-based security (VBS). With this new capability, keys can be protected from admin-level key theft attacks with negligible effect on performance, reliability, or scale.

Now let’s explore how you can create, import, and protect your keys using VBS.

The current state of key protection in Windows

As attackers advance their techniques to steal keys and credentials, Microsoft continues to evolve capabilities to help protect valuable assets across Windows. This is crucial work as when attackers get hold of important keys, they can impersonate users and access resources without their knowledge and consent. Consider the theft of third-party encryption keys - these types of attacks may have privacy and security consequences and could compromise the availability of applications and services.

The default method of protecting keys in Windows is to store them in the memory of a local system process known as the Local Security Authority (LSA). LSA is a great option for storing keys that do not protect high-value assets or require the best performance available. While LSA helps prevent code injection and non-authorized processes from reading memory, an admin or system-level attacker can still steal keys from this memory space.

For a more secure option, the industry is moving towards hardware-based isolation, where keys are stored directly on a hardware security processor like a managed HSM (Hardware Security Module), Trusted Platform Module (TPM) or a Microsoft Pluton security processor, which help provide stronger security against tampering with and exporting keys. While hardware isolation should be used for keys wherever possible, if there are performance or scale requirements that require usage of the central processing unit (CPU) core, VBS is a robust alternative that helps offer stronger security than currently available software protection.

Introducing key protection with VBS in Windows

The security capability we’re introducing today addresses the limitations in the current software and hardware key protection mechanisms on Windows. You can now protect your keys with VBS, which uses the virtualization extension capability of the CPU to create an isolated runtime outside of the normal OS. When in use, VBS keys are isolated in a secure process, allowing key operations to occur without ever exposing the private key material outside of this space. At rest, private key material is encrypted by a TPM key which binds VBS keys to the device. Keys protected in this way cannot be dumped from process memory or exported in plain text from a user’s machine, preventing exfiltration attacks by any admin-level attacker.

VBS helps to offer a higher security bar than software isolation, with stronger performance compared to hardware-based solutions, since it is powered by the device's CPU. While hardware keys offer strong levels of protection, VBS is helpful for services with high security, reliability, and performance requirements.

The following section will show you how to use these capabilities by creating and using VBS keys with NCrypt, which is part of the Cryptography API: Next Generation (CNG) framework.

Tutorial: Leverage the NCrypt API to create and use VBS keys

The core functionality to create and import VBS keys is as simple as passing in an additional flag into the NCrypt API.

NCryptCreatePersistedKey and NCryptImportKey accept two flags to request that VBS should be leveraged to protect the client key's private material:

Flag

Functionality and fallback

NCRYPT_REQUIRE_VBS_FLAG

Indicates a key must be protected with VBS.

Operation will fail if VBS is not available.

NCRYPT_PREFER_VBS_FLAG

Indicates a key should be protected with VBS.

Operation will generate a software-isolated key if VBS is not available.

When it comes to creating VBS keys, the standard CNG encryption algorithms and key lengths for software keys are supported.

Ephemeral and per-boot keys

The default behavior of NCryptCreatePersistedKey and NCryptImportKey is that of a cross-boot persisted key stored on disk that persists across reboot cycles.

Calling NCryptCreatePersistedKey with pszKeyName == NULL creates an ephemeral key rather than a persisted key, and its lifetime is managed by the client process. Ephemeral keys are not written to disk and live in secure memory. An additional flag can be passed in along with the above VBS flags to indicate that a per-boot key should be used to help protect the client key rather than default cross-boot key.

Flag

Functionality and fallback

NCRYPT_USE_PER_BOOT_KEY_FLAG

Instructs VBS to help protect the client key with a per-boot key that is stored in disk but can't be reused across boot cycles.

Example: Creating a key with virtualization-based security

The following sample code shows how to create a 2048-bit VBS key with the RSA algorithm:

voidCreatePersistedKeyGuardKey( void ){ SECURITY_STATUS status; NCRYPT_PROV_HANDLE hProv = 0; NCRYPT_KEY_HANDLE hKey = 0; DWORD dwKeySize = 2048; status = NCryptOpenStorageProvider(&hProv, MS_KEY_STORAGE_PROVIDER, 0); if (status != ERROR_SUCCESS) { wprintf(L"NCryptOpenStorageProvider failed with %x\n", status); goto clean; } status = NCryptCreatePersistedKey(hProv, &hKey, NCRYPT_RSA_ALGORITHM, L"MyKeyName", 0, NCRYPT_REQUIRE_VBS_FLAG); if (status != ERROR_SUCCESS) { wprintf(L"NCryptCreatePersistedKey failed with %x\n", status); goto clean; } status = NCryptSetProperty(hKey, NCRYPT_LENGTH_PROPERTY, (PBYTE)&dwKeySize, sizeof(DWORD), 0); status = NCryptFinalizeKey(hKey, 0); if (status != ERROR_SUCCESS) { wprintf(L"NCryptFinalizeKey failed with %x\n", status); goto clean; } wprintf(L"Created a persisted Key Guard key!\n");clean: if (hKey) { NCryptFreeObject(hKey); } if (hProv) { NCryptFreeObject(hProv); }}

Using VBS keys

Beyond stricter key export policies, a VBS key can be treated like any other Cryptographic Next Generation (CNG) key when it comes to API usage, so developers can refer to the NCrypt API here. This applies to use cases like signing and encryption.

Try protecting your keys with VBS today

This feature is now in Preview and accessible via the Windows Insider Program for both client (Windows 11 Insider Preview Build 26052) and Server (Windows Server Insider Preview Build 26052) The following requirements must be met:

  • VBS enabled
    • VBS also has several hardware requirements to run, including Hyper-V (Windows hypervisor), 64-bit architecture, and IOMMU support. See the full list of VBS hardware requirements.
  • TPM enabled: For bare-metal environments, TPM 2.0 is required. For VM environments, vTPM (Virtual TPM) is supported.
  • UEFI with Secure Boot enabled

Having trouble?

Enable event log to investigate errors:

  • Search “Event Viewer” in the start menu
  • On the left panel open Applications and Services Logs > Microsoft > Windows > Crypto-NCrypt
  • Right-click Operational and select Enable Log (it may already be enabled)
  • Right click error events with Event ID 13, 14, or 15 and Task Category “VBS Key Isolation Operation”

We recommend sending any suggestions, questions, or logs through Feedback Hub under Security and Privacy > VBS Key Protection.

You may also reach out to VBSkeyprotection@microsoft.com with questions.

What’s next?

Stay on the lookout for further announcements to support key protection with VBS, and we’ll continue updating our documentation and support guidelines accordingly. We hope that you’ll be able to leverage this security capability to help protect your keys on Windows.

Continue the conversation. Find best practices. Bookmark the Windows Tech Community, then follow us @MSWindowsITPro on X/Twitter. Looking for support? Visit .

Advancing key protection in Windows using VBS (2024)
Top Articles
Buy crypto using MoonPay
What Is Data Mining? A Beginner's Guide (2022) | Rutgers Bootcamps
English Bulldog Puppies For Sale Under 1000 In Florida
12 Rue Gotlib 21St Arrondissem*nt
Arkansas Gazette Sudoku
Evil Dead Rise Showtimes Near Massena Movieplex
Cumberland Maryland Craigslist
Kentucky Downs Entries Today
Learn How to Use X (formerly Twitter) in 15 Minutes or Less
Herbalism Guide Tbc
Summoner Class Calamity Guide
Unit 33 Quiz Listening Comprehension
Unlv Mid Semester Classes
N2O4 Lewis Structure & Characteristics (13 Complete Facts)
Katherine Croan Ewald
Velocity. The Revolutionary Way to Measure in Scrum
Obsidian Guard's Cutlass
Earl David Worden Military Service
Amih Stocktwits
Indystar Obits
Iroquois Amphitheater Louisville Ky Seating Chart
Poe Str Stacking
Aerocareusa Hmebillpay Com
Ppm Claims Amynta
Costco Gas Hours St Cloud Mn
3 Ways to Drive Employee Engagement with Recognition Programs | UKG
Best Town Hall 11
Sacramento Craigslist Cars And Trucks - By Owner
Isablove
A Plus Nails Stewartville Mn
County Cricket Championship, day one - scores, radio commentary & live text
Wasmo Link Telegram
Craigslist Dallastx
Walter King Tut Johnson Sentenced
PA lawmakers push to restore Medicaid dental benefits for adults
Domino's Delivery Pizza
Boggle BrainBusters: Find 7 States | BOOMER Magazine
Fifty Shades Of Gray 123Movies
Gary Lezak Annual Salary
A Comprehensive 360 Training Review (2021) — How Good Is It?
SF bay area cars & trucks "chevrolet 50" - craigslist
2023 Fantasy Football Draft Guide: Rankings, cheat sheets and analysis
Weather Underground Corvallis
Simnet Jwu
How to Quickly Detect GI Stasis in Rabbits (and what to do about it) | The Bunny Lady
Sour OG is a chill recreational strain -- just have healthy snacks nearby (cannabis review)
Jaefeetz
Makes A Successful Catch Maybe Crossword Clue
Ts In Baton Rouge
60 Second Burger Run Unblocked
4015 Ballinger Rd Martinsville In 46151
Blippi Park Carlsbad
Latest Posts
Article information

Author: Manual Maggio

Last Updated:

Views: 5971

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Manual Maggio

Birthday: 1998-01-20

Address: 359 Kelvin Stream, Lake Eldonview, MT 33517-1242

Phone: +577037762465

Job: Product Hospitality Supervisor

Hobby: Gardening, Web surfing, Video gaming, Amateur radio, Flag Football, Reading, Table tennis

Introduction: My name is Manual Maggio, I am a thankful, tender, adventurous, delightful, fantastic, proud, graceful person who loves writing and wants to share my knowledge and understanding with you.