--- title: "Secure Desktop Accessibility Registry Propagation LPE (RegPwn)" section: "Windows" sectionSlug: "windows-hardening" sourcePath: "src/windows-hardening/windows-local-privilege-escalation/secure-desktop-accessibility-registry-propagation-regpwn.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows-hardening/windows-local-privilege-escalation/secure-desktop-accessibility-registry-propagation-regpwn.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0" --- # Secure Desktop Accessibility Registry Propagation LPE (RegPwn) ## Overview Windows Accessibility features persist user configuration under HKCU and propagate it into per-session HKLM locations. During a **Secure Desktop** transition (lock screen or UAC prompt), **SYSTEM** components re-copy these values. If the **per-session HKLM key is writable by the user**, it becomes a privileged write choke point that can be redirected with **registry symbolic links**, yielding an **arbitrary SYSTEM registry write**.[[1]](#references) The RegPwn technique abuses that propagation chain with a small race window stabilized via an **opportunistic lock (oplock)** on a file used by `osk.exe`.[[1]](#references) ## Registry Propagation Chain (Accessibility -> Secure Desktop) Example feature: **On-Screen Keyboard** (`osk`). The relevant locations are: - **System-wide feature list**: - `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs` - **Per-user configuration (user-writable)**: - `HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\ATConfig\osk` - **Per-session HKLM config (created by `winlogon.exe`, user-writable)**: - `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\Session\ATConfig\osk` - **Secure desktop/default user hive (SYSTEM context)**: - `HKU\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATConfig\osk` Propagation during a secure desktop transition (simplified): 1. **User `atbroker.exe`** copies `HKCU\...\ATConfig\osk` to `HKLM\...\Session\ATConfig\osk`. 2. **SYSTEM `atbroker.exe`** copies `HKLM\...\Session\ATConfig\osk` to `HKU\.DEFAULT\...\ATConfig\osk`. 3. **SYSTEM `osk.exe`** copies `HKU\.DEFAULT\...\ATConfig\osk` back to `HKLM\...\Session\ATConfig\osk`. If the session HKLM subtree is writable by the user, step 2/3 provide a SYSTEM write through a location the user can replace.[[1]](#references) ## Primitive: Arbitrary SYSTEM Registry Write via Registry Links Replace the user-writable per-session key with a **registry symbolic link** that points to an attacker-chosen destination. When the SYSTEM copy occurs, it follows the link and writes attacker-controlled values into the arbitrary target key. Key idea: - Victim write target (user-writable): - `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\Session\ATConfig\osk` - Attacker replaces that key with a **registry link** to any other key. - SYSTEM performs the copy and writes into the attacker-chosen key with SYSTEM permissions. This yields an **arbitrary SYSTEM registry write** primitive.[[1]](#references) ## Winning the Race Window with Oplocks There is a short timing window between **SYSTEM `osk.exe`** starting and writing the per-session key. To make it reliable, the exploit places an **oplock** on: ```text C:\Program Files\Common Files\microsoft shared\ink\fsdefinitions\oskmenu.xml ``` When the oplock triggers, the attacker swaps the per-session HKLM key for a registry link, lets the SYSTEM write land, then removes the link.[[1]](#references) ## Example Exploitation Flow (High Level) 1. Get current **session ID** from the access token. 2. Start a hidden `osk.exe` instance and sleep briefly (ensure the oplock will trigger). 3. Write attacker-controlled values to: - `HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\ATConfig\osk` 4. Set an **oplock** on `C:\Program Files\Common Files\microsoft shared\ink\fsdefinitions\oskmenu.xml`. 5. Trigger **Secure Desktop** (`LockWorkstation()`), causing SYSTEM `atbroker.exe` / `osk.exe` to start. 6. On oplock trigger, replace `HKLM\...\Session\ATConfig\osk` with a **registry link** to an arbitrary target. 7. Wait briefly for the SYSTEM copy to complete, then remove the link.[[1]](#references) ## Converting the Primitive to SYSTEM Execution One straightforward chain is to overwrite a **service configuration** value (e.g., `ImagePath`) and then start the service. The RegPwn PoC overwrites the `ImagePath` of **`msiserver`** and triggers it by instantiating the **MSI COM object**, resulting in **SYSTEM** code execution.[[1]](#references)[[2]](#references) ## Related For other Secure Desktop / UIAccess behaviors, see: [Uiaccess Admin Protection Bypass](/hacktricks/windows-hardening/windows-local-privilege-escalation/uiaccess-admin-protection-bypass) ## References - [1] [RIP RegPwn](https://www.mdsec.co.uk/2026/03/rip-regpwn/) - [2] [RegPwn PoC](https://github.com/mdsecactivebreach/RegPwn)