CVE-2025-50165 — Windows Graphics Component Remote Code Execution Vulnerability
Executive Summary
Untrusted pointer dereference in Microsoft Graphics Component allows an unauthorized attacker to execute code over a network.
Overview
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C
EPSS Score
Patch Diff
Patch diff 10.0.26100.4768 -> 10.0.26100.4946 (WIC/JPEG XL rawtranscode uninitialized function pointers)
| Function | Address | Change | Note |
|---|---|---|---|
wil::details::EnsureSubscribedToFeatureConfigurationChanges |
180134990 |
refcount, calling | similarity 1.0 |
wil::details::WilApi_GetFeatureEnabledState |
1801388a8 |
refcount, calling | similarity 1.0 |
wil::details::ReportUsageToService |
1800c470c |
refcount, calling | similarity 1.0 |
wil::details_abi::heap_buffer::push_back |
180138da8 |
refcount, calling | similarity 1.0 |
API-MS-WIN-CORE-SYNCH-L1-1-0.DLL::AcquireSRWLockExclusive |
EXTERNAL:0000004c |
refcount, calling | similarity 1.0 |
rawtransencode_master_selection |
180188a8c -> 180188ddc |
code, length, address, called | similarity 0.45 |
wil::details::unique_storage<wil::details::resource_policy<_RTL_SRWLOCK*___ptr64,void_(__cdecl*)(_RTL_SRWLOCK*___ptr64),&void___cdecl_ReleaseSRWLockExclusive(struct__RTL_SRWLOCK*___ptr64),wistd::integral_constant<unsigned___int64,1>,_RTL_SRWLOCK*___ptr64,_RTL_SRWLOCK*___ptr64,0,std::nullptr_t>_>::~unique_storage<wil::details::resource_policy<_RTL_SRWLOCK*___ptr64,void_(__cdecl*)(_RTL_SRWLOCK*___ptr64),&void___cdecl_ReleaseSRWLockExclusive(struct__RTL_SRWLOCK*___ptr64),wistd::integral_constant<unsigned___int64,1>,_RTL_SRWLOCK*___ptr64,_RTL_SRWLOCK*___ptr64,0,std::nullptr_t>_> |
180133650 |
refcount, calling | similarity 1.0 |
rawtranscode_compress_output |
180098e10 |
refcount | similarity 1.0 |
Root Cause Analysis
Root Cause Analysis — CVE-2025-50165
Summary
| Field | Value |
|---|---|
| CVE | CVE-2025-50165 |
| Binary | windowscodecs.dll (Windows Imaging Component) |
| Component | libjpeg-turbo JPEG compression path |
| Bug Class | Use of Uninitialized Pointer / Untrusted Pointer Dereference (CWE-824) |
| Impact | Remote Code Execution |
| CVSS 3.1 | 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| Exploited ITW | No |
| Patch | August 2025 Patch Tuesday (version 10.0.26100.4946) |
Vulnerability Overview
A critical remote code execution vulnerability exists in windowscodecs.dll due to
uninitialized function pointers in the JPEG compression path. The Windows Imaging
Component (WIC) library embeds libjpeg-turbo 3.0.2 for JPEG handling. When a JPEG
image with 12-bit or 16-bit data precision is re-encoded (compressed), the function
jpeg_finish_compress dereferences a function pointer (compress_data_12 or
compress_data_16) that was never initialized by the coefficient controller setup
function jinit_c_rawtranscode_coef_controller_turbo.
The uninitialized pointer points to heap memory filled with allocator debug patterns (e.g., 0xBAADF00D from HeapAlloc). An attacker who controls the heap layout via heap spraying can redirect this pointer to attacker-controlled memory, achieving arbitrary code execution.
Root Cause — Uninitialized Function Pointers
The jpeg_compress_struct
The jpeg_compress_struct contains a pub member (the coefficient controller) with
function pointers for different precision levels:
struct jpeg_c_coef_controller {
// ...
int (*compress_data)(j_compress_ptr cinfo, JSAMPIMAGE input_buf); // 8-bit
int (*compress_data_12)(j_compress_ptr cinfo, J12SAMPIMAGE input_buf); // 12-bit
int (*compress_data_16)(j_compress_ptr cinfo, J16SAMPIMAGE input_buf); // 16-bit
// ...
};
The Bug
In the vulnerable version, jinit_c_rawtranscode_coef_controller_turbo (called
from rawtransencode_master_selection) only initializes compress_data (the 8-bit
pointer). The 12-bit and 16-bit pointers are left uninitialized:
// VULNERABLE (pre-patch, inlined in rawtransencode_master_selection)
void jinit_c_rawtranscode_coef_controller_turbo(j_compress_ptr cinfo) {
coef = alloc_struct(...);
coef->pub.compress_data = rawtranscode_compress_output; // 8-bit: OK
// compress_data_12 = ??? NOT INITIALIZED
// compress_data_16 = ??? NOT INITIALIZED
}
The Crash
When jpeg_finish_compress processes a 12-bit JPEG:
// jpeg_finish_compress (from jcapimin.c)
if (cinfo->data_precision == 12) {
// Calls compress_data_12 which is UNINITIALIZED
while (!(*cinfo->coef->pub.compress_data_12)(cinfo, NULL)) {
// ...
}
}
The crash occurs at jpeg_finish_compress+0xCC:
call qword ptr [r8+10h] ; r8+10h = compress_data_12
; r8+10h -> 0xBAADF00DBAADF00D (uninitialized heap)
Call Flow
Application (e.g., Microsoft Photos thumbnail generation)
-> IWICBitmapFrameEncode::WriteSource
-> CFrameEncodeBase::WriteSource
-> CJpegTurboFrameEncode::HrWriteSource
-> jpeg_finish_compress
-> (*cinfo->coef->pub.compress_data_12)(cinfo, NULL)
-> DEREFERENCE OF UNINITIALIZED POINTER -> CRASH/RCE
Triggering Conditions
The vulnerability is triggered when ALL of the following conditions are met:
- Input: A JPEG image with
data_precisionset to 12 or 16 (not the standard 8) - Operation: The image must be re-encoded (compressed), not just decoded/rendered
- Library: The application uses a vulnerable version of windowscodecs.dll
Re-encoding happens during:
- Save/Save-As operations in image editors
- Thumbnail generation (e.g., Windows Explorer, Microsoft Photos)
- Image format conversion
- Document embedding (e.g., Office re-encodes embedded images)
Simply opening and viewing a crafted JPEG does NOT trigger the vulnerability.
Patch Analysis
The patch separates jinit_c_rawtranscode_coef_controller_turbo from being inlined
and adds initialization for both missing pointers:
// PATCHED (version 10.0.26100.4946)
void jinit_c_rawtranscode_coef_controller_turbo(j_compress_ptr cinfo) {
coef = alloc_struct(...);
coef->pub.compress_data = rawtranscode_compress_output; // 8-bit
coef->pub.compress_data_12 = rawtranscode_compress_output_16; // 12-bit: FIXED
coef->pub.compress_data_16 = rawtranscode_compress_output_16; // 16-bit: FIXED
}
rawtranscode_compress_output_16 is a stub that calls rawtranscode_compress_output,
indicating there is no precision-specific handling needed.
The upstream libjpeg-turbo fix (commit e0e18de, version 3.1.1) additionally:
- Zero-initializes all structures
- Adds NULL checks before pointer dereference
- Fixes similar issues in the decompression path
Exploitation Path
32-bit (Lower barrier)
CFG is disabled for 32-bit windowscodecs.dll by default:
- Craft a 12-bit or 16-bit precision JPEG
- Heap spray: allocate many 0x3EF7-byte chunks containing ROP chain data
- Free some chunks to create holes for the victim allocation
- Trigger re-encoding of the crafted JPEG
- Uninitialized pointer lands on attacker-controlled heap data
- RIP control via the dereferenced function pointer
- Stack pivot to ROP chain in heap
- VirtualAlloc RWX region, copy shellcode, jump to it
64-bit (Higher barrier)
CFG is enabled, requiring:
- An additional CFG bypass gadget
- Address leak to defeat ASLR
- More complex heap layout control
Prerequisites for Exploitation
- Address leak (ASLR bypass)
- Sufficient heap control in the target application
- Target application must re-encode the JPEG (not just render it)
Reachability
- Attack vector: Network — malicious JPEG can be delivered via email, web, or embedded in Office documents
- Privileges required: None
- User interaction: None (thumbnail generation can trigger automatically)
- Attack surface: Any application using windowscodecs.dll that re-encodes JPEGs: Microsoft Photos, Paint, Office (document thumbnails), Windows Explorer (thumbnails), third-party applications using WIC
Affected Versions
| Product | Vulnerable | Patched |
|---|---|---|
| Windows Server 2025 | 10.0.26100.4851 | 10.0.26100.4946 |
| Windows 11 24H2 (x64) | 10.0.26100.4851 | 10.0.26100.4946 |
| Windows 11 24H2 (ARM64) | 10.0.26100.4851 | 10.0.26100.4946 |
Detection
YARA — Crafted 12-bit/16-bit JPEG
rule CVE_2025_50165_Crafted_JPEG
{
meta:
description = "Detects JPEG files with non-standard 12-bit or 16-bit precision"
cve = "CVE-2025-50165"
author = "OnlyFm252"
strings:
// SOI marker (Start of Image)
$soi = { FF D8 }
// SOF marker (Start of Frame) with 12-bit precision
// FF C0/C1/C2/C3 = SOF0-3, next 2 bytes = length, then precision byte = 0x0C
$sof_12bit_0 = { FF C0 ?? ?? 0C }
$sof_12bit_1 = { FF C1 ?? ?? 0C }
$sof_12bit_2 = { FF C2 ?? ?? 0C }
$sof_12bit_3 = { FF C3 ?? ?? 0C }
// SOF marker with 16-bit precision (0x10)
$sof_16bit_0 = { FF C0 ?? ?? 10 }
$sof_16bit_1 = { FF C1 ?? ?? 10 }
$sof_16bit_2 = { FF C2 ?? ?? 10 }
$sof_16bit_3 = { FF C3 ?? ?? 10 }
condition:
$soi at 0 and
(
any of ($sof_12bit*) or
any of ($sof_16bit*)
)
}
Sigma — Suspicious JPEG Processing Crash
title: CVE-2025-50165 WindowsCodecs.dll Crash on JPEG Processing
id: d6e7f8a9-b0c1-2345-def0-678901abcdef
status: experimental
description: >
Detects crashes in windowscodecs.dll during JPEG processing, which may
indicate exploitation of CVE-2025-50165 via crafted 12/16-bit JPEG.
author: OnlyFm252
date: 2026/07/26
references:
- https://www.zscaler.com/blogs/security-research/cve-2025-50165-critical-flaw-windows-graphics-component
- https://www.welivesecurity.com/en/eset-research/revisiting-cve-2025-50165-critical-flaw-windows-imaging-component/
- https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-50165
logsource:
product: windows
service: application
detection:
selection_crash:
EventID: 1000
Application|endswith:
- '\Photos.exe'
- '\mspaint.exe'
- '\explorer.exe'
- '\WINWORD.EXE'
- '\EXCEL.EXE'
- '\POWERPNT.EXE'
FaultModule|contains: 'WindowsCodecs'
condition: selection_crash
level: high
tags:
- attack.execution
- attack.t1203
- cve.2025.50165
Sysmon Configuration
<Sysmon schemaversion="4.90">
<EventFiltering>
<!-- Event 11: Detect unusual JPEG file creation in temp/download dirs -->
<FileCreate onmatch="include">
<TargetFilename condition="end with">.jpg</TargetFilename>
<TargetFilename condition="end with">.jpeg</TargetFilename>
</FileCreate>
<!-- Event 7: Detect windowscodecs.dll loading in unusual processes -->
<ImageLoad onmatch="include">
<ImageLoaded condition="end with">\WindowsCodecs.dll</ImageLoaded>
</ImageLoad>
</EventFiltering>
</Sysmon>
References
Attack Path
Uninitialised function pointers in the WIC JPEG raw-transcode path, reached by re-encoding a 12- or 16-bit image
Derived from the patch delta: the checks added by the vendor identify which fields crossed a trust boundary unvalidated. Reachability and privilege are taken from the call chain in the RCA report.
Exploits & PoC
1 public PoCUnverified third-party code
Public proof-of-concept repositories aggregated from PoC-in-GitHub. They are not reviewed and may be incomplete, non-functional, or malicious — inspect the code before running anything.
| Repository | Stars | Published | Description |
|---|---|---|---|
| encrypter15/CVE-2025-50165-x64-Exploit | 7 | 2025-12-07 |