Skip to main content
Vulnerability Database/CVE-2026-93405

CVE-2026-93405: Mailspring Email Client XSS Vulnerability

CVE-2026-93405 is a cross-site scripting flaw in Mailspring email client that allows attackers to execute malicious scripts through crafted attachments. This article covers technical details, affected versions, and mitigation.

Published:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-93405 Overview

CVE-2026-93405 is a cross-site scripting (XSS) vulnerability in Mailspring, an open-source email client, affecting versions prior to 1.17.0. The attachment quick preview feature converts Markdown, DOCX, and XLSX attachments using Snarkdown, Mammoth, and SheetJS, then inserts the resulting HTML into the preview document via innerHTML without sanitization. A remote sender can craft an attachment whose converted HTML executes script when the recipient opens quick preview. The flaw is tracked as [CWE-79].

Critical Impact

Script execution in the preview renderer gives attackers access to the IPC surface exposed to that renderer and can be chained with path-traversal or file-write flaws for persistent code execution.

Affected Products

  • Mailspring versions prior to 1.17.0
  • Attachment quick preview feature (Markdown, DOCX, XLSX handlers)
  • All platforms (Windows, macOS, Linux) running affected Electron-based client

Discovery Timeline

  • 2026-09-24 - CVE-2026-93405 published to NVD
  • 2026-09-30 - Last updated in NVD database

Technical Details for CVE-2026-93405

Vulnerability Analysis

Mailspring's quick preview renderer handles multiple attachment formats by converting them to HTML before display. The Markdown handler calls Snarkdown, the DOCX handler calls Mammoth, and the XLSX handler calls SheetJS. The resulting HTML is written directly to the DOM through innerHTML without any sanitization pass.

Because each of these converters can preserve or produce HTML elements and attributes capable of executing JavaScript, an attacker-controlled attachment can inject active script content. When the recipient previews the attachment, the script runs inside the preview renderer context.

The preview renderer does not have direct Node.js or Electron API access. However, it retains access to the IPC channels exposed to quick preview. Injected script can invoke these IPC handlers to interact with the main process surface. On its own this yields script execution. Combined with separate path-traversal and renderer-controlled file-write issues, it forms a persistent code-execution chain.

Root Cause

The root cause is unsanitized HTML insertion in app/src/quickpreview/index.ts. Third-party converters are trusted to produce safe output, and their results are passed to innerHTML without a sanitizer such as DOMPurify. No Content Security Policy (CSP) was enforced on the preview window to restrict inline script execution.

Attack Vector

An attacker sends an email containing a crafted Markdown, DOCX, or XLSX attachment. The recipient opens quick preview on the attachment, and the embedded payload executes in the preview renderer.

typescript
 import { execFile } from 'child_process';
 import path from 'path';
 import { File } from 'mailspring-exports';
+import { ipcRenderer } from 'electron';
+
+// Generate token via IPC to ensure it's stored in the main process
+async function generatePreviewToken(previewPath: string): Promise<string> {
+  return ipcRenderer.invoke('quickpreview:generateToken', previewPath);
+}
+
+// Cleanup token via IPC
+function cleanupPreviewToken(token: string): void {
+  ipcRenderer.invoke('quickpreview:cleanupToken', token);
+}
+
+// Content Security Policy for quickpreview windows
+// Restricts script execution while allowing external images
+const QuickPreviewCSP = [
+  "default-src 'self'",
+  "script-src 'self' 'unsafe-inline'", // unsafe-inline needed for inline script in renderer.html
+  "style-src 'self' 'unsafe-inline'",
+  "img-src 'self' data: https: http:", // Allow external images
+  "object-src 'none'",
+  "frame-src 'none'",
+  "base-uri 'self'",
+].join('; ');
 
 let quickPreviewWindow = null;
 let captureWindow = null;

Source: GitHub Mailspring Commit 5728388

Detection Methods for CVE-2026-93405

Indicators of Compromise

  • Inbound emails containing Markdown, DOCX, or XLSX attachments with embedded <script> tags, event handler attributes, or javascript: URIs in converted HTML output.
  • Unexpected Mailspring IPC invocations originating from the quick preview renderer, particularly calls not matching normal preview workflows.
  • Child processes spawned by Mailspring shortly after attachment preview, suggesting IPC abuse or chained file-write exploitation.

Detection Strategies

  • Inspect mail gateway logs for attachments containing active HTML content inside Office or Markdown documents destined for Mailspring users.
  • Monitor endpoint telemetry for Mailspring (mailspring process) version metadata and flag any instance below 1.17.0.
  • Correlate attachment-open events with subsequent file writes or network connections initiated by the Mailspring renderer.

Monitoring Recommendations

  • Enable process-tree logging on endpoints running Mailspring to capture renderer-to-main IPC activity and downstream executions.
  • Track outbound network connections from the Mailspring process after a user interacts with an attachment preview.
  • Alert on file-system modifications under Mailspring's user data directory following attachment preview activity.

How to Mitigate CVE-2026-93405

Immediate Actions Required

  • Upgrade all Mailspring installations to version 1.17.0 or later immediately.
  • Advise users to avoid previewing untrusted Markdown, DOCX, and XLSX attachments until the upgrade is complete.
  • Audit mail gateway rules to quarantine or strip executable HTML from Office and Markdown attachments where feasible.

Patch Information

The fix is included in Mailspring 1.17.0. The patch introduces a Content Security Policy for quick preview windows, moves preview token handling into the main process via IPC, and adds safeguards around attachment preview generation. See the GitHub Security Advisory GHSA-px2g-jhg5-c6gh, Pull Request #2523, and the Mailspring 1.17.0 Release.

Workarounds

  • Disable use of the attachment quick preview feature on unpatched clients and open attachments only in dedicated viewers.
  • Block or quarantine inbound Markdown, DOCX, and XLSX attachments from untrusted senders at the mail gateway.
  • Restrict Mailspring execution with application allowlisting until endpoints are confirmed to run 1.17.0 or later.
bash
# Verify installed Mailspring version on Linux endpoints
mailspring --version

# Example mail gateway rule: quarantine attachments with suspicious HTML in Office docs
# (pseudo-config - adapt to your gateway syntax)
rule "quarantine-mailspring-xss" {
  match attachment.ext in ["md", "docx", "xlsx"]
  match attachment.content contains /<script|onerror=|javascript:/i
  action quarantine
}

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.