Skip to the content.

Attack Surface

This is an evolving document, describing currently known attack surface, a few mitigations, and several open questions. This is a work in progress. We document our current understanding with the intent of improving both our understanding and our security posture over time.

WireGuard for Windows consists of four components: a kernel driver, and three separate interacting userspace parts.

WireGuardNT

WireGuardNT is a kernel driver. It exposes:

Tunnel Service

The tunnel service is a userspace service running as Local System, responsible for creating WireGuardNT adapters and configuring them. It exposes:

Manager Service

The manager service is a userspace service running as Local System, responsible for starting and stopping tunnel services, and ensuring a UI program with certain handles is available to Administrators. It exposes:

UI

The UI is a process running for each user who is in the Administrators group (per the above), running with the elevated high integrity linked token. It exposes:

Updates

A server hosts the result of b2sum -l 256 *.msi > list && signify -S -e -s release.sec -m list && upload ./list.sec, with the private key stored on an HSM. The MSIs in that list are only the latest ones available, and filenames fit the form wireguard-${arch}-${version}.msi. The updater, running as part of the manager service, downloads this list over TLS and verifies the signify Ed25519 signature of it. If it validates, then it finds the first MSI in it for its architecture that has a greater version. It then downloads this MSI from a predefined URL to a randomly generated (256-bits) file name inside C:\Windows\Temp with permissions of O:SYD:PAI(A;;FA;;;SY)(A;;FR;;;BA), scheduled to be cleaned up at next boot via MoveFileEx(MOVEFILE_DELAY_UNTIL_REBOOT), and verifies the BLAKE2b-256 signature. If it validates, then it calls WinTrustVerify(WINTRUST_ACTION_GENERIC_VERIFY_V2, WTD_REVOKE_WHOLECHAIN) on the MSI. If it validates, then it executes the installer with msiexec.exe /qb!- /i, using the elevated token linked to the IPC UI session that requested the update. Because msiexec requires exclusive access to the file, the file handle is closed in between the completion of downloading and the commencement of msiexec. Hopefully the permissions of C:\Windows\Temp are good enough that an attacker can’t replace the MSI from beneath us.