CVE-2025-21298

CVE-2025-21298: Windows OLE RCE via Malicious RTF Document

Detects exploitation of CVE-2025-21298, a use-after-free (CWE-416) vulnerability in Windows OLE that allows remote code execution when a user opens a specially crafted RTF document. With a CVSS score of 9.8 and public PoC availability, this is a critical-severity vulnerability affecting Windows 10, 11, and Server 2008-2025. Exploitation typically involves phishing emails with RTF attachments that trigger the OLE subsystem to execute attacker-controlled code in the context of the victim user.

Vulnerability Intelligence

Public PoC

Affected Software

Vendor
Microsoft
Product
Windows, Windows OLE
Versions
Windows 10, Windows 11, Windows Server 2008-2025

Weakness (CWE)

Timeline

Disclosed
January 14, 2025
Patched
January 14, 2025

CVSS

9.8
Critical (9.0–10)

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Write-up coming soon

What is CVE-2025-21298 CVE-2025-21298: Windows OLE RCE via Malicious RTF Document?

CVE-2025-21298: Windows OLE RCE via Malicious RTF Document (CVE-2025-21298) maps to the Initial Access and Execution and Defense Evasion tactics — the adversary is trying to get into your network in MITRE ATT&CK.

This page provides production-ready detection logic for CVE-2025-21298: Windows OLE RCE via Malicious RTF Document, covering the data sources and telemetry it touches: Microsoft Defender for Endpoint, Microsoft Sentinel. The queries below are rated critical severity at high confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.

MITRE ATT&CK

Tactic
Initial Access Execution Defense Evasion
Microsoft Sentinel / Defender
kusto
let suspiciousRTFParents = dynamic(["winword.exe", "outlook.exe", "thunderbird.exe", "mimecast.exe", "explorer.exe"]);
let oleHosts = dynamic(["wordpad.exe", "winword.exe", "excel.exe", "powerpnt.exe", "outlook.exe"]);
let suspiciousChildren = dynamic(["cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe", "certutil.exe", "bitsadmin.exe", "wmic.exe"]);
union
(
  DeviceProcessEvents
  | where TimeGenerated >= ago(7d)
  | where InitiatingProcessFileName in~ (oleHosts)
  | where FileName in~ (suspiciousChildren)
  | extend CommandLineLower = tolower(ProcessCommandLine)
  | where CommandLineLower has_any ("http", "https", "ftp", "\\\\\\\\")
        or CommandLineLower has_any ("invoke-expression", "iex", "downloadstring", "webclient", "start-process", "-enc", "-encodedcommand", "bypass")
  | project TimeGenerated, DeviceName, AccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, FileName, ProcessCommandLine, FolderPath, ReportId
  | extend DetectionReason = "OLE host spawned suspicious child process"
),
(
  DeviceFileEvents
  | where TimeGenerated >= ago(7d)
  | where InitiatingProcessFileName in~ (oleHosts)
  | where FileName endswith ".rtf" or FileName endswith ".doc" or FileName endswith ".docx"
  | where FolderPath has_any ("\\AppData\\Local\\Temp\\", "\\AppData\\Roaming\\", "\\ProgramData\\")
  | project TimeGenerated, DeviceName, AccountName, InitiatingProcessFileName, FileName, FolderPath, ReportId
  | extend DetectionReason = "OLE host wrote suspicious file to temp path"
),
(
  DeviceEvents
  | where TimeGenerated >= ago(7d)
  | where ActionType == "OleObjectLinkFollowed" or ActionType == "ExploitGuardNetworkProtectionAudited"
  | where InitiatingProcessFileName in~ (oleHosts)
  | project TimeGenerated, DeviceName, AccountName, InitiatingProcessFileName, ActionType, AdditionalFields, ReportId
  | extend DetectionReason = "OLE link or exploit guard event from Office host"
)
| summarize count() by TimeGenerated, DeviceName, AccountName, DetectionReason, ReportId
| sort by TimeGenerated desc

Detects CVE-2025-21298 OLE RCE exploitation by correlating Office/OLE host processes spawning suspicious child processes, writing files to temp paths, or triggering OLE link events. Covers both direct exploitation and post-exploitation activity from malicious RTF documents.

critical severity high confidence

Data Sources

Microsoft Defender for Endpoint Microsoft Sentinel

Required Tables

DeviceProcessEvents DeviceFileEvents DeviceEvents

False Positives

  • Legitimate macro-enabled documents that spawn cmd.exe for business automation tasks
  • IT admin tools that use OLE embedding for legitimate deployment workflows
  • Security testing tools or red team exercises using RTF documents
  • Document conversion utilities that spawn child processes as part of normal operation
  • Outlook add-ins that legitimately invoke shell commands via OLE

Sigma rule & cross-platform mapping

The detection logic for CVE-2025-21298: Windows OLE RCE via Malicious RTF Document (CVE-2025-21298) above is provided in a vendor-neutral form so you can deploy it on any SIEM. The same logic is shipped here as native KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the following logsource:

logsource:
  category: process_creation
  product: windows

Browse the community-maintained Sigma rules for this technique:


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1RTF OLE Object Spawning CMD via WordPad

    Expected signal: Sysmon EID 1: wordpad.exe spawning cmd.exe with parent-child relationship. DeviceProcessEvents in MDE showing InitiatingProcessFileName=wordpad.exe, FileName=cmd.exe.

  2. Test 2Simulate OLE Host Encoded PowerShell Download

    Expected signal: Sysmon EID 1 with CommandLine containing '-EncodedCommand' or '-enc'. DeviceProcessEvents with ProcessCommandLine matching encoded command patterns.

  3. Test 3RTF File Drop to INetCache Simulating Email Attachment Open

    Expected signal: Sysmon EID 11 (File Create): RTF file written to INetCache path with Outlook or Explorer as initiating process. DeviceFileEvents showing FileName ending in .rtf in INetCache path.

  4. Test 4OLE Host Unexpected Outbound Network Connection

    Expected signal: Sysmon EID 3: Network connection event from powershell.exe (simulating Office host) to external IP on port 80. DeviceNetworkEvents showing InitiatingProcessFileName and DestinationIP for external address.


Response Playbook

Triage

  1. Identify the source of the RTF document: check email headers, download history, USB transfer logs, or network share access to determine how the file reached the endpoint.
  2. Examine process tree from the OLE host (winword.exe, wordpad.exe, outlook.exe): capture the full parent-child chain, command lines, and any injected threads using EDR telemetry or Sysmon Event ID 1.
  3. Check for signs of lateral movement or persistence: review scheduled tasks (Sysmon EID 1 with schtasks.exe), registry run keys (Sysmon EID 13), and new user accounts (Windows Security EID 4720) created around the time of the alert.
  4. Validate if the affected host is patched: confirm Windows Update history or WSUS/SCCM patch status for January 2025 Patch Tuesday (KB for CVE-2025-21298).

Containment

  1. Isolate the affected endpoint immediately via EDR network isolation or firewall ACL to prevent lateral movement or C2 callbacks while investigation proceeds.
  2. Block the malicious RTF file hash at the email gateway, web proxy, and endpoint AV/EDR to prevent further delivery or execution across the environment.

Evidence Collection

  1. Collect a memory dump of the Office/OLE host process (winword.exe, wordpad.exe) using WinPmem or EDR live memory acquisition to capture in-memory payloads, shellcode, and heap artifacts indicative of use-after-free exploitation.
  2. Preserve Sysmon logs, Windows Security Event Logs, and prefetch files from %SystemRoot%\Prefetch for all processes involved in the process tree originating from the OLE host, retaining originals for forensic chain of custody.

Escalation Criteria

  • ! Escalate to IR leadership and CISO if there is evidence of successful C2 communication (outbound connections from spawned child processes to external IPs) or if credential dumping tools (mimikatz, procdump targeting lsass) were executed.
  • ! Escalate if more than one host in the environment shows indicators of compromise consistent with the same RTF document or attacker TTPs, suggesting a targeted campaign or widespread phishing wave.

Investigation Guide

Forensic Artifacts

  • > Sysmon Event ID 1: process creation events showing Office/OLE host as parent with suspicious child processes
  • > Sysmon Event ID 3: network connections from Office/OLE hosts to external IPs shortly after document open
  • > Sysmon Event ID 7: DLL load events in Office process space showing unexpected or unsigned DLLs loaded post-exploitation
  • > Windows Prefetch: entries for cmd.exe, powershell.exe, or other LOLBins with timestamps correlated to document open time
  • > MRU registry keys: HKCU\Software\Microsoft\Office\<version>\Word\File MRU to identify recently opened RTF documents
  • > Email artifacts: .eml or .msg files in user's mailbox or email gateway quarantine containing the malicious RTF attachment
  • > Memory artifacts: heap spray patterns or use-after-free indicators in OLE32.DLL or OLEAUT32.DLL address space

Tuning Guidance

Baseline your environment's normal Office macro usage before deploying with high confidence. In environments with heavy macro use, tighten the child process filter to focus only on net.exe, nltest.exe, and known C2 download LOLBins rather than all shells. Consider adding file hash allowlisting for known-good automation scripts. For Outlook specifically, the ExploitGuardNetworkProtectionAudited event (DeviceEvents) provides a high-fidelity signal with fewer false positives than process creation alone. Tune the 'encoded command' regex to match your baseline PowerShell usage — some environments legitimately encode long arguments. If Microsoft AMSI is enabled, correlate with AMSI scan events for additional fidelity. Set severity to 'high' rather than 'critical' on endpoints confirmed to be running the patched January 2025 update.


Hunting Queries

Threat hunt for RTF files written by email clients or browsers to download/temp paths in the past 30 days — surfaces initial delivery of CVE-2025-21298 weaponized documents before exploitation chain is triggered.

Hunting — KQL
kql
DeviceFileEvents
| where TimeGenerated >= ago(30d)
| where FileName endswith ".rtf"
| where InitiatingProcessFileName in~ ("outlook.exe", "thunderbird.exe", "chrome.exe", "firefox.exe", "msedge.exe", "explorer.exe")
| where FolderPath has_any ("\\Downloads\\", "\\AppData\\Local\\Temp\\", "\\AppData\\Roaming\\Microsoft\\Windows\\INetCache\\")
| project TimeGenerated, DeviceName, AccountName, FileName, FolderPath, InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by TimeGenerated desc
Hunting — SPL
spl
index=sysmon EventID=11
| where match(TargetFilename, "(?i)\.rtf$")
| where match(lower(Image), "(outlook|thunderbird|chrome|firefox|msedge|explorer)\.exe$")
| where match(lower(TargetFilename), "(downloads|appdata\\local\\temp|inetcache)")
| table _time, ComputerName, User, Image, TargetFilename
| sort - _time

Frequency analysis hunt: identifies hosts where OLE host processes have spawned suspicious children more than twice or with varied command lines in a 1-hour window, suggesting active exploitation or persistence activity consistent with CVE-2025-21298.

Hunting — KQL
kql
DeviceProcessEvents
| where TimeGenerated >= ago(30d)
| where InitiatingProcessFileName in~ ("winword.exe", "wordpad.exe", "excel.exe", "powerpnt.exe", "outlook.exe")
| where FileName in~ ("cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe")
| summarize SpawnCount = count(), UniqueCommands = dcount(ProcessCommandLine) by DeviceName, InitiatingProcessFileName, FileName, bin(TimeGenerated, 1h)
| where SpawnCount > 2 or UniqueCommands > 1
| sort by TimeGenerated desc
Hunting — SPL
spl
index=sysmon EventID=1
| where match(lower(ParentImage), "(winword|wordpad|excel|powerpnt|outlook)\.exe$")
| where match(lower(Image), "(cmd|powershell|wscript|cscript|mshta|rundll32|regsvr32)\.exe$")
| bin _time span=1h
| stats count as spawn_count, dc(CommandLine) as unique_cmds by _time, ComputerName, User, ParentImage, Image
| where spawn_count > 2 OR unique_cmds > 1
| sort - _time

Atomic Red Team Tests

Test 1 RTF OLE Object Spawning CMD via WordPad
windows

Simulates CVE-2025-21298 exploitation chain by crafting a minimal RTF file with an embedded OLE object that causes WordPad to spawn cmd.exe. This replicates the process-creation telemetry generated during real exploitation.

Command

powershell
# Step 1: Create a minimal RTF with OLE shell command trigger (lab only)
$rtfContent = @'
{\rtf1\ansi {\object\objemb\objw1\objh1{\*\objclass Shell.Application}{\objdata 0100000002000000}}}
'@
$rtfPath = "$env:TEMP\\test_ole_rce.rtf"
$rtfContent | Out-File -FilePath $rtfPath -Encoding ASCII
# Step 2: Open with WordPad to trigger OLE parsing
Start-Process -FilePath "wordpad.exe" -ArgumentList $rtfPath -Wait
# Step 3: Separately simulate the child process spawn for telemetry
Start-Process -FilePath "wordpad.exe" -PassThru | ForEach-Object {
  Start-Sleep -Seconds 2
  Start-Process -FilePath "cmd.exe" -ArgumentList "/c echo CVE-2025-21298 simulation > $env:TEMP\\ole_test_output.txt"
}

Cleanup

powershell
Remove-Item -Path "$env:TEMP\\test_ole_rce.rtf" -ErrorAction SilentlyContinue; Remove-Item -Path "$env:TEMP\\ole_test_output.txt" -ErrorAction SilentlyContinue

Expected Telemetry

Sysmon EID 1: wordpad.exe spawning cmd.exe with parent-child relationship. DeviceProcessEvents in MDE showing InitiatingProcessFileName=wordpad.exe, FileName=cmd.exe.

Expected Detection

KQL and SPL queries should fire on the wordpad.exe -> cmd.exe process creation relationship.

Test 2 Simulate OLE Host Encoded PowerShell Download
windows

Simulates post-exploitation behavior where an OLE host process (using PowerShell impersonating the parent) executes an encoded PowerShell command mimicking a C2 download stager, generating the command-line telemetry expected from CVE-2025-21298 exploitation.

Command

powershell
# Encode a benign command to simulate obfuscated stager telemetry
$benignCommand = "Write-Output 'CVE-2025-21298 atomic test - no actual payload'"
$encodedCommand = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($benignCommand))
# Launch from a renamed powershell to simulate OLE parent context
$parentSim = Start-Process -FilePath "powershell.exe" -ArgumentList "-NoProfile -Command `$host.UI.RawUI.WindowTitle='WINWORD.EXE simulation'" -PassThru
Start-Sleep -Seconds 1
# Execute encoded command as child process
powershell.exe -EncodedCommand $encodedCommand
$parentSim | Stop-Process -ErrorAction SilentlyContinue

Cleanup

powershell
Stop-Process -Name 'powershell' -ErrorAction SilentlyContinue

Expected Telemetry

Sysmon EID 1 with CommandLine containing '-EncodedCommand' or '-enc'. DeviceProcessEvents with ProcessCommandLine matching encoded command patterns.

Expected Detection

KQL and SPL queries matching on '-encodedcommand' or '-enc' in command line from Office/OLE parent context. Chronicle and CrowdStrike rules match on encoded command regex.

Test 3 RTF File Drop to INetCache Simulating Email Attachment Open
windows

Simulates the delivery phase of CVE-2025-21298 by replicating how Outlook writes an RTF attachment to the INetCache temporary directory before opening it, generating the file creation telemetry used in threat hunting queries.

Command

powershell
# Simulate Outlook dropping RTF to INetCache (delivery phase)
$inetCachePath = "$env:LOCALAPPDATA\\Microsoft\\Windows\\INetCache\\Content.Outlook"
If (-not (Test-Path $inetCachePath)) { New-Item -ItemType Directory -Path $inetCachePath -Force }
$fakeMaliciousRtf = "$inetCachePath\\malicious_invoice_$(Get-Random).rtf"
'{\rtf1\ansi {\b CVE-2025-21298 atomic test document}}' | Out-File -FilePath $fakeMaliciousRtf -Encoding ASCII
Write-Output "RTF dropped to: $fakeMaliciousRtf"
# Simulate opening with default handler
Invoke-Item $fakeMaliciousRtf

Cleanup

powershell
Remove-Item -Path "$env:LOCALAPPDATA\\Microsoft\\Windows\\INetCache\\Content.Outlook\\malicious_invoice_*.rtf" -ErrorAction SilentlyContinue

Expected Telemetry

Sysmon EID 11 (File Create): RTF file written to INetCache path with Outlook or Explorer as initiating process. DeviceFileEvents showing FileName ending in .rtf in INetCache path.

Expected Detection

Threat hunting queries for RTF delivery should surface this file creation event. File monitoring rules correlating .rtf writes from email clients to INetCache should alert.

Test 4 OLE Host Unexpected Outbound Network Connection
windows

Simulates CVE-2025-21298 post-exploitation C2 callback behavior by having a process (simulating a compromised Office host) initiate an outbound HTTP connection to an external IP, generating network telemetry used in detection queries.

Command

powershell
# Simulate outbound C2 connection from OLE host context (using innocuous test endpoint)
# WARNING: Only run in isolated lab with internet egress allowed for testing
$testUrl = "http://example.com/ole_rce_test"
try {
  $result = Invoke-WebRequest -Uri $testUrl -TimeoutSec 5 -ErrorAction Stop
  Write-Output "Connection test result: $($result.StatusCode)"
} catch {
  Write-Output "Connection attempt made (error expected in air-gapped labs): $($_.Exception.Message)"
}
# Also test DNS resolution telemetry
[System.Net.Dns]::GetHostAddresses("example.com") | ForEach-Object { Write-Output "Resolved: $($_.IPAddressToString)" }

Cleanup

powershell
# No persistent changes to clean up

Expected Telemetry

Sysmon EID 3: Network connection event from powershell.exe (simulating Office host) to external IP on port 80. DeviceNetworkEvents showing InitiatingProcessFileName and DestinationIP for external address.

Expected Detection

KQL query network connection variant and SPL EID 3 detection should identify outbound connection from OLE host context to external IP.

Related Detections