Skip to main content

mailcow: dockerized CVE-2026-40871

| EUVDEUVD-2026-24253 HIGH
Improper Input Validation (CWE-20)
2026-04-21 GitHub_M
7.2
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Obtain high-privilege API credentials
  2. Delivery
    Send crafted POST to /api/v1/add/mailbox with SQL payload
  3. Exploit
    Malicious quarantine_category stored in database
  4. Install
    Wait for scheduled quarantine_notify.py execution
  5. C2
    SQL injection triggers during notification job
  6. Execute
    UNION SELECT extracts admin credentials
  7. Impact
    Sensitive data exfiltrated via notification email

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V2 - Validation and Business Logic Input validation, allowlisting
Exploitation Conditions

Requires authenticated API access with high privileges (PR:H from CVSS vector) to the Mailcow API, specifically the ability to create or modify mailboxes via the /api/v1/add/mailbox endpoint. The attacker must have credentials for an account with administrative or mailbox creation permissions. Exploitation is network-based (AV:N) with low complexity (AC:L), meaning no special network positioning or timing requirements beyond API access. The vulnerable code path activates only when the quarantine_notify.py scheduled job runs, requiring the mailcow instance to have quarantine notifications enabled (default configuration). The delayed execution nature means exploitation depends on the notification job schedule, typically periodic (hourly or daily). No user interaction required (UI:N) after initial API call. The attack succeeds against default mailcow configurations where quarantine notifications are active and input validation has not been manually implemented.

Impact

The CVSS 3.1 score of 7.2 (High) reflects the severe potential impact with network-based attack vector (AV:N), low complexity (AC:L), but requires high privileges (PR:H) and no user interaction (UI:N). The vector indicates complete compromise potential across confidentiality, integrity, and availability (C:H/I:H/A:H). Real-world risk assessment reveals moderate-to-high priority: while the PR:H requirement significantly limits the attack surface to authenticated API users with elevated permissions (typically administrators or service accounts), the delayed execution nature makes detection difficult since the injection occurs asynchronously during scheduled job runs rather than during the initial API call. No EPSS score provided and no CISA KEV listing indicates no confirmed widespread exploitation. The GitHub security advisory disclosure suggests responsible disclosure and timely vendor response. Primary risk scenarios include compromised admin accounts, malicious insiders, or service account credential theft. The ability to exfiltrate admin credentials via UNION SELECT creates a privilege escalation pathway where initial high-privilege access can be leveraged to extract and persist additional administrative credentials through automated email channels, potentially evading traditional security monitoring focused on API responses rather than email content.

Exploit ScenarioDerived

An attacker who has compromised high-privilege API credentials (or a malicious insider with administrative access) crafts a malicious API request to /api/v1/add/mailbox, setting the quarantine_category field to a SQL injection payload such as: "' UNION SELECT username, password, '' FROM admin WHERE '1'='1". This value is stored in the database without triggering immediate errors. Hours or days later, when the scheduled quarantine_notify.py job executes to send quarantine notifications, it retrieves the malicious quarantine_category value and incorporates it into a SQL query using unsafe string formatting. The UNION SELECT executes, extracting admin usernames and password hashes from the admin table, which are then rendered directly into the body of quarantine notification emails sent to the attacker-controlled mailbox. The attacker receives credentials via email, avoiding detection mechanisms focused on API response monitoring.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Apr 21, 2026

Second-order SQL injection in mailcow: dockerized versions prior to 2026-03b allows authenticated API users with high privileges to execute arbitrary SQL commands through the quarantine notification system. Attackers inject malicious SQL via the quarantine_category field in /api/v1/add/mailbox endpoint, which executes when quarantine_notify.py runs its scheduled job, enabling data exfiltration of admin credentials and sensitive information through UNION-based queries rendered in notification emails. No public exploit code or active exploitation confirmed at time of analysis, with vendor patch available in version 2026-03b.

RemediationAI

Upgrade immediately to mailcow: dockerized version 2026-03b or later, which addresses the SQL injection vulnerability by implementing proper input validation and parameterized queries in the quarantine notification system. Follow the vendor security advisory at https://github.com/mailcow/mailcow-dockerized/security/advisories/GHSA-r8fq-wrfm-cj2q for upgrade procedures specific to containerized deployments. As compensating controls until patching is complete, implement strict API access controls by auditing and restricting high-privilege API credentials to only essential service accounts, enable comprehensive API request logging for the /api/v1/add/mailbox endpoint to detect suspicious quarantine_category values, and review existing mailbox configurations for anomalous quarantine_category entries that may contain SQL injection payloads (look for SQL keywords like UNION, SELECT, or special characters in stored values). Consider temporarily disabling automated quarantine notifications via quarantine_notify.py if immediate patching is not feasible, though this will impact legitimate quarantine management workflows. After upgrading, rotate all administrative and API credentials as a precautionary measure given the credential exfiltration capabilities of this vulnerability.

Affected VersionsENISA

mailcow-dockerized < 2026-03b

Affected Packages

euvd mailcow_dockerized fix: 2026-03b

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

This vulnerability affects mailcow: dockerized (cpe:2.3:a:mailcow:mailcow-dockerized), a containerized open-source groupware and email suite. The flaw stems from CWE-20 (Improper Input Validation) manifesting as a second-order SQL injection. Unlike traditional SQL injection where malicious input is immediately executed, second-order SQL injection occurs when untrusted data is stored in the database and later retrieved and used in dynamically constructed SQL queries. The vulnerable code path involves the Mailcow API's /api/v1/add/mailbox endpoint accepting quarantine_category values without validation or parameterization, storing them directly. Subsequently, the quarantine_notify.py script retrieves these values and incorporates them into SQL queries using Python's unsafe % string formatting (string interpolation) rather than parameterized queries or prepared statements. When the scheduled quarantine notification job executes, the stored malicious SQL payload is injected into the query context, enabling UNION SELECT operations that can extract arbitrary data from the database and embed it in outgoing email notifications.

Know when Mailcow gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 7.2 HIGH
AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

Primary rating from Vendor (GitHub_M) · only source for this CVE.

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
High
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

3
Patch released
Apr 22, 2026 - 21:02 nvd
Patch available
Patch available
Apr 21, 2026 - 21:02 EUVD
CVE Published
Apr 21, 2026 - 19:12 nvd
HIGH 7.2

DescriptionCVE.org

mailcow: dockerized is an open source groupware/email suite based on docker. Versions prior to 2026-03b have a second-order SQL injection vulnerability in the quarantine_category field via the Mailcow API. The /api/v1/add/mailbox endpoint stores quarantine_category without validation or sanitization. This value is later used by quarantine_notify.py, which constructs SQL queries using unsafe % string formatting instead of parameterized queries. This results in a delayed (second-order) SQL injection when the quarantine notification job executes, allowing an attacker to inject arbitrary SQL. Using a UNION SELECT, sensitive data (e.g., admin credentials) can be exfiltrated and rendered inside quarantine notification emails. Version 2026-03b fixes the vulnerability.

Executive ViewAI

Why It Matters

CVE-2026-40871 is a high-severity second-order SQL injection vulnerability in mailcow that allows authenticated administrators to extract sensitive data including credentials through the quarantine notification system. Organizations running mailcow versions prior to 2026-03b face risk of unauthorized access to email infrastructure and credential compromise if administrative accounts are compromised or insider threats exist.

Business Impact: High
Compensating Controls

Vendor-released patch: mailcow version 2026-03b. Until patched, restrict /api/v1/add/mailbox API access to minimal set of trusted administrators, disable or monitor quarantine_notify.py scheduled task execution, and implement API request logging with alerts for quarantine_category field injection patterns.

Threat Intelligence Overview

EPSS Score
0.0%
Top 87% exploitable
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

36
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +36
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

CVE-2017-8928 HIGH POC
8.8 May 14

mailcow 0.14, as used in "mailcow: dockerized" and other products, has CSRF. Rated high severity (CVSS 8.8), this vulner

CVE-2023-26490 HIGH POC
8.8 Mar 04

mailcow is a dockerized email package, with multiple containers linked in one bridged network. Rated high severity (CVSS

CVE-2022-31138 HIGH POC
8.8 Jul 11

mailcow is a mailserver suite. Rated high severity (CVSS 8.8), this vulnerability is remotely exploitable, low attack co

CVE-2022-31245 HIGH POC
8.8 May 20

mailcow before 2022-05d allows a remote authenticated user to inject OS commands and escalate privileges to domain admin

CVE-2022-39258 HIGH POC
8.2 Sep 27

mailcow is a mailserver suite. Rated high severity (CVSS 8.2), this vulnerability is remotely exploitable, no authentica

CVE-2025-25198 HIGH POC
7.1 Feb 12

mailcow: dockerized is an open source groupware/email suite based on docker. Rated high severity (CVSS 7.1), this vulner

CVE-2024-30270 MEDIUM POC
6.2 Apr 04

mailcow: dockerized is an open source groupware/email suite based on docker. Rated medium severity (CVSS 6.2), this vuln

CVE-2024-31204 MEDIUM POC
6.1 Apr 04

mailcow: dockerized is an open source groupware/email suite based on docker. Rated medium severity (CVSS 6.1). Public ex

CVE-2026-125757 CRITICAL
9.4 Nov 10

Stored server-side template injection in mailcow: dockerized releases before 2026-11 lets an authenticated domain admini

CVE-2026-40872 CRITICAL
9.3 Apr 21

Stored cross-site scripting in mailcow dockerized versions before 2026-03b enables remote attackers to execute arbitrary

CVE-2026-40873 HIGH
8.9 Apr 21

Stored cross-site scripting (XSS) in mailcow: dockerized (versions prior to 2026-03b) allows remote unauthenticated atta

CVE-2023-34108 HIGH
8.8 Jun 07

mailcow is a mail server suite based on Dovecot, Postfix and other open source software, that provides a modern web UI f

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy