Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-21386

CVE-2025-21386: Microsoft Excel RCE Vulnerability

CVE-2025-21386 is a remote code execution vulnerability in Microsoft Excel that enables attackers to execute arbitrary code on affected systems. This article covers the technical details, affected versions, and mitigation.

Published:

CVE-2025-21386 Overview

CVE-2025-21386 is a remote code execution vulnerability in Microsoft Excel rooted in a use-after-free condition [CWE-416]. An attacker who crafts a malicious Excel document can execute arbitrary code in the context of the current user when the file is opened. Despite the "remote code execution" classification, the attack vector is local and requires user interaction, typically delivered through phishing or malicious file sharing. Microsoft published the advisory on February 11, 2025, covering Microsoft 365 Apps, Microsoft Excel 2016, Microsoft Office 2019, Office LTSC 2021 and 2024, and Office Online Server.

Critical Impact

Successful exploitation grants code execution in the security context of the user opening the file, enabling credential theft, lateral movement, or ransomware deployment.

Affected Products

  • Microsoft 365 Apps (Enterprise, x86 and x64)
  • Microsoft Excel 2016 and Microsoft Office 2019
  • Microsoft Office LTSC 2021 and 2024 (Windows and macOS), and Office Online Server

Discovery Timeline

  • 2025-02-11 - CVE-2025-21386 published to NVD
  • 2025-07-01 - Last updated in NVD database

Technical Details for CVE-2025-21386

Vulnerability Analysis

The flaw is a use-after-free condition in Microsoft Excel's document parsing logic. When Excel processes a specifically crafted spreadsheet, the application references memory that has already been freed. An attacker controlling the contents of that freed memory region can redirect execution flow and run arbitrary code in the context of the user running Excel.

The vulnerability is classified as local because the attacker does not need network access to the target. Exploitation depends on convincing a user to open a malicious file, commonly delivered via email attachments, shared document platforms, or drive-by downloads. The Preview Pane is not listed as an attack vector for this CVE.

Successful exploitation results in high confidentiality, integrity, and availability impact. Code runs at the privilege level of the logged-in user, which on many corporate workstations includes access to email, file shares, and cached credentials.

Root Cause

The root cause is improper handling of object lifetime during Excel's processing of a structured document. A pointer continues to reference an object after the underlying memory has been released, allowing controlled data to occupy the freed allocation and be dereferenced as if it were the original object.

Attack Vector

An attacker crafts a malicious .xlsx, .xls, or related Office document and delivers it to a victim. When the user opens the file in a vulnerable Excel build, the parser triggers the use-after-free, leading to arbitrary code execution. No authentication is required against the target, but user interaction is mandatory. Refer to the Microsoft Security Update Guide for vendor technical details.

Detection Methods for CVE-2025-21386

Indicators of Compromise

  • Excel processes (EXCEL.EXE) spawning unexpected child processes such as cmd.exe, powershell.exe, rundll32.exe, or mshta.exe.
  • Unsigned or unusual DLLs loaded into Excel's address space shortly after opening an attachment.
  • Outbound network connections originating from EXCEL.EXE to untrusted hosts following document open events.
  • Office documents arriving from external senders containing embedded objects, macros, or unusually large binary streams.

Detection Strategies

  • Hunt for process lineage where Office applications launch script interpreters or LOLBins, then correlate with the file path of the opened document.
  • Monitor Windows Defender Exploit Guard or EDR telemetry for memory protection violations, ROP indicators, or heap corruption events inside Office processes.
  • Apply YARA rules targeting malformed Excel structures associated with use-after-free triggers, and inspect mail gateway attachments for anomalies.

Monitoring Recommendations

  • Forward Office telemetry, Sysmon process and image-load events, and EDR alerts to a centralized analytics platform for correlation.
  • Alert on Excel writing executable content to %TEMP%, %APPDATA%, or startup directories within seconds of opening a document.
  • Track patch compliance for Microsoft 365 Apps and standalone Office installations across the fleet to surface unpatched endpoints.

How to Mitigate CVE-2025-21386

Immediate Actions Required

  • Apply the February 2025 Microsoft security updates referenced in the Microsoft Security Update Guide to all Excel and Office installations.
  • Inventory endpoints running Microsoft 365 Apps, Excel 2016, Office 2019, and Office LTSC 2021/2024 to confirm patch deployment.
  • Block or quarantine inbound Office documents from untrusted senders at the mail gateway until patching completes.

Patch Information

Microsoft addressed CVE-2025-21386 in the February 2025 Patch Tuesday release. Updates are available through Microsoft Update, the Microsoft 365 Apps update channel, and the standalone security update packages listed in the vendor advisory. Office LTSC for macOS requires the corresponding Office for Mac update.

Workarounds

  • Enable Protected View and Office Application Guard so that documents from the internet and email open in an isolated container.
  • Configure Attack Surface Reduction (ASR) rules to block Office applications from creating child processes and from injecting code into other processes.
  • Restrict execution of macros from the internet via Group Policy and enforce the Mark-of-the-Web on downloaded files.
bash
# Enable ASR rule: Block Office applications from creating child processes
Set-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EFC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Enabled

# Enforce Protected View for files originating from the internet
reg add "HKCU\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView" /v DisableInternetFilesInPV /t REG_DWORD /d 0 /f

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.