/

CVE-2026-39962

Severity:

CRITICAL RISK

(9.6)

LDAP Injection in MISP Apache Authentication Integration

CVE-2026-39962

Analyzed

Vulnerability type

Category:

LDAP Injection

CWE:

CWE-90

Impact:

Authentication Bypass and Unauthorized Directory Access

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An LDAP injection vulnerability in MISP's Apache authentication integration allows user-controlled input to be embedded directly into LDAP search filters without proper escaping.

When ApacheAuthenticate.apacheEnv is configured to use a proxy-controlled server variable instead of REMOTE_USER, an attacker who can influence that value may manipulate LDAP queries to bypass authentication constraints or trigger unauthorized directory lookups.

Affected context

The vulnerability appears in MISP deployments that:

  • Use the Apache authentication module (ApacheAuthenticate.php) for user login
  • Configure ApacheAuthenticate.apacheEnv to read the username from a user-controllable server variable (e.g., via reverse proxies or custom headers) instead of the default REMOTE_USER
  • Rely on LDAP directory lookups for authentication or authorization decisions

Under these conditions, the username value can propagate into LDAP search filters without robust neutralization of LDAP meta-characters.

Exploit preconditions

  • Attack surface: HTTP requests reaching an Apache front-end that forwards a user-controlled value into the server environment (e.g., proxy headers, custom environment variables).
  • Required access: Ability to inject or control the configured server variable used as the "username" (often achievable by manipulating proxy headers or misconfigured SSO/proxy chains).
  • Trigger point: Authentication via MISP's ApacheAuthenticate.php where the username is used in an LDAP search filter without proper escaping.
  • Why exploitation is possible: The LDAP search filter is constructed by concatenating raw username input, without consistent neutralization of special LDAP filter characters such as *, (, ), \, or filter operators, matching the LDAP injection pattern described in CWE-90.

Why this happens

The underlying issue is improper construction of LDAP search filters from untrusted input. Instead of using parameterized or safely escaped values, the code path in ApacheAuthenticate.php directly interpolates the username value taken from an Apache environment variable into an LDAP filter string.

This is a classic instance of CWE-90: Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). LDAP meta-characters are interpreted as part of the filter syntax, enabling attackers to alter the logical structure of the query (e.g., broadening the search, bypassing constraints, or targeting unintended directory entries) rather than being treated as literal data.

Potential impact

  • Authentication constraints may be bypassed, allowing unauthorized users to be treated as valid or elevated accounts.
  • LDAP queries can be broadened to match additional directory entries, potentially mapping or enumerating user or group information.
  • Security controls that depend on LDAP group membership or attribute checks can be subverted.
  • Unintended or excessive LDAP traffic could be generated, potentially impacting directory service performance or stability.
  • In multi-tenant or integrated environments, compromised directory queries may indirectly expose sensitive organizational structure or identity metadata.

General mitigation guidance

Resilient mitigation focuses on treating all LDAP-related user input as untrusted and ensuring search filters are constructed safely:

  • Use library routines or APIs designed to escape or encode LDAP filter values, rather than manually concatenating strings.
  • Centralize LDAP filter construction in a small, well-reviewed utility that performs strict neutralization of special characters before building the filter.
  • Prefer parameterized or structured filter-building functions over raw string interpolation to avoid mixing control symbols and data.
  • Keep authentication and identity attributes sourced from trusted, server-side mechanisms wherever possible (e.g., carefully validated REMOTE_USER), minimizing reliance on proxy-controlled headers.
  • Apply least-privilege principles to LDAP bind accounts so that even if a filter is manipulated, the directory account cannot access sensitive branches or attributes.
  • Consider defense-in-depth controls such as enforcing attribute-level filters on the LDAP server side (e.g., access control lists, restricted search bases).

How teams detect issues like this

Detection usually combines code-level review with operational monitoring:

  • Static analysis: Configure rules or custom checks to flag string concatenation used to build LDAP filters, especially when the source is HTTP headers, environment variables, or other user-controlled input.
  • Code review: During security-focused reviews, inspect authentication and directory integration components for:
  • Direct interpolation of unescaped input into LDAP query strings
  • Custom filter-building logic that does not use standard escaping functions
  • Use of non-default environment variables or headers for username sourcing
  • Configuration review: Regularly validate Apache, proxy, and SSO configurations to ensure only trusted, server-side variables are mapped into authentication flows.
  • Runtime monitoring: Monitor LDAP logs for anomalous filter patterns, such as unexpected wildcards, complex logical operators, or queries that deviate from normal application behavior.
  • Automated tooling: Integrate security scanners or SAST tools that recognize LDAP injection sinks and sources into CI pipelines, with policies requiring manual approval for any changes to authentication or LDAP integration code.

Sources

SourceLink
github.comgithub.com/MISP/MISP/commit/380ee4136a7d9ce2fe63fce06d517839f30aba10
github.comgithub.com/MISP/MISP/commit/d7d671ea8f5822e91207dcad2003c35c30092a32
github.comgithub.com/MISP/MISP/releases/tag/v2.5.36
github.comgithub.com/MISP/MISP/security/advisories/GHSA-mc53-48w8-9g63

Frequently asked

questions

Yes, in configurations where an attacker can influence the server variable used as the username. If that variable is derived from HTTP headers or other request data from an untrusted source, the attack can be launched purely over the network.

The attacker must be able to control or significantly influence the value that Apache exposes in the environment variable configured by ApacheAuthenticate.apacheEnv. In many proxy-based or SSO setups, misconfigured header trust or insufficient input validation can make this value attacker-controlled.

Use robust LDAP filter escaping or parameterization for all user-derived values, and avoid building LDAP filter strings through direct concatenation. Additionally, constrain the authentication logic to rely on trusted identity sources (such as properly validated REMOTE_USER) and minimize exposure of LDAP internals to untrusted data.

Establish a standard LDAP abstraction layer that:

  • Encapsulates all filter construction and enforces escaping by default
  • Clearly separates data from control symbols
  • Rejects or normalizes untrusted input before it reaches directory APIs

Combine this with routine security reviews of authentication flows, strict proxy/header validation, and automated static analysis rules targeting LDAP query construction.

Find out what's already
exploitable in your codebase.