Skip to content
.ca
5 minhigh

A Deep Dive into the GetProcessHandleFromHwnd API

The GetProcessHandleFromHwnd API contains historical design flaws allowing attackers to bypass User Interface Privilege Isolation (UIPI) and hijack Protected Processes. By forcing a protected process like WerFaultSecure.exe to create a window, attackers can obtain a privileged handle to inject shellcode, a vulnerability that remains exploitable on Windows 10 and pre-24H2 Windows 11 systems.

Conf:mediumAnalyzed:2026-03-19reports

Source:Projectzero

IOCs · 1

Key Takeaways

  • The GetProcessHandleFromHwnd API can be abused to obtain privileged handles to protected processes, bypassing security boundaries.
  • While CVE-2023-41772 addressed some aspects of this vulnerability, pre-24H2 Windows 11 and Windows 10 systems remain vulnerable to protected process hijacking.
  • Attackers can force WerFaultSecure.exe to create a message-only window and use the API to gain PROCESS_VM_WRITE access, allowing shellcode injection.
  • Windows 11 24H2 introduces strict UIPI enforcement and feature flags (ResponsiblePid, UIPIAlwaysOn) that effectively mitigate this attack vector.

Affected Systems

  • Windows 10
  • Windows 11 pre-24H2
  • Windows 11 23H2 Enterprise/Education

Vulnerabilities (CVEs)

  • CVE-2023-41772

Attack Chain

The attacker executes WerFaultSecure.exe at the Protected TCB level in 'upload' mode, passing specific process and section handles. This forces the protected process to create a message-only window. The attacker then enumerates windows using FindWindowEx to locate the newly created window. Finally, the attacker calls GetProcessHandleFromHwnd on the window handle to obtain a process handle with PROCESS_VM_WRITE access, allowing them to allocate memory and inject shellcode into the protected process.

Detection Availability

  • YARA Rules: No
  • Sigma Rules: No
  • Snort/Suricata Rules: No
  • KQL Queries: No
  • Splunk SPL Queries: No
  • EQL Queries: No
  • Other Detection Logic: No

The article does not provide specific detection rules but discusses the underlying API mechanics, registry modifications, and command-line parameters used for exploitation.

Detection Engineering Assessment

EDR Visibility: Medium — EDRs can monitor process creation events for WerFaultSecure.exe with the specific '-u -p' arguments, as well as cross-process handle creation and memory allocation indicative of process injection. Network Visibility: None — This is a local privilege escalation and defense evasion technique involving local Windows APIs and memory manipulation, generating no network traffic. Detection Difficulty: Moderate — Detecting the specific API call GetProcessHandleFromHwnd is difficult without deep API hooking, but the prerequisite execution of WerFaultSecure.exe with specific flags or modifications to UIPI registry keys are highly detectable.

Required Log Sources

  • Process Creation (Event ID 4688 / Sysmon Event ID 1)
  • Process Access (Sysmon Event ID 10)
  • Registry Modifications (Sysmon Event ID 12/13)

Hunting Hypotheses

HypothesisTelemetryATT&CK StageFP Risk
Look for WerFaultSecure.exe executing with the '-u' and '-p' flags, which may indicate an attempt to force window creation for protected process hijacking.Process Creation logs (Event ID 4688 or Sysmon Event ID 1)Privilege EscalationMedium
Monitor for registry modifications to HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnforceUIPI setting the value to 0, indicating an attempt to disable UIPI.Registry monitoring (Sysmon Event ID 12/13)Defense EvasionLow
Search for execution of ViveTool.exe or similar utilities targeting feature IDs 56625134 or 56032228 to disable UIPI protections.Process Creation logs (Event ID 4688 or Sysmon Event ID 1)Defense EvasionLow

Control Gaps

  • Lack of API-level visibility for GetProcessHandleFromHwnd in standard logging
  • Inability to prevent KernelMode handle duplication in pre-24H2 Windows versions

Key Behavioral Indicators

  • WerFaultSecure.exe command line arguments (-u -p -ip -s)
  • Registry changes to EnforceUIPI
  • ViveTool execution targeting specific feature IDs (56625134, 56032228)

False Positive Assessment

  • Medium (Legitimate crash reporting might trigger WerFaultSecure.exe alerts, requiring tuning based on parent processes and environment baselines).

Recommendations

Immediate Mitigation

  • Monitor for unauthorized execution of ViveTool.exe or similar tools disabling security feature flags.
  • Alert on WerFaultSecure.exe executed with '-u' and '-p' arguments outside of normal crash reporting behavior.

Infrastructure Hardening

  • Upgrade endpoints to Windows 11 24H2 where UIPI enforcement and the ResponsiblePid feature flag mitigate this attack.
  • Ensure UIPI is enforced via Group Policy and prevent local administrators from disabling it via the registry.

User Protection

  • Implement Endpoint Privilege Management (EPM) to prevent unauthorized users from running tools like ViveTool or modifying HKLM registry keys.

Security Awareness

  • Educate detection engineers on the risks of message-only windows being used as a vector for cross-process handle duplication and protected process hijacking.

MITRE ATT&CK Mapping

  • T1068 - Exploitation for Privilege Escalation
  • T1055 - Process Injection
  • T1562.001 - Impair Defenses: Disable or Modify Tools
  • T1134 - Access Token Manipulation

Additional IOCs

  • Registry Keys:
    • HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System - Target registry key for disabling UIPI via the EnforceUIPI DWORD.
  • File Paths:
    • oleacc.dll - Legacy library containing the original hook-based implementation of the API.
    • oleacchooks.dll - Library containing the hook function for the API in Windows 7 and later.
    • win32kfull.sys - Kernel driver exposing the NtUserGetWindowProcessHandle function.
  • Command Lines:
    • Purpose: Execute WerFaultSecure.exe in upload mode to force window creation for handle hijacking. | Tools: WerFaultSecure.exe | Stage: Privilege Escalation | WerFaultSecure.exe -u -p
    • Purpose: Disable UIPIAlwaysOn feature flag using ViveTool to weaken system defenses. | Tools: ViveTool.exe | Stage: Defense Evasion | ViveTool.exe /disable /id:56625134
    • Purpose: Disable ResponsiblePid feature flag using ViveTool to revert to the vulnerable API implementation. | Tools: ViveTool.exe | Stage: Defense Evasion | ViveTool.exe /disable /id:56032228
  • Other:
    • ViveTool.exe - Third-party tool used to disable Windows feature flags related to UIPI and API security.