CVE-2026-27851
Dovecot vulnerability analysis and mitigation

Overview

CVE-2026-27851 is a filter-handling vulnerability in Dovecot (and OX Dovecot Pro) that enables SQL and LDAP injection attacks through authentication mechanisms. When the safe filter is used with variable expansion, all subsequent pipelines on the same string are incorrectly treated as safe, allowing unsafe data to pass through unescaped. The vulnerability affects Dovecot versions prior to 2.4.4 and OX Dovecot Pro versions prior to 3.1.5. It was published on May 12, 2026, with a CVSS v3.1 base score of 9.1 (Critical) per Feedly/NVD estimates, and 7.4 (High) per the vendor and GitHub Advisory (GitHub Advisory, OX Advisory).

Technical details

The root cause is classified as CWE-235 (Improper Handling of Extra Parameters), where Dovecot's template/filter pipeline logic fails to correctly scope the safe designation — once a string is marked safe via the safe filter with variable expansion, all subsequent pipeline operations on that string inherit the safe status incorrectly, bypassing escaping logic. This allows attacker-controlled input to be injected into SQL or LDAP queries without proper sanitization, particularly in authentication contexts. The attack requires no privileges and no user interaction, and is exploitable remotely over the network, though the vendor-assigned CVSS score reflects high attack complexity (GitHub Advisory, OX Advisory).

Impact

Successful exploitation allows an unauthenticated remote attacker to inject arbitrary SQL or LDAP commands through Dovecot's authentication mechanisms, potentially bypassing authentication entirely or accessing unauthorized data. The confidentiality and integrity impacts are rated High, as attackers could read sensitive mail account data or manipulate directory/database records; availability is not directly impacted. In environments using SQL or LDAP backends for Dovecot authentication, this could lead to full authentication bypass and unauthorized access to user mailboxes (GitHub Advisory, OX Advisory).

Exploitation steps

  1. Reconnaissance: Identify Dovecot mail servers running versions prior to 2.4.4 (community) or 3.1.5 (OX Dovecot Pro) using network scanning tools such as Shodan or Nmap, targeting IMAP/POP3/LMTP ports (143, 993, 110, 995).
  2. Identify SQL/LDAP authentication backend: Determine whether the target Dovecot instance uses an SQL or LDAP backend for authentication (e.g., by observing error messages, banner information, or configuration leaks).
  3. Craft malicious authentication payload: Construct a login request where the username or password field contains SQL or LDAP injection syntax (e.g., ' OR '1'='1 for SQL, or *)(uid=*))(|(uid=* for LDAP) that will be processed by a template pipeline using the safe filter.
  4. Trigger unsafe unescaping: Submit the crafted authentication request to the Dovecot service; the safe filter's incorrect propagation causes the injected payload to bypass escaping and be passed raw to the backend query.
  5. Achieve objective: Depending on the backend, the attacker may bypass authentication (logging in as any user), enumerate accounts, or extract sensitive data from the SQL/LDAP directory (GitHub Advisory, OX Advisory).

Indicators of compromise

  • Network: Unusual or malformed authentication attempts to Dovecot IMAP/POP3 ports (143, 993, 110, 995) containing SQL metacharacters (', --, OR, UNION) or LDAP special characters (*, (, ), |, &) in username or password fields.
  • Logs: Dovecot authentication logs (/var/log/dovecot.log or /var/log/mail.log) showing repeated failed or anomalous login attempts with unusual characters in credentials; SQL or LDAP error messages logged by the backend database or directory service.
  • Database/Directory: Unexpected queries in SQL slow query logs or LDAP access logs originating from the Dovecot service account containing injected syntax; unauthorized account access or privilege escalation in the mail database.
  • Process: Dovecot worker processes making unexpected outbound connections or exhibiting abnormal query patterns to the SQL/LDAP backend.

Mitigation and workarounds

Upgrade Dovecot to version 2.4.4 or later (community edition) or OX Dovecot Pro to version 3.1.5 or later to fully remediate the vulnerability (OX Advisory). As an immediate workaround prior to patching, avoid using the safe filter in Dovecot template/pipeline configurations, particularly in authentication-related contexts (GitHub Advisory). Distribution-specific patches have been released for openSUSE, Ubuntu (USN-8365-1), and Fedora 44, and users of these platforms should apply available package updates promptly (Ubuntu Advisory, openSUSE).

Community reactions

The vulnerability was disclosed via the oss-security mailing list and Seclists Full Disclosure in May 2026, indicating standard coordinated disclosure practices (oss-sec, Full Disclosure). Major Linux distributions including Ubuntu, openSUSE, and Fedora responded promptly with security update advisories. No notable independent researcher commentary or significant social media discussion has been identified beyond standard vulnerability tracking and distribution advisories.

Additional resources


SourceThis report was generated using AI

Related Dovecot vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-27851CRITICAL9.1
  • Dovecot logoDovecot
  • dovecot24-devel
NoYesMay 12, 2026
CVE-2026-40016MEDIUM6.5
  • Dovecot logoDovecot
  • dovecot24-backend-mysql
NoYesMay 12, 2026
CVE-2026-33603MEDIUM5.3
  • Dovecot logoDovecot
  • dovecot22-backend-mysql
NoYesMay 12, 2026
CVE-2026-42006MEDIUM4.3
  • Dovecot logoDovecot
  • dovecot-pigeonhole-debuginfo
NoYesMay 12, 2026
CVE-2026-40020MEDIUM4.3
  • Dovecot logoDovecot
  • dovecot24-backend-mysql
NoYesMay 12, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management