Akash Trehan
Blog

Can you trust a hacked PC? An intro to Windows Runtime Attestation

Why anti-cheat and security tools can't trust what a hacked PC tells them, and how the Windows Runtime Attestation Report gives them evidence a compromised kernel can't forge.

By Akash Trehan · · 9 min read
Can the kernel lie? Part 1 of the Windows Runtime Attestation Report series. Under the question, the normal kernel's unsigned answer 'All clean' sits beside a signed report from the Secure Kernel.
Can you trust a hacked PC? An intro to Windows Runtime Attestation
Series Windows Runtime Attestation Report Part 1 of 5
  1. 1 Can you trust a hacked PC? An intro to Windows Runtime Attestation You are here
  2. 2 What's in the package? Calling the Windows Runtime Attestation API
  3. 3 The chain of trust Coming soon
  4. 4 Patch or attack? Inside the Windows Secure Hotpatch Report
  5. 5 The Secure Driver Report Coming soon
About this series

The nastiest game cheats don’t live in the game, and the nastiest malware doesn’t live in your apps. Both run in kernel mode, where user-mode software simply can’t see them.

So anti-cheat, EDR and antivirus went into the kernel too. Now it’s two drivers at the same privilege level, and whoever loads first, hides best, or blinds the other wins.

Security software learns what’s loaded in two ways. It asks the kernel, through callbacks and query APIs, or its own driver reads the kernel’s memory directly. An attacker running at the same privilege level can tamper with both.

A hacked computer will happily lie to you about being hacked.

Kernel mode holds a security driver and an attacker's driver side by side at the same privilege level. User mode, below, cannot see into the kernel. The attacker’s driver can change what the security driver sees, and the reverse is true as well.

Windows now has a way out of this, and it’s genuinely one of my favourite things we’ve shipped. It’s called the Windows Runtime Attestation Report. This post covers the problem it solves, why the attestation that already existed doesn’t solve it, and what the report gives you instead. The rest of the series goes into how it works.

A note on where this comes from: I work on the Windows Secure Kernel team at Microsoft, and I built the Runtime Attestation Report framework.

Anti-cheat is the easiest example to picture, but the same problem exists for any service that has to decide whether to trust someone else’s PC. The service runs on a server somewhere else, and all it knows about that PC is what the PC tells it.

What is remote attestation?

Everything the security driver knows comes from the kernel’s memory and responses, and the attacker’s driver can tamper with both. Writing a smarter security driver doesn’t fix that.

The security driver’s verdict isn’t safe either. It sits in that same memory, so the attacker can change it before anyone acts on it. That’s why the decision that matters, such as whether this PC can join the match, gets made on a server the attacker can’t touch. The PC sends facts about itself, and the server decides.

This is remote attestation: a machine proving facts about itself to a party that has no reason to believe it.

It only works if the facts come from a part of the machine the attacker doesn’t control, and can’t be altered on the way to the server. So there are two questions to ask of any attestation scheme: who produces the evidence (what is the root of trust), and what does the evidence cover?

What exists today, and where it stops

Remote attestation isn’t new. You may already know three kinds of it: measured boot, Linux IMA and enclave attestation. Each one answers those two questions differently. Here is what each one covers and where it stops:

A comparison of three existing kinds of attestation. Measured boot is produced by firmware and boot code and stops after startup. Linux IMA is produced by the Linux kernel, which measures itself, and doesn't cover changes in memory after load. Enclave attestation covers the code inside the enclave and not what the OS around it has loaded. All three are still useful for what they cover.

Measured boot

This is the one most people think of. As a Windows machine starts, the firmware records in the TPM a hash of the firmware, the boot loader, the boot drivers and everything else that loads before the anti-malware driver. A server can later ask the TPM for a signed quote of the final values, check the log of measurements against it, and confirm that the machine started the way it should have.

Measured boot describes how the machine started. It does not describe a driver that loaded twenty minutes ago or a patch applied since.

On a timeline, the gap looks like this:

A timeline from power on to now. Measured boot covers only startup and records it in the TPM. A driver that loads later is not covered. A runtime report describes the machine at the moment of the request. A machine can start clean and be compromised twenty minutes later.

Runtime measurement on Linux

Linux goes further with the Integrity Measurement Architecture (IMA). Depending on policy, IMA hashes files as they are opened, executed or loaded as kernel modules. It appends each hash to a log and extends a TPM register with it. A server can then ask the TPM for a signed quote of that register and check that the log hasn’t been tampered with.

That covers the time after boot. But IMA is part of the Linux kernel, so the measuring is done by the kernel being measured. It also measures a file when the file is loaded, and changes made in memory afterwards are out of its scope.

Enclave attestation

The third kind comes from trusted execution environments such as Intel SGX and VBS enclaves on Windows. An enclave is a small isolated region that the rest of the system can’t read or modify. It can produce a signed statement about itself: which code is running inside it, and that the platform underneath is genuine. On Windows the call is EnclaveGetAttestationReport, which returns a report that “describes the current enclave”.

That is the right evidence if you need to know that your code is running untouched inside the enclave. The report describes the enclave and the security version of the platform under it. It doesn’t describe what the operating system outside the enclave has loaded, which is what anti-cheat or EDR wants to know.

The Windows Runtime Attestation Report

None of those three tells a server about the state of a running Windows kernel right now, in a form that kernel can’t rewrite. The Runtime Attestation Report is built for that gap. A single Win32 API, GetRuntimeAttestationReport, introduced in Windows 11 version 25H2, returns a package of facts about the machine as it is at the moment of the call. That is where the “runtime” in the name comes from.

The normal kernel doesn’t produce or sign that package. On a machine with Virtualization Based Security enabled, Windows runs a second, much smaller kernel called the Secure Kernel, and the hypervisor isolates it from the normal one. The Secure Kernel signs every package with a key the normal kernel never sees, so even a fully compromised normal kernel can’t forge that signature.

Windows calls the normal world VTL0 and the secure world VTL1. You’ll see those names in the figures and through the rest of the series. If you want to know how the hypervisor keeps the two apart, Microsoft’s Virtual Secure Mode documentation explains it.

Here is the same question put to each kernel:

On the left, a hacked normal kernel answers 'all clean' with a red warning. On the right, the Secure Kernel hands back a signed report the hacked kernel cannot forge. Only the answer on the right carries a signature your server can check.

Measured boot still has a job here: it is how a server comes to trust the Secure Kernel’s signing key, which Part 3 of the series covers.

What’s in a package

The package works like an envelope with several documents inside, and each document is a report of a particular type. A report can describe any state that the Secure Kernel maintains. So far there are three types:

  • The driver report lists kernel drivers that have loaded on the machine, including ones that have since been unloaded, with the image hash and signer of each one.

  • The hotpatch report lists the kernel-mode images that currently have a Microsoft hotpatch applied.

  • The code integrity report describes the code integrity policy in force. It lists updates to that policy since boot, newest first, with the time each one was committed.

The framework is designed so that new report types can be added without changing the API.

A package can carry several reports at once, all under one signature:

A signed outer envelope. Its top row holds the package header, a fresh challenge and one digest per report. Below are the driver, hotpatch and code integrity reports. The fresh challenge is a random value from your server. It stops an old package from being passed off as a new one.

Potential use cases

None of this is specific to games. The report is useful to any software that needs to know the state of a Windows system without taking the kernel’s word for it. Some examples of what it could be used for:

  • Anti-cheat needs to know the state of the system a player is on, from a source a cheat can’t tamper with. Riot’s Vanguard uses the driver report for its on-demand mode.

  • Esports tournaments and online exams ask the same question as anti-cheat, about the machines that players and test-takers use.

  • Anti-malware, EDR and incident response need a view of system state that malware in the kernel can’t modify. An EDR can check the hash of each driver in the report against a list of known-malicious and known-vulnerable drivers, and a responder can get a driver list from a machine that is assumed to be compromised.

  • Enterprise IT needs to know whether a laptop is in the state that policy requires before it reaches company data, with a stricter bar for the workstations that admins use to manage production. It can also ask which machines in a fleet have a known-vulnerable driver loaded.

  • Banking, payment and streaming services can check the state of a PC before a high-risk transaction or a high-quality stream, the way mobile apps already check a phone.

  • Code-signing and key services can check the state of a machine before signing a release it built or releasing a secret to it.

  • Kiosks, point-of-sale terminals and ATMs run a small, fixed set of software. Their operator can ask each one for a driver report and compare it with the approved list, and malware on the terminal can’t tamper with the answer.

In each case the report supplies the facts, and the software still decides what to do with them. Today those facts cover drivers, hotpatches and code integrity policy, and each new report type adds more of the system’s state that a server can check.

What’s next

In Part 2, we’ll call GetRuntimeAttestationReport and go through the package it returns field by field, with code from the companion sample.

After that, the series continues with:

  • Part 3: the chain of trust (coming soon). How your server gets the public half of the signing key from the machine’s boot logs, verifies that those logs came from a genuine TPM, and then verifies the signature, the nonce and the report digests.

  • Part 4: the Secure Hotpatch Report. How to tell a Microsoft hotpatch from a malicious hook.

  • Part 5: the Secure Driver Report (coming soon). Which drivers a machine has loaded, with the image hash and signer of each one.

Thank you for reading! If something here is unclear, or you spot a mistake, let me know in the comments. I’d love to hear from you. :)