CVE-2026-40165: authentik: SAML NameID XML Comment Injection Enables Authentication Bypass via Identifier Truncation
Vulnerability summary
CVE-2026-40165 is a high (CVSS 8.7) XML Injection vulnerability in goauthentik authentik. EPSS estimates a 0.50% chance of exploitation in the next 30 days, higher than 43% of scored vulnerabilities.
Severe, CVSS 8.7 (CVE.org); no exploitation reported by the 5 checked sources; EPSS 1% (FIRST, 03-11-2026)
Source freshness unavailable
How is this decided?Timeline
- 20-05-2026PublishedVulnerability first disclosed.
- 21-05-2026Last modifiedVulnerability information updated.
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.
CVSS metrics
2 scores · 2 sources · 1 version- NVDNIST8.7HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
EPSS trend
Probability
0.50%
Chance of exploitation in the next 30 days
Percentile
43%
Versus all other CVEs
30-day change
Decrease -0.18 pp
From 0.68% on 04-10-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root cause- CWE-91XML InjectionThe product does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.
- CWE-287Improper AuthenticationWhen an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
- CWE-436Interpretation ConflictProduct A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.
Affected systems
Known conditions: network-reachable, no authentication, no user interaction (CVSS vector). Other conditions: not stated in public data.
Goauthentik1 product
- authentik< 2025.12.5 | ≥ 2026.2.0-rc1, < 2026.2.3
1 vendor · 1 product
References
3 links- github.com/goauthentik/authentik/security/advisories/GHSA-9wj8-xv4r-qwrpX Refsource CONFIRM