CVE-2026-40165 authentik: SAML NameID XML Comment Injection Enables Authentication Bypass via Identifier Truncation

High 8.7 Published Updated

Attackers can bypass authentication and access other accounts by injecting XML comments into SAML NameID values on instances with specific SAML configurations.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-40165?

CVE-2026-40165 is a high-severity authentication bypass vulnerability in goauthentik authentik, published on 20 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

authentik is an open-source identity provider. Versions 2025.12.4 and prior, and versions 2026.2.0-rc1 through 2026.2.2 were vulnerable to Authentication Bypass through SAML NameID XML Comment Injection. Due to how authentik extracted the NameID value from a SAML assertion, it was possible for an attacker to trick authentik into only seeing a part of the NameID value, potentially allowing an attacker to gain access to other accounts. This issue could be exploited on an authentik instance with a SAML Source, where the attacker had an account on the SAML Source and the ability to modify their NameID value (commonly username or E-mail), and XML Signing was enabled. The attacker could modify the SAML assertion given to authentik by injecting a comment within the NameID value, which effectively truncated the NameID value to the snippet before the comment, and gave the attacker access to any user account. This issue has been fixed in versions 2025.12.5 and 2026.2.3.

Weakness: CWE-91, CWE-436, CWE-287

Which versions are affected by CVE-2026-40165?

1 open source package ship an affected version, including authentik.

PackageAffectedFixed in
authentik BitnamiAll versions2025.12.5, 2026.2.3

How do I fix CVE-2026-40165?

Upgrade authentik to a fixed version for your release line: 2025.12.5 or 2026.2.3.

Upgrade, and rotate credentials and sessions that may have been exposed. More about Authentication bypass.

Is CVE-2026-40165 being exploited?

There is no known exploitation of CVE-2026-40165 in the wild and no public exploit code.

Sources

Also known as BIT-authentik-2026-40165, GHSA-9wj8-xv4r-qwrp.

Is CVE-2026-40165 in your software?

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

Check your SBOMs for free