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-2026-40871

CVE-2026-40871: Mailcow Dockerized SQL Injection Flaw

CVE-2026-40871 is a second-order SQL injection vulnerability in mailcow: dockerized that enables attackers to exfiltrate sensitive data like admin credentials. This article covers technical details, affected versions, and fixes.

Published: April 23, 2026

CVE-2026-40871 Overview

CVE-2026-40871 is a second-order SQL injection vulnerability in mailcow: dockerized, an open source groupware/email suite based on Docker. Versions prior to 2026-03b are affected by this vulnerability, which allows attackers with API access to inject arbitrary SQL through the quarantine_category field via the Mailcow API. The vulnerability is particularly dangerous because it is a delayed (second-order) injection that executes when the quarantine notification job runs, potentially allowing exfiltration of sensitive data including admin credentials.

Critical Impact

Attackers can exfiltrate sensitive data such as admin credentials through UNION SELECT payloads rendered inside quarantine notification emails.

Affected Products

  • mailcow: dockerized versions prior to 2026-03b

Discovery Timeline

  • 2026-04-21 - CVE CVE-2026-40871 published to NVD
  • 2026-04-22 - Last updated in NVD database

Technical Details for CVE-2026-40871

Vulnerability Analysis

This vulnerability stems from improper input validation (CWE-20) in the mailcow API. The /api/v1/add/mailbox endpoint accepts a quarantine_category parameter that is stored in the database without proper validation or sanitization. While this initial storage does not directly trigger the vulnerability, the stored value is later retrieved and used by the quarantine_notify.py script.

The critical flaw occurs when quarantine_notify.py constructs SQL queries using unsafe % string formatting instead of parameterized queries. This design pattern creates a second-order SQL injection scenario where the malicious payload remains dormant until the quarantine notification job executes. When triggered, an attacker-controlled SQL payload can manipulate database queries to extract sensitive information.

Using a UNION SELECT technique, attackers can craft payloads that exfiltrate sensitive data such as admin credentials. This data is then rendered directly inside quarantine notification emails, providing an exfiltration channel that bypasses traditional database monitoring.

Root Cause

The root cause is twofold: first, the /api/v1/add/mailbox endpoint fails to validate or sanitize the quarantine_category input before storing it in the database. Second, the quarantine_notify.py script uses unsafe string formatting (% operator) to construct SQL queries instead of using parameterized queries or prepared statements. This combination allows stored malicious input to be executed as SQL code during the notification job.

Attack Vector

The attack is network-based and requires authenticated API access with high privileges. An attacker must have the ability to create or modify mailbox entries through the Mailcow API. The attack flow involves:

  1. Submitting a malicious SQL payload as the quarantine_category value via the /api/v1/add/mailbox endpoint
  2. The payload is stored in the database without sanitization
  3. When the quarantine notification job runs, quarantine_notify.py retrieves and incorporates the malicious value into SQL queries using unsafe string formatting
  4. The injected SQL executes, and extracted data is embedded into quarantine notification emails
  5. The attacker receives the exfiltrated data through the notification email content

The vulnerability mechanism exploits unsafe SQL query construction in the quarantine notification system. The quarantine_notify.py script uses Python's % string formatting operator to build SQL queries dynamically, incorporating the stored quarantine_category value directly into the query string. This allows attackers to break out of the intended query context and inject additional SQL commands. For complete technical details, see the GitHub Security Advisory.

Detection Methods for CVE-2026-40871

Indicators of Compromise

  • Unusual or suspicious values in the quarantine_category field containing SQL syntax such as UNION, SELECT, --, or single quotes
  • Quarantine notification emails containing unexpected database content or credential information
  • API logs showing mailbox creation or modification requests with abnormally long or encoded quarantine_category values

Detection Strategies

  • Monitor API request logs for the /api/v1/add/mailbox endpoint and flag requests containing SQL injection patterns in the quarantine_category parameter
  • Implement database query logging and alert on queries originating from quarantine_notify.py that contain unexpected UNION or SELECT statements
  • Review quarantine notification email content for anomalous data that may indicate successful data exfiltration

Monitoring Recommendations

  • Enable detailed logging for the Mailcow API and database connections
  • Set up alerts for failed or unusual SQL queries in the context of quarantine notification processing
  • Periodically audit the quarantine_category values stored in the database for injection patterns

How to Mitigate CVE-2026-40871

Immediate Actions Required

  • Upgrade mailcow: dockerized to version 2026-03b or later immediately
  • Audit existing quarantine_category values in the database for malicious SQL patterns
  • Review quarantine notification emails sent prior to patching for signs of data exfiltration
  • Restrict API access to trusted administrators only until the patch is applied

Patch Information

Version 2026-03b of mailcow: dockerized addresses this vulnerability by implementing proper input validation and sanitization for the quarantine_category field, and by updating quarantine_notify.py to use parameterized queries instead of unsafe string formatting. Users should upgrade to this version or later. For additional details, refer to the GitHub Security Advisory.

Workarounds

  • If immediate patching is not possible, implement application-level input validation to reject quarantine_category values containing SQL metacharacters
  • Disable or restrict access to the /api/v1/add/mailbox API endpoint until the patch can be applied
  • Temporarily disable quarantine notification emails to prevent execution of any stored malicious payloads
bash
# Update mailcow to patched version
cd /opt/mailcow-dockerized
./update.sh

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

  • Vulnerability Details
  • TypeSQLI

  • Vendor/TechMailcow

  • SeverityHIGH

  • CVSS Score7.2

  • EPSS Probability0.04%

  • 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-20
  • Technical References
  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-40874: mailcow dockerized Auth Bypass Vulnerability

  • CVE-2026-40872: mailcow dockerized XSS Vulnerability

  • CVE-2026-40873: mailcow dockerized XSS Vulnerability

  • CVE-2026-40875: 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