CVE-2026-40165: goauthentik authentik authentication bypass via SAML NameID XML comment injection

CVE-2026-40165 · Severity: high · CVSS 8.7 · Published 2026-05-21

authentik is an open-source identity provider used to manage user logins and access to corporate applications. A security flaw in how it handles SAML login responses allows an attacker to bypass authentication by manipulating their username or email identifier. By injecting specific code into their login data, an attacker could trick the system into logging them in as a different, potentially high-privileged user, leading to unauthorized access to sensitive data and systems.

Technologies: Goauthentik Authentik. Vendors: Goauthentik.

Quick answers

Is CVE-2026-40165 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-40165 being exploited in the wild.
How severe is CVE-2026-40165?
High severity, with a CVSS score of 8.7, published 21 May 2026.
Which products and versions are affected?
Goauthentik Authentik <= 2025.12.4, 2026.2.0-rc1 - 2026.2.2.
Is there a fix for CVE-2026-40165?
A patch was published on 2026-05-12: Versions 2025.12.5 and 2026.2.3 released Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-40165 attacked?
It is attacked over the network, in a hosted service.
Am I affected by CVE-2026-40165?
Check whether you run Goauthentik Authentik at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

An authentication bypass vulnerability exists in authentik due to improper extraction of the NameID value from SAML assertions. When processing SAML responses from a SAML Source with XML Signing enabled, the application fails to correctly handle XML comments within the NameID field. An attacker with the ability to modify their own NameID (such as a username or email) on the source provider can inject an XML comment to truncate the identifier. For example, changing an identifier to 'admin<!-- -->@example.com' might cause authentik to only see 'admin', granting the attacker access to the target account. This issue is fixed in versions 2025.12.5 and 2026.2.3.

Affected products

  • goauthentik authentik <= 2025.12.4, 2026.2.0-rc1 - 2026.2.2

Timeline

  • 2026-05-12: advisory: GitHub Security Advisory published by maintainers
  • 2026-05-12: patched: Versions 2025.12.5 and 2026.2.3 released
  • 2026-05-21: disclosed: CVE-2026-40165 published to NVD

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.