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

High 7.2 Published Updated

Attackers can inject SQL via the API to exfiltrate sensitive data like admin credentials through delayed quarantine notifications.

Exploited in the wild
Not known
Login needed
An administrator
Attackable
Over the internet
Victim action needed
Not needed
Fix
None listed

What is CVE-2026-40871?

CVE-2026-40871 is a high-severity SQL injection vulnerability in mailcow-dockerized, published on 21 Apr 2026. An attacker needs administrator access to exploit it, with no action from the victim.

Official 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.

Weakness: CWE-89, CWE-564, CWE-20, CWE-116

Which versions are affected by CVE-2026-40871?

How do I fix CVE-2026-40871?

No fix has been published for CVE-2026-40871 yet. Limit exposure of the affected software until one is available.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2026-40871 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40871 exists.

Sources

Also known as GHSA-r8fq-wrfm-cj2q.

Is CVE-2026-40871 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free