CVE-2025-4087 Overview
CVE-2025-4087 is an out-of-bounds read vulnerability [CWE-125] in Mozilla Thunderbird and Firefox. The flaw resides in the XPath parsing logic, where missing null checks during attribute access can trigger undefined behavior. Attackers can leverage this condition to read memory outside of intended buffer boundaries, and in some scenarios the issue may lead to memory corruption.
Mozilla addressed the defect in Firefox 138, Firefox ESR 128.10, Thunderbird 138, and Thunderbird 128.10. The vulnerability is network-accessible and requires no privileges or user interaction, but the attack complexity is high.
Critical Impact
Successful exploitation permits out-of-bounds memory reads through crafted XPath expressions, potentially leading to memory corruption and limited disclosure of sensitive process memory.
Affected Products
- Mozilla Firefox versions prior to 138
- Mozilla Firefox ESR versions prior to 128.10
- Mozilla Thunderbird versions prior to 138 and 128.10
Discovery Timeline
- 2025-04-29 - CVE-2025-4087 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-4087
Vulnerability Analysis
The vulnerability affects the XPath expression parser used by Mozilla's Gecko engine. XPath is a query language for selecting nodes in XML documents and is also used by XSLT and DOM operations inside Firefox and Thunderbird. During attribute access in parsed XPath expressions, the code path fails to verify that referenced pointers are non-null before dereferencing them.
When a crafted XPath expression is evaluated, the missing null check causes the parser to read memory locations outside the intended buffer. The out-of-bounds read may return arbitrary process memory contents to the calling context. Under certain object layouts, the invalid access can escalate into memory corruption because subsequent operations act on invalid or attacker-influenced state.
The EPSS score is 0.267%, indicating a low likelihood of near-term exploitation. No public proof-of-concept or in-the-wild exploitation has been reported.
Root Cause
The root cause is a missing null-pointer check in the XPath attribute-access code path within Gecko. When the parser encounters certain attribute references, it dereferences a pointer that can legitimately be null in edge cases, producing undefined behavior classified as an out-of-bounds read [CWE-125].
Attack Vector
An attacker delivers a crafted document containing malicious XPath expressions to the victim. In Firefox, this happens through a hostile web page. In Thunderbird, this can occur through remote content in HTML-formatted email that triggers XPath evaluation. Evaluation of the crafted expression forces the vulnerable code path, producing the out-of-bounds read.
The vulnerability manifests during XPath attribute-access parsing. See Bugzilla Issue #1952465 and Mozilla Security Advisory MFSA-2025-28 for vendor technical detail.
Detection Methods for CVE-2025-4087
Indicators of Compromise
- Thunderbird or Firefox processes crashing when rendering HTML email or web content that contains XSLT or XPath expressions.
- Unexpected child process termination signals from thunderbird or firefox binaries on user endpoints.
- Inbound email or web traffic delivering XML/XSLT payloads containing malformed XPath attribute references.
Detection Strategies
- Inventory installed Firefox and Thunderbird versions across the environment and flag any build older than Firefox 138, Firefox ESR 128.10, Thunderbird 138, or Thunderbird 128.10.
- Monitor endpoint telemetry for anomalous crashes and memory-access violations originating from Mozilla content processes.
- Inspect email gateways for HTML messages that embed XSLT or scripted XPath queries targeting unusual attribute paths.
Monitoring Recommendations
- Enable crash reporting and centralize crash dump collection from Firefox and Thunderbird to identify repeat exploitation attempts.
- Alert on out-of-bounds read signatures and segmentation faults tied to Gecko content processes.
- Correlate browser or mail client crashes with recent inbound content from untrusted senders or domains.
How to Mitigate CVE-2025-4087
Immediate Actions Required
- Upgrade Firefox to version 138 or later on all endpoints.
- Upgrade Firefox ESR deployments to 128.10 or later.
- Upgrade Thunderbird to version 138 or version 128.10 or later.
- Apply distribution-provided updates such as the Debian LTS Announcement for managed Linux systems.
Patch Information
Mozilla released fixed builds documented in MFSA-2025-28, MFSA-2025-29, MFSA-2025-31, and MFSA-2025-32. The corresponding tracking record is Bugzilla Issue #1952465. The fixes add the missing null checks in the XPath attribute-access path.
Workarounds
- Disable remote content rendering in Thunderbird to reduce the attack surface for HTML email that triggers XPath evaluation.
- Restrict script execution and XSLT processing through enterprise policy where the browser workflow allows it.
- Deploy email gateway rules that strip or sanitize inline XSLT and XPath payloads until patching completes.
# Verify installed Thunderbird version on Linux endpoints
thunderbird --version
# Example apt upgrade path on Debian-based systems
sudo apt update && sudo apt install --only-upgrade thunderbird firefox-esr
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

