Breaking COMposure: Journey to Hunting Windows COM Vulnerabilities

ByungHyun Kang

BSides Canberra VIII (2025) · Day 2 · Off-Main Track

Overview

In this insightful presentation, ByungHyun Kang (also known as Kang) delves into the intricate world of Windows Component Object Model (COM) vulnerabilities, offering a comprehensive guide for security researchers and bug hunters. The talk, titled "Breaking COMposure," outlines what COM components are, why they present a fertile ground for high-impact security flaws, and Kang's personal journey in discovering new vulnerabilities within this foundational operating system technology.

Watch on YouTube

Visual summary for Breaking COMposure: Journey to Hunting Windows COM Vulnerabilities by ByungHyun Kang
Visual summary for Breaking COMposure: Journey to Hunting Windows COM Vulnerabilities by ByungHyun Kang

Key moments

  1. 0:00 Introduction and talk agenda
  2. 2:10 In-process vs. Out-of-process COM
  3. 15:40 Why COM is a Gold Mine for Privilege Escalation
  4. 19:00 Real-world COM Bug: Windows Wallet Service
  5. 22:00 Race Condition Bug: Capability Access Server
  6. 30:00 Tools and Fuzzing for COM Vulnerabilities
  7. 39:45 Speaker's MCP Management Bug (with demo)
  8. 44:00 Audience Q&A: COM Access and Remote Exploitation

Breaking COMposure: Journey to Hunting Windows COM Vulnerabilities

Speakers: ByungHyun Kang

Conference: BSides Canberra

YouTube: https://www.youtube.com/watch?v=TBMyjoTDf-0

Overview

In this insightful presentation, ByungHyun Kang (also known as Kang) delves into the intricate world of Windows Component Object Model (COM) vulnerabilities, offering a comprehensive guide for security researchers and bug hunters. The talk, titled "Breaking COMposure," outlines what COM components are, why they present a fertile ground for high-impact security flaws, and Kang's personal journey in discovering new vulnerabilities within this foundational operating system technology.

Kang's research highlights COM as a critical, yet often overlooked, attack surface within Microsoft Windows. He meticulously explains how COM's architecture, particularly its out-of-process communication models and threading paradigms, creates inherent risks that can be exploited for privilege escalation and sandbox escapes. By focusing on older, foundational parts of the operating system that are still widely in use, Kang demonstrates a strategic approach to uncovering the next generation of Windows zero-day exploits, positioning COM as a "goldmine" for serious vulnerability research.

The presentation provides both theoretical underpinnings and practical methodologies, drawing on previous research and real-world examples to illustrate common vulnerability types. Kang then details his own bug hunting process, including the tools and techniques used for enumerating and fuzzing COM objects, culminating in the discovery of a new race condition and use-after-free (UAF) vulnerability. This talk serves as an invaluable resource for anyone looking to deepen their understanding of Windows internal security and embark on their own journey into COM bug hunting.

Background

▶ Watch: Introduction and talk agenda (0:00)

The Component Object Model (COM) stands as a core component of the Windows operating system, engineered by Microsoft to facilitate seamless communication and interoperability between disparate software components. Functioning as a universal translator, COM enables programs written in various languages, such as C++, C#, and Python, to interact cohesively. This capability underpins numerous Windows functions, from embedding an Excel file into a Word document to interacting with printer drivers, effectively connecting diverse applications and operating system elements.

COM components are categorized into two primary models: in-process and out-of-process. The in-process model, characterized by high performance, allows the client and COM server to operate within the same memory space, communicating via direct function calls. While efficient, this model poses a security risk as the COM server inherits the client's privileges, making it unsuitable for privilege escalation research. In stark contrast, the out-of-process model, particularly local servers and remote servers, is a critical area for security research. Local servers run as separate standalone processes (e.g., .exe files) from the client application. The significant security concern here is that the COM server often runs with elevated privileges (e.g., System), even if the client application operates with standard user privileges. This privilege disparity makes out-of-process COM a prime target for attackers seeking privilege escalation. Remote servers extend this architecture, allowing client-server communication over a network (typically TCP/IP), enabling a low-privileged client to interact with a highly privileged COM server on a different machine, opening vectors for remote code execution (RCE) and privilege escalation. Both out-of-process models rely on cross-process communication, where a low-privileged client sends data across a trust boundary to a highly privileged server process. The robust handling of potentially malformed or unexpected data by the server is paramount; failure to do so can lead to crashes or arbitrary code execution.

Microsoft has implemented several security validations to protect COM objects. The first layer, launch permissions, dictates who can initiate an instance of a COM object, validated by the CoCreateInstance call. If a client lacks the necessary rights, object creation fails. The second layer, access permissions, controls whether a client can actually invoke methods on the running object. This two-tiered system acts as a powerful defense mechanism, preventing low-privileged users from exploiting privileged services even if they manage to launch the process.

The mechanism enabling cross-process COM communication is marshalling, facilitated by proxies and stubs. The proxy, residing in the client's process, packages method names and parameters (marshalling) for transfer. This packaged data is then sent across the process boundary, often via Remote Procedure Call (RPC). The stub, located in the server's process, receives this data and reconstructs it (unmarshalling) before dispatching the actual call to the COM server's method. This transparent system ensures seamless interaction despite process separation. Marshalling can be either standard or custom. Standard marshalling is the default for universally recognized COM interfaces (e.g., IUnknown, IDispatch) and is handled automatically by system libraries like ole32.dll. This built-in approach simplifies development and enhances security due to rigorous testing. Conversely, custom marshalling is required for non-standard interfaces, where developers define the entire communication process using an Interface Definition Language (IDL) file. A MIDL compiler then generates the necessary proxy and stub DLLs. While offering flexibility, custom marshalling is a prime target for security researchers, as errors in the custom IDL or generated code can introduce vulnerabilities.

COM objects also adhere to specific threading models. The Single-Threaded Apartment (STA) model simplifies development by ensuring a COM object is only called by a single dedicated thread, with the COM runtime serializing all calls from other threads. This eliminates concerns about race conditions and deadlocks. However, the Multi-Threaded Apartment (MTA) model allows multiple threads to call a COM object concurrently. In this model, the COM object developer is solely responsible for implementing thread safety using synchronization primitives like mutexes or semaphores. A failure to correctly implement thread-safe code in an MTA object can lead to race conditions, data corruption, or exploitable crashes, making MTA objects a key area for vulnerability discovery.

The cumulative understanding of COM's architecture, security mechanisms, marshalling techniques, and threading models reveals why it is a compelling target for bug hunting. COM provides a direct communication channel between low-privileged clients and high-privileged servers, making it a "goldmine" for privilege escalation and sandbox escapes in Windows. As the security landscape evolves and "low-hanging fruit" vulnerabilities become scarcer, researchers are increasingly turning to older, foundational, and often overlooked components like COM to uncover high-impact bugs.

Key Findings

▶ Watch: Why COM is a Gold Mine for Privilege Escalation (15:40)

Kang's research confirms that the Component Object Model (COM) represents a highly effective and under-explored attack vector within the Windows ecosystem. The core findings underscore COM's potential for privilege escalation and sandbox escapes, positioning it as a critical area for modern vulnerability research.

The key discoveries and contributions from this talk include:

  • COM as a Privilege Escalation Goldmine: The presentation unequivocally establishes COM as a prime target for privilege escalation in Windows. The inherent design of out-of-process COM servers, which often run with elevated privileges while interacting with low-privileged clients, creates a direct pathway for attackers to gain higher levels of system access by exploiting vulnerabilities in these components.
  • Focus on Out-of-Process and Custom Marshalling: Kang highlights that out-of-process COM models, particularly local and remote servers, are where the primary security risks lie. Furthermore, COM objects utilizing custom marshalling are identified as exceptionally rich sources of critical vulnerabilities, due to the increased likelihood of developer errors in defining and implementing non-standard communication protocols.
  • MTA Threading Model Vulnerabilities: The Multi-Threaded Apartment (MTA) threading model is emphasized as a significant area of concern. Because developers are responsible for implementing thread safety in MTA COM objects, any oversight or incorrect implementation of synchronization primitives can lead to exploitable race conditions and use-after-free (UAF) vulnerabilities, as demonstrated by Kang's own findings.
  • Systematic Bug Hunting Methodology Validation: Kang's personal journey, culminating in the discovery of a new vulnerability (CVE-2025-29841), validates a systematic bug hunting methodology. This approach combines a deep architectural understanding of COM, a focused targeting of high-privilege components, and the application of sophisticated fuzzing techniques to uncover complex vulnerabilities in well-vetted system services.
  • Tools and Techniques for COM Enumeration and Fuzzing: The talk introduces practical tools and techniques, such as OLEView.NET for comprehensive COM object enumeration and advanced fuzzers like KFL (hardware-assisted, virtual machine-based) and WhatTheFuzz (user-mode, snapshot-based), providing a clear roadmap for researchers to identify and exploit COM weaknesses.
  • Ongoing Attack Surface: Despite the foundational nature of COM, Kang concludes that the vast number of COM objects within the Windows ecosystem ensures that the attack surface remains too extensive to be fully explored. This confirms COM as a still-fertile and exciting area for ongoing security research, promising further discoveries.

These findings collectively underscore the critical importance of understanding COM's nuances for both defenders seeking to secure Windows systems and researchers aiming to uncover high-impact vulnerabilities.

Technical Deep Dive

▶ Watch: Race Condition Bug: Capability Access Server (22:00)

The technical depth of Kang's presentation extends from foundational COM concepts to the detailed analysis of real-world vulnerabilities and advanced bug hunting methodologies.

Kang begins by contextualizing his research within the landscape of prior work. He references a study presented at EEnics 2022 that successfully detected race condition bugs by focusing on the MTA COM object model. This research, which found several vulnerabilities by targeting difficult-to-analyze "b-class" bugs, served as a direct inspiration and groundwork for Kang's own methodology. He also highlights another relevant paper from EEnics 2023 titled "Detecting Union Type Confusion," which explored a different class of vulnerabilities arising from improper use of fundamental C++ concepts like union types or structs in COM objects. This demonstrates that COM's complexity offers diverse exploitation vectors, beyond just concurrency issues, extending to basic data handling errors.

To illustrate these concepts, Kang examines two significant real-world COM vulnerabilities:

  1. CVE-2020-1362 in the Windows Wallet Service:
  • Service: The Windows Wallet Service, a core component handling sensitive payment information, uses a COM object within walletservice.dll. This object runs with high privileges as an out-of-process server hosted by svchost.exe, allowing a low-privileged client to interact with it.
  • Vulnerability: A flaw was discovered in the Wallet Vector Interface, specifically within the SetGroup function of the WalletCustomProperty class. A logical bypass exists where setting argument A4 to any value other than -1 circumvents security validation checks.
  • Impact: This bypass provides an arbitrary write primitive, allowing an attacker to control both the data to be written and its target memory address. This highly dangerous capability can lead to overriding critical data, hijacking program execution, and ultimately achieving privilege escalation or remote code execution. Kang notes that while converting this primitive into a reliable exploit for full code execution can be challenging, the ability to manipulate critical data makes it a severe vulnerability.
  1. CVE-2020-1404 in the Capability Access Server Service:
  • Service: The Capability Access Server Service contains various interfaces, with this specific vulnerability found in the Windows UI Start Screen Secondary Tile interface, particularly ISecondaryTile2.
  • Threading Model: Crucially, this service and its ISecondaryTile2 interface are configured to use the MTA threading model. As discussed, this places the burden of thread safety entirely on the developer.
  • Vulnerability: This is a classic race condition bug. Using a decompiler to analyze the COM server's binary (e.g., CapabilityAccessServer.dll), researchers can examine the .rdata section to find GUIDs and V-table pointers for implemented COM interfaces. Tracing these pointers leads to the actual code. The vulnerability lies within the put_TileName method, which calls the SaveHstring function. SaveHstring in turn calls the Initialize function.
  • Race Condition Mechanism: Within the Initialize function, a critical sequence of Free and Assign on success occurs, involving the WindowsDeleteString API. The core issue is the lack of any locking mechanism or validation routine. In an MTA environment, if Thread A calls Free to release string memory, and before that operation is complete, Thread B attempts to use the same string pointer, it leads to an access violation (crash) and potential Denial of Service (DoS). A skilled attacker could potentially control the timing of these threads to create a predictable crash, serving as a stepping stone for a full exploit. This exemplifies how a bug that wouldn't exist in an STA model becomes a critical vulnerability in an MTA COM object.

Kang then transitions to practical bug hunting. He emphasizes the need to first enumerate and inspect COM objects on a system. The primary tool recommended for this is OLEView.NET, developed by security researcher James Forshaw. This tool acts as a powerful explorer, reading information directly from the Windows registry to display class IDs (CLSIDs), interface IDs (IIDs), and other crucial details for every COM object. Its filtering capabilities are particularly useful, allowing researchers to narrow down searches by threading model or server type, focusing on privileged out-of-process servers—the prime targets for privilege escalation bugs.

For finding bugs, Kang discusses two main options: manual code auditing and fuzzing. While auditing can find logical flaws, it's often too time-consuming. Fuzzing, an automated technique, is more efficient. Effective fuzzers are coverage-guided, meaning they track executed code paths and generate new inputs to explore unreached areas. The challenge for COM servers, especially highly privileged ones, is obtaining reliable code coverage in a runtime process. Kang presents two fuzzing approaches:

  1. KFL (Kernel Fuzzer for Linux): A powerful hardware-assisted fuzzer using inter-process trace for efficient, low-overhead code coverage. It's ideal for fuzzing complex privileged processes like those in svchost.exe because it leverages hardware features like Intel PT to gain real-time, hardware-level visibility into code execution within a virtual machine (QEMU or KVM guest). KFL's agent, running on the host, can focus on a specific COM service process in the guest VM, tracing coverage even if the process is highly privileged or protected. A key challenge is identifying the correct virtual address of the target COM server's module within the guest VM, especially when multiple processes share the same name (e.g., svchost.exe). Kang's solution involves using the CreateToolhelp32Snapshot function within the fuzzer harness (running inside the guest VM) to enumerate all processes and their loaded modules (DLLs). By comparing module names to the target COM object's DLL name (obtained from its CLSID in the registry), the fuzzer can pinpoint the exact base address of the target module and begin collecting coverage data.
  2. WhatTheFuzz: A user-mode fuzzer designed for Windows applications. It simplifies fuzzing by eliminating the need for a VM setup, allowing direct testing of running processes. WhatTheFuzz is a snapshot-based fuzzer that captures and emulates a program's state to achieve code coverage. It can dump necessary information directly when the harness reaches the target server, avoiding the complex address mapping required by KFL. This makes it a more accessible option for user-mode COM server fuzzing.

This detailed technical exploration provides a robust framework for understanding and actively hunting COM vulnerabilities, bridging theoretical knowledge with practical, cutting-edge security research techniques.

Demo / Proof of Concept

▶ Watch: Tools and Fuzzing for COM Vulnerabilities (30:00)

Kang's presentation culminates in the demonstration of a newly discovered vulnerability, assigned CVE-2025-29841, which he found using the described methodology. This bug is a significant race condition and use-after-free (UAF) vulnerability affecting the MCP Management COM Interface.

The vulnerability resides within the MCP Management COM Interface, which exposes eight different methods. Kang chose to audit the GetAuthorizationHeaderSilentAsync function. This function, along with GetAuthorizationHeaderAsync, both call an internal function named GetAuthorizationHeaderInternal. The critical flaw occurs inside GetAuthorizationHeaderInternal.

Vulnerability Breakdown:

  1. Shared Variable Access: The GetAuthorizationHeaderInternal function accesses a shared variable and copies its value into a local variable (B12). This shared variable is key to the vulnerability.
  2. Premature Release: The code then invokes InternalRelease on the value held in B12. Crucially, InternalRelease is responsible for freeing the memory associated with that value.
  3. Race Condition: The problem arises because both GetAuthorizationHeaderSilentAsync and GetAuthorizationHeaderAsync call the same GetAuthorizationHeaderInternal function. In an MTA threading model, where multiple threads can concurrently access shared resources, this creates a classic race condition scenario. Without proper locking mechanisms, one thread can free the memory associated with the shared variable via InternalRelease, while another thread is still attempting to access or use that now-freed memory.
  4. Use-After-Free: This concurrent access to deallocated memory leads directly to a use-after-free condition. When a thread attempts to use memory that has already been freed by another, it typically results in an access violation and a program crash.

Impact: The immediate impact of this UAF is a Denial of Service (DoS), as the target server crashes. Since the MCP Management COM Interface likely runs with system privileges, a crash in such a component can be a stepping stone towards privilege escalation. While a DoS itself might seem less severe, a controlled and predictable crash can often be leveraged as a primitive in a more complex exploit chain to achieve full code execution.

Demo Procedure:

Kang outlined the steps for demonstrating this vulnerability:

  1. Ensure the latest Windows version is running.
  2. Start the target process (the COM server hosting the MCP Management Interface).
  3. Identify the Process ID (PID) of the target server.
  4. Attach a debugger to the target process to observe its state.
  5. Execute the specially crafted Proof-of-Concept (PoC) code.

The expected outcome, as demonstrated, is a crash of the target server, which is running with system privileges. This crash validates the existence of the race condition and use-after-free vulnerability, confirming the effectiveness of Kang's systematic bug hunting methodology. The discovery of CVE-2025-29841 underscores that a deep understanding of COM architecture, combined with a focus on high-privilege targets and sophisticated fuzzing, can yield critical vulnerabilities in even well-vetted system services.

Defensive Implications

▶ Watch: Audience Q&A: COM Access and Remote Exploitation (44:00)

The insights gained from Kang's research into COM vulnerabilities carry significant implications for both developers and security professionals striving to protect Windows systems. Understanding these attack vectors is crucial for implementing robust defensive strategies.

For Developers:

  • Prioritize Thread Safety in MTA Objects: Developers working with Multi-Threaded Apartment (MTA) COM objects must treat thread safety as a paramount concern. Any shared resources, including pointers or data structures accessed by multiple threads, must be rigorously protected using appropriate synchronization primitives such as mutexes, semaphores, or critical sections. The failure to implement these mechanisms correctly, as seen in CVE-2020-1404 and Kang's own UAF finding, directly leads to race conditions and use-after-free vulnerabilities.
  • Exercise Caution with Custom Marshalling: While custom marshalling offers flexibility, it significantly increases the attack surface. Developers should avoid it unless absolutely necessary. When custom marshalling is implemented, the Interface Definition Language (IDL) file and the generated proxy/stub code must undergo meticulous security review and rigorous testing to prevent errors in data handling or protocol definitions that could lead to vulnerabilities.
  • Review Memory Management Operations: Pay close attention to memory allocation and deallocation routines, especially when dealing with shared pointers or objects in concurrent environments. Operations like Free followed by Assign or similar patterns, as demonstrated in the SaveHstring and Initialize functions, are major red flags if not properly synchronized.

For Defenders and System Administrators:

  • Prompt Patching: Given that COM vulnerabilities frequently lead to privilege escalation or remote code execution, it is critical to apply security updates and patches from Microsoft promptly. These vulnerabilities are often exploited by attackers to gain initial foothold or elevate privileges on compromised systems.
  • Implement Least Privilege: Ensure that COM servers and the processes hosting them operate with the absolute minimum necessary privileges. If a COM component can function correctly with user-level privileges, it should not be configured to run as System. This mitigates the impact of a successful exploit, limiting the attacker's gained privileges.
  • Network Segmentation for Remote COM: For COM servers exposed over the network (remote servers), robust network segmentation and firewall rules are essential. Restrict access to these components only to authorized machines and users, minimizing the risk of remote attacks.
  • Enhanced Monitoring and Logging: Deploy comprehensive monitoring solutions that can detect unusual activity related to COM object instantiation, method calls, or process crashes, particularly from low-privileged users or unexpected network sources. Look for patterns indicative of attempted exploitation.
  • Regular Security Audits: Conduct regular security audits of COM objects installed on critical systems. Utilize tools like OLEView.NET to enumerate COM objects, identify those running with high privileges, and prioritize them for deeper security analysis. Pay special attention to custom COM implementations or those operating in MTA models.
  • Endpoint Detection and Response (EDR): Leverage EDR solutions to detect and prevent exploitation attempts. These tools can often identify malicious behavior patterns associated with COM-based attacks, such as unexpected process injection or privilege escalation attempts originating from COM server processes.

Kang's research reinforces that COM is not merely a theoretical attack surface but a practical and valuable path for bypassing sandbox restrictions and achieving full system compromise. By addressing these defensive implications, organizations can significantly reduce their exposure to COM-based attacks.

Key Takeaways

  • COM is a Critical Attack Surface: The Windows Component Object Model (COM) is a foundational, yet often overlooked, part of the operating system that serves as a "goldmine" for privilege escalation and sandbox escape vulnerabilities.
  • Out-of-Process and MTA Models are Prime Targets: Out-of-process COM servers (local and remote), especially those utilizing custom marshalling or operating under the Multi-Threaded Apartment (MTA) threading model, are particularly susceptible to security flaws due to complex interactions and developer-managed thread safety.
  • Race Conditions and Use-After-Free are Prevalent: Failures in implementing proper synchronization mechanisms in MTA COM objects can lead to critical race conditions and use-after-free (UAF) vulnerabilities, allowing for crashes, denial of service, and potential privilege escalation.
  • Systematic Methodology Yields Results: A structured approach combining deep architectural understanding, targeted enumeration of high-privilege COM objects (using tools like OLEView.NET), and advanced coverage-guided fuzzing (with tools like KFL or WhatTheFuzz) is highly effective for discovering new COM bugs.
  • New Vulnerability Discovered: Kang successfully identified a new race condition/use-after-free vulnerability (CVE-2025-29841) in the MCP Management COM Interface, demonstrating the practical applicability and effectiveness of his research methodology.
  • Defensive Measures are Crucial: Developers must prioritize thread safety and meticulous code review for custom COM objects, while defenders need to enforce least privilege, apply patches promptly, and monitor COM activity to mitigate the significant risks posed by these vulnerabilities.

About the Speaker(s)

ByungHyun Kang, known as Kang, is a security researcher from South Korea. He holds a degree in Computer Science and has a strong interest in bug hunting, particularly focusing on Windows and other system-level vulnerabilities. His work, as demonstrated in this talk, highlights a deep engagement with understanding and dissecting core operating system components to uncover critical security flaws.

Reviews

→ Top-rated talks at BSides Canberra VIII (2025)

All talks from BSides Canberra VIII (2025)