Researcher Demonstrates OAuth Token Theft Through a Sideloaded Windows AppX Host

· Original article ↗

Summary

A researcher demonstrated stealing Microsoft 365 OAuth tokens through a sideloaded AppX package on Windows 11. The technique requires Developer Mode or an enterprise sideloading policy; the article also describes network detection and defensive controls.

Key points

  • On Windows 11 24H2, a sideloaded AppX package used WWAHost.exe and WindowsRuntimeAccess="all" to run attacker-controlled JavaScript and invoke Microsoft’s legitimate OAuth sign-in flow.
  • The demonstrated attack requires Developer Mode or an enterprise AllowAllTrustedApps policy, plus code execution in the user’s session; registering the package then requires no further administrator privileges.
  • The researcher captured access and refresh tokens after the user completed a real Microsoft sign-in and MFA. The delegated token’s effective access depends on the victim’s privileges, and the refresh token can persist until revoked or otherwise invalidated.
  • The recommended network detection looks for the MSAppHost/3.0 user agent connecting to non-Microsoft destinations; AppX registration and related endpoint or identity events can provide corroborating signals.
  • Defenders are advised to audit and restrict Developer Mode and sideloading, tune the Microsoft-domain allow-list, and use Conditional Access, Token Protection where available, and Continuous Access Evaluation.
  • Only the WWAHost OAuth token-theft path was demonstrated end-to-end on 24H2. Other described WinRT capabilities were not re-confirmed on that build, and silent token acquisition was unverified.

Article Details

Attack Vectors
  • After code execution in a user session, an attacker registers a sideloaded AppX package when Developer Mode or the enterprise AllowAllTrustedApps policy is enabled.
  • The package grants remote JavaScript WindowsRuntimeAccess="all" and loads it in the Microsoft-signed WWAHost.exe process.
  • The JavaScript invokes WebAuthenticationBroker to present Microsoft's real sign-in and MFA flow, then captures the returned authorization code and exchanges it for access and refresh tokens.
  • The captured refresh token can be used from another machine and network to obtain new access tokens without further user interaction, until revoked or otherwise invalidated.
  • On Windows 11 22H2, the article reports additional lab demonstrations involving CredentialPicker plaintext credential capture, user-scoped DPAPI decryption, and protocol-handler launching; these were not all re-confirmed end-to-end on 24H2.
Defensive Notes
  • Deploy a proxy, SIEM, or firewall rule to alert on the MSAppHost/3.0 user agent reaching destinations outside an appropriately tuned Microsoft-owned-domain allow-list.
  • Audit and restrict Developer Mode and the enterprise AllowAllTrustedApps sideloading policy; the article identifies these settings as the package-registration gate.
  • Investigate Add-AppxPackage -Register activity, especially registrations from outside C:\Program Files\WindowsApps, and AppX manifests in user-writable paths that grant WindowsRuntimeAccess="all" to external URLs.
  • Monitor outbound connections from AppX host binaries to non-Microsoft IPs, including with Windows Filtering Platform auditing or Sysmon Event ID 3.
  • Require compliant or managed devices for token issuance, consider Token Protection where available, and shorten refresh-token lifetimes or enable Continuous Access Evaluation to limit persistence.

MITRE ATT&CK

People

Vendors

Products

Tools

Related Articles