A Leader in the 2026 Gartner® Magic Quadrant™ for Endpoint Protection. Six years running.Six years. Gartner® Magic Quadrant™ Leader.Find Out Why
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2025-53909

CVE-2025-53909: Mailcow SSTI RCE Vulnerability

CVE-2025-53909 is a Server-Side Template Injection vulnerability in Mailcow that enables remote code execution through malicious notification templates. This article covers technical details, affected versions, and mitigation.

Published: May 26, 2026

CVE-2025-53909 Overview

CVE-2025-53909 is a Server-Side Template Injection (SSTI) vulnerability in mailcow: dockerized, an open source groupware and email suite distributed as Docker containers. The flaw exists in the notification template system that generates quota and quarantine alerts. The Jinja2 template rendering engine processes administrator-supplied templates without sandboxing, allowing template expressions to execute code during routine notification rendering. Exploitation requires admin-level access to the mailcow UI to configure malicious templates. Versions prior to 2025-07 are affected. The vendor released a patch in version 2025-07 that switches rendering to a sandboxed Jinja2 environment [CWE-1336].

Critical Impact

An authenticated administrator can inject template expressions that execute arbitrary code in the Dovecot notification container, leading to confidentiality, integrity, and availability compromise of the mail platform.

Affected Products

  • mailcow: dockerized versions prior to 2025-07
  • data/Dockerfiles/dovecot/quarantine_notify.py rendering component
  • data/Dockerfiles/dovecot/quota_notify.py rendering component

Discovery Timeline

  • 2025-07-17 - CVE-2025-53909 published to NVD
  • 2025-07 - mailcow releases patched version 2025-07 with Jinja2 sandbox
  • 2025-09-11 - Last updated in NVD database

Technical Details for CVE-2025-53909

Vulnerability Analysis

The vulnerability resides in the Dovecot notification subsystem that mailcow uses to deliver quota warnings and quarantine alerts. Administrators can configure the body of these notifications through the mailcow UI. The application passes those administrator-controlled strings directly to a non-sandboxed Jinja2 Template object for rendering. Jinja2 expression syntax such as {{ ... }} is evaluated server-side. An attacker with admin privileges can craft expressions that traverse Python object attributes to reach dangerous builtins, leading to arbitrary command execution inside the dovecot container.

The Exploit Prediction Scoring System currently reports an EPSS probability of 0.679%. No public proof-of-concept exploit is referenced in the advisory, and the issue is not listed in the CISA Known Exploited Vulnerabilities catalog.

Root Cause

The root cause is the use of the unrestricted jinja2.Template class for rendering user-influenced content. Standard Template objects expose the full Python object graph through attributes such as __class__, __mro__, and __subclasses__, which attackers chain to reach os.system or equivalent execution primitives. The codebase did not apply allow-listing, output escaping for code contexts, or a sandboxed environment to constrain template capabilities [CWE-1336].

Attack Vector

An attacker with administrator credentials authenticates to the mailcow UI and edits the quota or quarantine notification template. They embed a Jinja2 expression that resolves a Python subclass chain to an OS command runner. When mailcow's Dovecot worker processes a quota event or releases a quarantined message, the notification script renders the template and executes the injected payload as the container user.

The vendor fix replaces the unsafe Template import with SandboxedEnvironment from jinja2.sandbox, which blocks attribute access to unsafe builtins:

python
 from email.mime.text import MIMEText
 from email.utils import COMMASPACE, formatdate
 import jinja2
-from jinja2 import Template
+from jinja2 import TemplateError
+from jinja2.sandbox import SandboxedEnvironment
 import json
 import redis
 import time

Source: mailcow-dockerized commit 8c5f6c0

Detection Methods for CVE-2025-53909

Indicators of Compromise

  • Unexpected child processes spawned by the dovecot-mailcow container, particularly shells (/bin/sh, /bin/bash) or interpreters launched from Python notification scripts.
  • Notification template content in the mailcow database containing Jinja2 expressions referencing __class__, __mro__, __subclasses__, os.popen, or subprocess.
  • Outbound network connections originating from the Dovecot container to unfamiliar hosts during quota or quarantine notification events.

Detection Strategies

  • Audit the mailcow administrator activity log for template edits to quota and quarantine notification settings, especially from unrecognized sessions or IP addresses.
  • Inspect persisted notification templates for Jinja2 syntax beyond simple variable substitution. Legitimate templates should not require attribute traversal.
  • Compare the deployed quota_notify.py and quarantine_notify.py against the upstream 2025-07 release to confirm SandboxedEnvironment is in use.

Monitoring Recommendations

  • Enable container runtime monitoring on the dovecot-mailcow service and alert on process executions outside the expected Python and Dovecot binaries.
  • Forward mailcow admin UI access logs and Dovecot container stdout to a centralized log platform for retention and correlation.
  • Track changes to the mailbox.quota_notification and quarantine template configuration tables and flag modifications outside scheduled change windows.

How to Mitigate CVE-2025-53909

Immediate Actions Required

  • Upgrade mailcow: dockerized to version 2025-07 or later, which renders notifications inside a Jinja2 SandboxedEnvironment.
  • Review every existing quota and quarantine notification template and remove any expressions that perform attribute traversal or call builtins.
  • Rotate mailcow administrator credentials and enforce multi-factor authentication on the admin UI to reduce the prerequisite admin access risk.

Patch Information

The upstream fix is delivered in commit 8c5f6c03214a4b2bdbf3c78932f860eee949012b, included in release 2025-07. The patch replaces from jinja2 import Template with from jinja2.sandbox import SandboxedEnvironment in both data/Dockerfiles/dovecot/quota_notify.py and data/Dockerfiles/dovecot/quarantine_notify.py. Operators should follow the standard mailcow update procedure (git pull and ./update.sh) to apply the patched containers. Full details are available in the GitHub Security Advisory GHSA-8p7g-6cjj-wr9m.

Workarounds

  • Restrict access to the mailcow admin UI to trusted management networks using firewall rules or a reverse proxy ACL until patching is complete.
  • Manually replace the Template usage in the Dovecot notification scripts with SandboxedEnvironment and rebuild the affected container if immediate upgrade is not feasible.
  • Reset quota and quarantine notification templates to vendor defaults to remove any pre-existing injected payloads before applying the upgrade.
bash
# Update mailcow to a patched release
cd /opt/mailcow-dockerized
git fetch --tags
git checkout 2025-07
./update.sh
docker compose pull dovecot-mailcow
docker compose up -d dovecot-mailcow

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechMailcow

  • SeverityHIGH

  • CVSS Score7.2

  • EPSS Probability0.68%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-1336
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Security Advisory GHSA-8p7g-6cjj-wr9m
  • Related CVEs
  • CVE-2022-31245: Mailcow RCE Vulnerability

  • CVE-2026-40874: mailcow dockerized Auth Bypass Vulnerability

  • CVE-2026-40872: mailcow dockerized XSS Vulnerability

  • CVE-2026-40873: mailcow dockerized XSS Vulnerability
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.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English